Thread:Talk:PDF rendering/Architecture/What is the Round Robin (and why do we need a garbage collector)/reply

Adding the capability to speak HTTP to the collection extension might not be that hard and would not break the existing interface.

For client-side 'async' rendering without PHP timeout concerns, do an ajax HEAD request to kick off the parse. Then do some ajax polling with HEAD and  header set. Reveal the link when the request is ready.

Alternatively, kick off the render as above and reveal link to the file using an external IP for the PDF service (no short PHP timeout). Varnish will then collapse the requests for you. The spinning can still be done here as well.

A nice feature about using Varnish is that you get basically for free.
 * timeouts
 * bounded queuing
 * quick render start

phantomjs is also not as slow as mwlib. The HTML5 spec renders to 508 A4 pages in about 20 seconds. It has few and low-resolution graphics, but it does not seem to be inconceivable that even super-large books with 150dpi images will render in less time than even the PHP timeout.