Hello, I want to generate some PDFs from my Rails app. I use a PHP script to generate the PDF, and it works fine. In my Rails controller, I just have an action that calls : `#{full_command}` where full_command is something like "/usr/bin/php generate_pdf.php". It just works fine. Now I want to stress test a little my application. I use this simple ruby script to test my PDF generation : #!/usr/bin/ruby 10.times do `curl http://0.0.0.0:3000/contents/pdf` end The result is that only 3 PDFs are generated. If I use this ruby script : #!/usr/bin/ruby 10.times do `/usr/bin/php generate_pdf.php` end Then the 10 PDFs are generated very quickly. 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). Thanks in advance for your lights. Best, Thomas. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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 On Dec 14, 1:14 pm, "Thomas Balthazar" <thomas....-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hello, > > I want to generate some PDFs from my Rails app. > I use a PHP script to generate the PDF, and it works fine. > > In my Rails controller, I just have an action that calls : > `#{full_command}` > where full_command is something like "/usr/bin/php generate_pdf.php". > > It just works fine. > > Now I want to stress test a little my application. > I use this simple ruby script to test my PDF generation : > > #!/usr/bin/ruby > 10.times do > `curlhttp://0.0.0.0:3000/contents/pdf` > end > > The result is that only 3 PDFs are generated. > > If I use this ruby script : > #!/usr/bin/ruby > > 10.times do > `/usr/bin/php generate_pdf.php` > end > > Then the 10 PDFs are generated very quickly. > > 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). > > Thanks in advance for your lights. > Best, > Thomas.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Thanks for your help. On Dec 14, 2007 1:23 PM, harm <harmaarts-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > 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.> Try: > #!/usr/bin/ruby > 10.times do > Kernel.sleep(0.1) #in seconds > `curl http://0.0.0.0:3000/contents/pdf` > endI 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. :-/ Any idea?> > On Dec 14, 1:14 pm, "Thomas Balthazar" <thomas....-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > Hello, > > > > I want to generate some PDFs from my Rails app. > > I use a PHP script to generate the PDF, and it works fine. > > > > In my Rails controller, I just have an action that calls : > > `#{full_command}` > > where full_command is something like "/usr/bin/php generate_pdf.php". > > > > It just works fine. > > > > Now I want to stress test a little my application. > > I use this simple ruby script to test my PDF generation : > > > > #!/usr/bin/ruby > > 10.times do > > `curlhttp://0.0.0.0:3000/contents/pdf` > > end > > > > The result is that only 3 PDFs are generated. > > > > If I use this ruby script : > > #!/usr/bin/ruby > > > > 10.times do > > `/usr/bin/php generate_pdf.php` > > end > > > > Then the 10 PDFs are generated very quickly. > > > > 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). > > > > Thanks in advance for your lights. > > Best, > > Thomas. > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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. On Dec 14, 1:41 pm, "Thomas Balthazar" <thomas....-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Thanks for your help. > > On Dec 14, 2007 1:23 PM, harm <harmaa...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > 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. > > > Try: > > #!/usr/bin/ruby > > 10.times do > > Kernel.sleep(0.1) #in seconds > > `curlhttp://0.0.0.0:3000/contents/pdf` > > end > > 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. :-/ > > Any idea? > > > > > On Dec 14, 1:14 pm, "Thomas Balthazar" <thomas....-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Hello, > > > > I want to generate some PDFs from my Rails app. > > > I use a PHP script to generate the PDF, and it works fine. > > > > In my Rails controller, I just have an action that calls : > > > `#{full_command}` > > > where full_command is something like "/usr/bin/php generate_pdf.php". > > > > It just works fine. > > > > Now I want to stress test a little my application. > > > I use this simple ruby script to test my PDF generation : > > > > #!/usr/bin/ruby > > > 10.times do > > > `curlhttp://0.0.0.0:3000/contents/pdf` > > > end > > > > The result is that only 3 PDFs are generated. > > > > If I use this ruby script : > > > #!/usr/bin/ruby > > > > 10.times do > > > `/usr/bin/php generate_pdf.php` > > > end > > > > Then the 10 PDFs are generated very quickly. > > > > 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). > > > > Thanks in advance for your lights. > > > Best, > > > Thomas.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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''m a little bit stuck ... :-/ On Dec 14, 2007 1:45 PM, harm <harmaarts-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > 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. > > On Dec 14, 1:41 pm, "Thomas Balthazar" <thomas....-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > Thanks for your help. > > > > On Dec 14, 2007 1:23 PM, harm <harmaa...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > 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. > > > > > Try: > > > #!/usr/bin/ruby > > > 10.times do > > > Kernel.sleep(0.1) #in seconds > > > > `curlhttp://0.0.0.0:3000/contents/pdf` > > > end > > > > 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. :-/ > > > > Any idea? > > > > > > > > > On Dec 14, 1:14 pm, "Thomas Balthazar" <thomas....-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > Hello, > > > > > > I want to generate some PDFs from my Rails app. > > > > I use a PHP script to generate the PDF, and it works fine. > > > > > > In my Rails controller, I just have an action that calls : > > > > `#{full_command}` > > > > where full_command is something like "/usr/bin/php generate_pdf.php". > > > > > > It just works fine. > > > > > > Now I want to stress test a little my application. > > > > I use this simple ruby script to test my PDF generation : > > > > > > #!/usr/bin/ruby > > > > 10.times do > > > > `curlhttp://0.0.0.0:3000/contents/pdf` > > > > end > > > > > > The result is that only 3 PDFs are generated. > > > > > > If I use this ruby script : > > > > #!/usr/bin/ruby > > > > > > 10.times do > > > > `/usr/bin/php generate_pdf.php` > > > > end > > > > > > Then the 10 PDFs are generated very quickly. > > > > > > 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). > > > > > > Thanks in advance for your lights. > > > > Best, > > > > Thomas. > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Dec 14, 2007 6:21 PM, Thomas Balthazar <thomas.tmp-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > 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''m a little bit stuck ... :-/Which version of bdrb? Can you paste the code of your worker? -- Let them talk of their oriental summer climes of everlasting conservatories; give me the privilege of making my own summer with my own coals. http://gnufied.org --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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" On Dec 15, 2007 8:31 PM, hemant <gethemant-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > On Dec 14, 2007 6:21 PM, Thomas Balthazar <thomas.tmp-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > 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''m a little bit stuck ... :-/ > > Which version of bdrb? Can you paste the code of your worker? > > > -- > Let them talk of their oriental summer climes of everlasting > conservatories; give me the privilege of making my own summer with my > own coals. > > http://gnufied.org > > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Thomas, On Dec 16, 2007 8:43 PM, Thomas Balthazar <thomas.tmp-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > 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.> > > On Dec 15, 2007 8:31 PM, hemant <gethemant-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > On Dec 14, 2007 6:21 PM, Thomas Balthazar <thomas.tmp-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > 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''m a little bit stuck ... :-/ > > > > Which version of bdrb? Can you paste the code of your worker? > > > > > > -- > > Let them talk of their oriental summer climes of everlasting > > conservatories; give me the privilege of making my own summer with my > > own coals. > > > > http://gnufied.org > > > > > > > > > > > > > >-- Let them talk of their oriental summer climes of everlasting conservatories; give me the privilege of making my own summer with my own coals. http://gnufied.org --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---