Forum Feature requests

Prince Process Statistics

joelmeador
We are more and more running into an issue on DocRaptor where individual users' documents are causing issues for the service due to scarce resources being dominated. We used to be able to figure this out just looking at who was making lots of docs, but it turns out a lot of people are making a lot of PDFs around the clock. :)

Is there any way we could get some form of process statistics from Prince? What I'm thinking is CPU consumption and RAM consumption, either as an optionally printed piece of data directly from the CLI, or accessible via the javascript API (like Prince.page_count and friends)

Try DocRaptor - PrinceXML web service and official PrinceXML partner

pjrm
To see the sorts of statistics that are available (if you're using a Unix-like operating system), try doing ‘man 2 getrusage’. A literal interpretation of ‘RAM consumption’ might be the ‘maximum resident set size’ field, but the right fields to use would depend in part on what resources your server is most short of (swap space, address space, or the much more likely case that the server is finishing all the jobs but slowly due to thrashing). You might actually want one of the less obvious measures, such as number of major page faults (plus number of I/O requests).

I would guess that the most convenient interface for you would be CLI rather than JavaScript. This also has the benefit that you can get something going straight away, rather than needing discussion of what an API should look like, because you can use a shell-script wrapper to run prince from gnu time, which has a --format argument to give you exactly the format you choose: try ‘man 1 time’ if you're using a Gnu-based system.

(Note that your shell might well have a built-in version of time that lacks a --format option, in which case you might need to tell the shell to use the gnu version: e.g. by giving a full path such as ‘/usr/bin/time’ or ‘/opt/gnu/time’, or some shells allow ‘\time’ or ‘command time’ to consult $PATH.)
joelmeador
Good call re: time. That will get me through this current issue.

I figured this might also be a way to ease into a conversation about more stats from Prince. PDF stats would also be cool: number and size of resources downloaded (as well as timings); some stats around complexity to go with page count like number of boxes generated, fonts used, etc.

Thanks, @pjrm!

Try DocRaptor - PrinceXML web service and official PrinceXML partner

mikeday
I think we can revisit this in February in preparation for the Prince 11 release. Having timings available for downloading remote resources would help to diagnose slow conversions.