Does anyone have a clue about what I could do for the 10 PDFs being
generated when called in my Rails controller?
I can't realize where the problem is ...
Is this a Mongrel issue (I'm using Rails 2.0 with the Mongrel test environment)?
Does I have to use something like BackgroundRB? (I'd prefer not to).
I would guess that this is related to the fact that you fire of 10
requests to your webserver in absolutely no time(under 1ms?). I think
not all your requests are being processed by the server. Try:
#!/usr/bin/ruby
10.times do
Kernel.sleep(0.1) #in seconds
`curl http://0.0.0.0:3000/contents/pdf\`
end
I would guess that this is related to the fact that you fire of 10
requests to your webserver in absolutely no time(under 1ms?). I think
not all your requests are being processed by the server.
in my development.log, I can see that the 10 requests are processed.
I have to increase the sleep time to 0.8 secs in order to have the 10
PDFs generated.
So if 10 people request the PDF at the same time, they won't have it
generated. :-/
Not sure on what webserver you are testing on, but from your script I
am guessing Webbrick. Which is really only for testing and not for
production. When using Apache/Mongrel you will see vastly increased
response times. And it is the response times you are concerned about.
I dont think you PDF generation script is too slow.
I'm using the Mongrel that ships with Rails 2.0.1, with the DEV environment.
I've tried to put my `#{full_command}` in a BackgroundRB worker, but I
get the same problem ...
I downloaded the last version of bdrb from the SVN trunk.
My code in the worker was just a single line :
`#{full_command}` where full_command looks like "/usr/bin/php generate_pdf.php"
I downloaded the last version of bdrb from the SVN trunk.
My code in the worker was just a single line :
`#{full_command}` where full_command looks like "/usr/bin/php generate_pdf.php"
You need to specify full path to generate_pdf.php, that will solve the problem.