Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Interesting question. From all the different solutions i assume you are quite flexible in what you can do.</p> <p>Personally i would use site B as a job queue server with the db on it (though the db would also be better on a different server). Ask for the users email address and once the job (processing the PDF) has been completed they get it emailed to them, or you could do what i suggested in the comments and send them to a page saying "generating pdf, will refresh in 10 seconds" which keeps refreshing until it finds the generated PDF. This would also allow it to scale pretty well (just add more workers) and would not hold up users while the PDF is being generated.</p> <p>You can use Gearman to interface with PHP to create the job queue.</p> <p><a href="http://php.net/manual/en/book.gearman.php" rel="nofollow">http://php.net/manual/en/book.gearman.php</a></p> <p><strong>Pros</strong></p> <ul> <li>Scales very well - just add more workers if you need more PDF's to be generated at once</li> <li>Uses are not held up thinking the page has crashed while the PDF is generated</li> <li>Not limited to just PDF's, you can queue any CPU intensive jobs in it</li> <li>Won't need to be ripped out and replaced with something different as site traffic increases (just add more workers)</li> <li>Allows control of how many processes / threads are trying to generate PDF's (apache for example will allow say 10 or more PDF's to be generated at once - you have little control over it when done directly in the web requests process and would be a way for attackers to crash your site)</li> </ul> <p><strong>Cons</strong></p> <ul> <li>Requires installation and setup of gearman</li> <li>Requires you to create the gearman PHP scripts to actually generate the PDF</li> </ul> <p>The main reason i would go down this route is because of the user experience, ease of scalability and control over the worker processes.</p> <p><strong>Side Note</strong></p> <p>Your setup of site A and B seems a little strange though i'm sure you have your reasons. If you have two servers, you would be better with nginx on site A proxying all requests to the internal server B with Apache, DB and gearman on it. You can then seperate the apps to seperate servers as your site grows in traffic.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload