Hi Please could someone clarify how Mongrel behaves when uploading files? I have an application with Apache which proxies to about 5 mongrels. Files are uploaded to the system from mobile PDAs using GPRS, and the files are about 1 - 3 MB (so uploads take several minutes). Will this mean that a Mongrel will be tied up serving the upload for the duration of the upload? I know Rails is single threaded, but I thought Mongrel wasn''t. I expect (perhaps wrongly) that Mongrel creates a new thread that handles the upload, streams it to a TempFile (or something like it), then when it is ready, passes the request on to Rails, which deals with it. That is what the trace from the server looks like, as the upload actions take a few milliseconds to complete. Or is it that for the duration of the upload, that Mongrel will be blocked and won''t service requests until the upload is complete? Thanks very much for anybody''s help. --~--~---------~--~----~------------~-------~--~----~ 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 31 Oct 2007, at 18:12, matt wrote:> Please could someone clarify how Mongrel behaves when uploading > files? I have an application with Apache which proxies to about 5 > mongrels. Files are uploaded to the system from mobile PDAs using > GPRS, and the files are about 1 - 3 MB (so uploads take several > minutes). Will this mean that a Mongrel will be tied up serving the > upload for the duration of the upload? I know Rails is single > threaded, but I thought Mongrel wasn''t. I expect (perhaps wrongly) > that Mongrel creates a new thread that handles the upload, streams it > to a TempFile (or something like it), then when it is ready, passes > the request on to Rails, which deals with it. That is what the trace > from the server looks like, as the upload actions take a few > milliseconds to complete. Or is it that for the duration of the > upload, that Mongrel will be blocked and won''t service requests until > the upload is complete?You are correct in your assumption that mongrel will write to a tempfile and invoke rails when the upload has completely finished. Best regards Peter De Berdt --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Hi Peter Thanks. Does that mean that a Mongrel will spawn a new thread to deal with the file upload and still be able to service other requests in the meantime? Cheers On Oct 31, 8:41 pm, Peter De Berdt <peter.de.be...-LPO8gxj9N8aZIoH1IeqzKA@public.gmane.org> wrote:> On 31 Oct 2007, at 18:12, matt wrote: > > > Please could someone clarify how Mongrel behaves when uploading > > files? I have an application with Apache which proxies to about 5 > > mongrels. Files are uploaded to the system from mobile PDAs using > > GPRS, and the files are about 1 - 3 MB (so uploads take several > > minutes). Will this mean that a Mongrel will be tied up serving the > > upload for the duration of the upload? I know Rails is single > > threaded, but I thought Mongrel wasn''t. I expect (perhaps wrongly) > > that Mongrel creates a new thread that handles the upload, streams it > > to a TempFile (or something like it), then when it is ready, passes > > the request on to Rails, which deals with it. That is what the trace > > from the server looks like, as the upload actions take a few > > milliseconds to complete. Or is it that for the duration of the > > upload, that Mongrel will be blocked and won''t service requests until > > the upload is complete? > > You are correct in your assumption that mongrel will write to a > tempfile and invoke rails when the upload has completely finished. > > Best regards > > Peter De Berdt--~--~---------~--~----~------------~-------~--~----~ 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 was at Railscon Europe and the guy from Twitter said that Mongrel was single thread. Their config is set to only send one job at a time to each mongrel using some of the newer Apache load balancing stuff. So, tempfile or not, it may be a bit of a wait. He recommended passing off long-running jobs to a daemon not sure how you''d do this for file upload though. On Oct 31, 9:53 pm, matt <matthewjsumm...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> Hi Peter > > Thanks. Does that mean that a Mongrel will spawn a new thread to deal > with the file upload and still be able to service other requests in > the meantime? > > Cheers > > On Oct 31, 8:41 pm, Peter De Berdt <peter.de.be...-LPO8gxj9N8aZIoH1IeqzKA@public.gmane.org> wrote: > > > On 31 Oct 2007, at 18:12, matt wrote: > > > > Please could someone clarify how Mongrel behaves when uploading > > > files? I have an application with Apache which proxies to about 5 > > > mongrels. Files are uploaded to the system from mobile PDAs using > > > GPRS, and the files are about 1 - 3 MB (so uploads take several > > > minutes). Will this mean that a Mongrel will be tied up serving the > > > upload for the duration of the upload? I know Rails is single > > > threaded, but I thought Mongrel wasn''t. I expect (perhaps wrongly) > > > that Mongrel creates a new thread that handles the upload, streams it > > > to a TempFile (or something like it), then when it is ready, passes > > > the request on to Rails, which deals with it. That is what the trace > > > from the server looks like, as the upload actions take a few > > > milliseconds to complete. Or is it that for the duration of the > > > upload, that Mongrel will be blocked and won''t service requests until > > > the upload is complete? > > > You are correct in your assumption that mongrel will write to a > > tempfile and invoke rails when the upload has completely finished. > > > Best regards > > > Peter De Berdt--~--~---------~--~----~------------~-------~--~----~ 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 1 Nov 2007, at 12:57, ghoti wrote:> > I was at Railscon Europe and the guy from Twitter said that Mongrel > was single thread. Their config is set to only send one job at a time > to each mongrel using some of the newer Apache load balancing stuff. > So, tempfile or not, it may be a bit of a wait. He recommended passing > off long-running jobs to a daemon not sure how you''d do this for file > upload though.mongrel is single threaded from the point of view of serving rails requests, which was all that was discussed at that session. Other than that it is multithreaded (http://mongrel.rubyforge.org/faq.html) and uploading a file won''t block a mongrel instance (you can even show an upload progress page - see http://mongrel.rubyforge.org/docs/upload_progress.html Fred> > > On Oct 31, 9:53 pm, matt <matthewjsumm...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: >> Hi Peter >> >> Thanks. Does that mean that a Mongrel will spawn a new thread to >> deal >> with the file upload and still be able to service other requests in >> the meantime? >> >> Cheers >> >> On Oct 31, 8:41 pm, Peter De Berdt <peter.de.be...-LPO8gxj9N8aZIoH1IeqzKA@public.gmane.org> wrote: >> >>> On 31 Oct 2007, at 18:12, matt wrote: >> >>>> Please could someone clarify how Mongrel behaves when uploading >>>> files? I have an application with Apache which proxies to about 5 >>>> mongrels. Files are uploaded to the system from mobile PDAs using >>>> GPRS, and the files are about 1 - 3 MB (so uploads take several >>>> minutes). Will this mean that a Mongrel will be tied up serving >>>> the >>>> upload for the duration of the upload? I know Rails is single >>>> threaded, but I thought Mongrel wasn''t. I expect (perhaps wrongly) >>>> that Mongrel creates a new thread that handles the upload, >>>> streams it >>>> to a TempFile (or something like it), then when it is ready, passes >>>> the request on to Rails, which deals with it. That is what the >>>> trace >>>> from the server looks like, as the upload actions take a few >>>> milliseconds to complete. Or is it that for the duration of the >>>> upload, that Mongrel will be blocked and won''t service requests >>>> until >>>> the upload is complete? >> >>> You are correct in your assumption that mongrel will write to a >>> tempfile and invoke rails when the upload has completely finished. >> >>> Best regards >> >>> Peter De Berdt > > > --~--~---------~--~----~------------~-------~--~----~ > 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 > -~----------~----~----~----~------~----~------~--~--- >