A couple of questions please: What is the benefit of having more than one Mongrel/Rails instance on the same machine, could one instance not serve as many requests as say three instances? Is Mongrel Cluster a Apache add-in (like mod_*) or a separately running load balancer which runs on a separate port, I could not work it out from the sample Apache config... |# Redirect all non-static requests to cluster RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f RewriteRule ^/(.*)$ balancer://mongrel_cluster%{REQUEST_URI} [P,QSA,L] How does ||balancer://mongrel_cluster |work? Many thanks, K.
Kris Leech wrote:> A couple of questions please: > > What is the benefit of having more than one Mongrel/Rails instance on > the same machine, could one instance not serve as many requests as say > three instances? > > Is Mongrel Cluster a Apache add-in (like mod_*) or a separately running > load balancer which runs on a separate port, I could not work it out > from the sample Apache config... > > |# Redirect all non-static requests to cluster > RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f > RewriteRule ^/(.*)$ balancer://mongrel_cluster%{REQUEST_URI} [P,QSA,L] > > How does ||balancer://mongrel_cluster |work? >My understanding is that one mongrel can only handle one request at a time. Therefore 3 mongrel can process 3 request simultaniously. The balancer is a module for apache >= 2.1 the balancer itself is not a seperate process, the pack of mongrels of course are seperate processes. HTH, Jeroen
Jeroen Houben wrote:>Kris Leech wrote: > > >>A couple of questions please: >> >>What is the benefit of having more than one Mongrel/Rails instance on >>the same machine, could one instance not serve as many requests as say >>three instances? >> >>Is Mongrel Cluster a Apache add-in (like mod_*) or a separately running >>load balancer which runs on a separate port, I could not work it out >>from the sample Apache config... >> >>|# Redirect all non-static requests to cluster >> RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f >> RewriteRule ^/(.*)$ balancer://mongrel_cluster%{REQUEST_URI} [P,QSA,L] >> >>How does ||balancer://mongrel_cluster |work? >> >> >> >My understanding is that one mongrel can only handle one request at a >time. Therefore 3 mongrel can process 3 request simultaniously. > >I see, and this is because Mongrel is not threaded, so its kind of like replicating threads by using whole instances.>The balancer is a module for apache >= 2.1 >the balancer itself is not a seperate process, the pack of mongrels of >course are seperate processes. > >Thanks, does it replace mod_proxy_balance?>HTH, > >Jeroen > > > >_______________________________________________ >Mongrel-users mailing list >Mongrel-users at rubyforge.org >http://rubyforge.org/mailman/listinfo/mongrel-users > > > > >
Kris Leech wrote:> Jeroen Houben wrote: > > >> Kris Leech wrote: >> >> >> >>> A couple of questions please: >>> >>> What is the benefit of having more than one Mongrel/Rails instance on >>> the same machine, could one instance not serve as many requests as say >>> three instances? >>> >>> Is Mongrel Cluster a Apache add-in (like mod_*) or a separately running >>> load balancer which runs on a separate port, I could not work it out >>> >> >from the sample Apache config... >> >>> |# Redirect all non-static requests to cluster >>> RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f >>> RewriteRule ^/(.*)$ balancer://mongrel_cluster%{REQUEST_URI} [P,QSA,L] >>> >>> How does ||balancer://mongrel_cluster |work? >>> >>> >>> >>> >> My understanding is that one mongrel can only handle one request at a >> time. Therefore 3 mongrel can process 3 request simultaniously. >> >> >> > I see, and this is because Mongrel is not threaded, so its kind of like > replicating threads by using whole instances. >Well I''m not entirely sure about that. I think mongrel can do threads but you really shouldn''t use Rails with threads. http://david.planetargon.us/articles/2006/08/08/why-you-need-multiple-mongrel-instances-with-rails> >> The balancer is a module for apache >= 2.1 >> the balancer itself is not a seperate process, the pack of mongrels of >> course are seperate processes. >> >> >> > Thanks, does it replace mod_proxy_balance? > >No balancer://mongrel_cluster *is* mod_proxy_balancer, please look at http://mongrel.rubyforge.org/docs/apache.html for more details. Jeroen
mongrel_cluster is installed with the mongrel gem and makes it easy to serve multiple mongrel instances. `mongrel_rails cluster::configure -h` for help. On 9/4/06, Jeroen Houben <jeroen at supercool.nl> wrote:> Kris Leech wrote: > > Jeroen Houben wrote: > > > > > >> Kris Leech wrote: > >> > >> > >> > >>> A couple of questions please: > >>> > >>> What is the benefit of having more than one Mongrel/Rails instance on > >>> the same machine, could one instance not serve as many requests as say > >>> three instances? > >>> > >>> Is Mongrel Cluster a Apache add-in (like mod_*) or a separately running > >>> load balancer which runs on a separate port, I could not work it out > >>> > >> >from the sample Apache config... > >> > >>> |# Redirect all non-static requests to cluster > >>> RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f > >>> RewriteRule ^/(.*)$ balancer://mongrel_cluster%{REQUEST_URI} [P,QSA,L] > >>> > >>> How does ||balancer://mongrel_cluster |work? > >>> > >>> > >>> > >>> > >> My understanding is that one mongrel can only handle one request at a > >> time. Therefore 3 mongrel can process 3 request simultaniously. > >> > >> > >> > > I see, and this is because Mongrel is not threaded, so its kind of like > > replicating threads by using whole instances. > > > Well I''m not entirely sure about that. I think mongrel can do threads > but you really shouldn''t use Rails with threads. > http://david.planetargon.us/articles/2006/08/08/why-you-need-multiple-mongrel-instances-with-rails > > > >> The balancer is a module for apache >= 2.1 > >> the balancer itself is not a seperate process, the pack of mongrels of > >> course are seperate processes. > >> > >> > >> > > Thanks, does it replace mod_proxy_balance? > > > > > No balancer://mongrel_cluster *is* mod_proxy_balancer, please look at > http://mongrel.rubyforge.org/docs/apache.html for more details. > > Jeroen > > _______________________________________________ > Mongrel-users mailing list > Mongrel-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/mongrel-users >
On 9/4/06, Kris Leech <krisleech at interkonect.com> wrote:> Jeroen Houben wrote:> >My understanding is that one mongrel can only handle one request at a > >time. Therefore 3 mongrel can process 3 request simultaniously. > > > > > I see, and this is because Mongrel is not threaded, so its kind of like > replicating threads by using whole instances.Mongrel is threaded. It will create a new thread for each connection. However, Rails does bad, unfriendly things when one tries to run multiple threads of it at the same time. So the Mongrel handler for Rails synchronizes Rails calls so that only one runs at a time. Thus, to handle simultaneous Rails requests with Mongrel one needs more than one Mongrel process. Kirk Haines Kirk Haines
Somebody asked similar question earlier i guess...why run multiple instances of mongrel..when it is threaded? The simple answer is...ruby threads are not native threads.And hence..all the ruby threads are running your current interpretor. Also, if you have multi-core CPUs..you won''t be able to take advantage of that with single mongrel process..even though it is threaded and hence in production mode....you should run 8 to 10 mongrel servers( as per official documentation,but depends upon your hardware and hit rate) Again..i could be wrong..but thats my humble opinion. On 9/4/06, Kirk Haines <wyhaines at gmail.com> wrote:> > On 9/4/06, Kris Leech <krisleech at interkonect.com> wrote: > > Jeroen Houben wrote: > > > >My understanding is that one mongrel can only handle one request at a > > >time. Therefore 3 mongrel can process 3 request simultaniously. > > > > > > > > I see, and this is because Mongrel is not threaded, so its kind of like > > replicating threads by using whole instances. > > Mongrel is threaded. It will create a new thread for each connection. > However, Rails does bad, unfriendly things when one tries to run > multiple threads of it at the same time. So the Mongrel handler for > Rails synchronizes Rails calls so that only one runs at a time. Thus, > to handle simultaneous Rails requests with Mongrel one needs more than > one Mongrel process. > > > Kirk Haines > > > > Kirk Haines > _______________________________________________ > Mongrel-users mailing list > Mongrel-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/mongrel-users >-- nothing much to talk -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/mongrel-users/attachments/20060905/2c683866/attachment.html
Vishnu Gopal wrote:>mongrel_cluster is installed with the mongrel gem and makes it easy to >serve multiple mongrel instances. > >`mongrel_rails cluster::configure -h` for help. > >Ummmm.... An earlier poster said mongrel_rails is mod_proxy_balancer, I thought the mod_* where compiled code, that about looks like ruby code?> >On 9/4/06, Jeroen Houben <jeroen at supercool.nl> wrote: > > >>Kris Leech wrote: >> >> >>>Jeroen Houben wrote: >>> >>> >>> >>> >>>>Kris Leech wrote: >>>> >>>> >>>> >>>> >>>> >>>>>A couple of questions please: >>>>> >>>>>What is the benefit of having more than one Mongrel/Rails instance on >>>>>the same machine, could one instance not serve as many requests as say >>>>>three instances? >>>>> >>>>>Is Mongrel Cluster a Apache add-in (like mod_*) or a separately running >>>>>load balancer which runs on a separate port, I could not work it out >>>>> >>>>> >>>>> >>>>>from the sample Apache config... >>>> >>>> >>>> >>>>>|# Redirect all non-static requests to cluster >>>>> RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f >>>>> RewriteRule ^/(.*)$ balancer://mongrel_cluster%{REQUEST_URI} [P,QSA,L] >>>>> >>>>>How does ||balancer://mongrel_cluster |work? >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>My understanding is that one mongrel can only handle one request at a >>>>time. Therefore 3 mongrel can process 3 request simultaniously. >>>> >>>> >>>> >>>> >>>> >>>I see, and this is because Mongrel is not threaded, so its kind of like >>>replicating threads by using whole instances. >>> >>> >>> >>Well I''m not entirely sure about that. I think mongrel can do threads >>but you really shouldn''t use Rails with threads. >>http://david.planetargon.us/articles/2006/08/08/why-you-need-multiple-mongrel-instances-with-rails >> >> >>>>The balancer is a module for apache >= 2.1 >>>>the balancer itself is not a seperate process, the pack of mongrels of >>>>course are seperate processes. >>>> >>>> >>>> >>>> >>>> >>>Thanks, does it replace mod_proxy_balance? >>> >>> >>> >>> >>No balancer://mongrel_cluster *is* mod_proxy_balancer, please look at >>http://mongrel.rubyforge.org/docs/apache.html for more details. >> >>Jeroen >> >>_______________________________________________ >>Mongrel-users mailing list >>Mongrel-users at rubyforge.org >>http://rubyforge.org/mailman/listinfo/mongrel-users >> >> >> >_______________________________________________ >Mongrel-users mailing list >Mongrel-users at rubyforge.org >http://rubyforge.org/mailman/listinfo/mongrel-users > > > > >
hemant wrote:> Somebody asked similar question earlier i guess...why run multiple > instances of mongrel..when it is threaded? > The simple answer is...ruby threads are not native threads.And > hence..all the ruby threads are running your current interpretor.So Mongrel is threaded but can''t process concurrent requests so requires multiple instances... Am I getting that right?> > Also, if you have multi-core CPUs..you won''t be able to take advantage > of that with single mongrel process..even though it is threaded and > hence in production mode....you should run 8 to 10 mongrel servers( as > per official documentation,but depends upon your hardware and hit rate) > > Again..i could be wrong..but thats my humble opinion. > > On 9/4/06, *Kirk Haines* <wyhaines at gmail.com > <mailto:wyhaines at gmail.com>> wrote: > > On 9/4/06, Kris Leech <krisleech at interkonect.com > <mailto:krisleech at interkonect.com>> wrote: > > Jeroen Houben wrote: > > > >My understanding is that one mongrel can only handle one > request at a > > >time. Therefore 3 mongrel can process 3 request simultaniously. > > > > > > > > I see, and this is because Mongrel is not threaded, so its kind > of like > > replicating threads by using whole instances. > > Mongrel is threaded. It will create a new thread for each > connection. > However, Rails does bad, unfriendly things when one tries to run > multiple threads of it at the same time. So the Mongrel handler for > Rails synchronizes Rails calls so that only one runs at a time. Thus, > to handle simultaneous Rails requests with Mongrel one needs more > than > one Mongrel process. > > > Kirk Haines > > > > Kirk Haines > _______________________________________________ > Mongrel-users mailing list > Mongrel-users at rubyforge.org <mailto:Mongrel-users at rubyforge.org> > http://rubyforge.org/mailman/listinfo/mongrel-users > > > > > -- > nothing much to talk > >------------------------------------------------------------------------ > >_______________________________________________ >Mongrel-users mailing list >Mongrel-users at rubyforge.org >http://rubyforge.org/mailman/listinfo/mongrel-users >
On 5.9.2006, at 10.44, Kris Leech wrote:> Vishnu Gopal wrote: > >> mongrel_cluster is installed with the mongrel gem and makes it >> easy to >> serve multiple mongrel instances. >> >> `mongrel_rails cluster::configure -h` for help. >> >> > > Ummmm.... An earlier poster said mongrel_rails is mod_proxy_balancer,No, he didn''t. He said the part of apache config file you listed was mod_proxy_balancer. The latter balances requests between multiple mongrels that just listen to a high port. mongrel_cluster just sets up a cluster of multiple mongrels with a single command. You still need something to proxy the http requests from port 80 to these mongrels. That something could be a load balancer (e.g. pound) or a web server capable of proxy balancing (like nginx, hopefully next version of lighty and Apache2.2 with mod_proxy_balancer). //jarkko -- Jarkko Laine http://jlaine.net http://odesign.fi -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2363 bytes Desc: not available Url : http://rubyforge.org/pipermail/mongrel-users/attachments/20060905/c0aed013/attachment.bin
On 5.9.2006, at 10.46, Kris Leech wrote:> hemant wrote: > >> Somebody asked similar question earlier i guess...why run multiple >> instances of mongrel..when it is threaded? >> The simple answer is...ruby threads are not native threads.And >> hence..all the ruby threads are running your current interpretor. > > So Mongrel is threaded but can''t process concurrent requests so > requires > multiple instances... > Am I getting that right?Yes, just like you would have multiple fcgi processes running. However, you can get away quite nicely with just one mongrel if your load is not huge and you don''t serve big files with that mongrel instance. //jarkko -- Jarkko Laine http://jlaine.net http://odesign.fi -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2363 bytes Desc: not available Url : http://rubyforge.org/pipermail/mongrel-users/attachments/20060905/29549264/attachment.bin
On 9/5/06, Kris Leech <krisleech at interkonect.com> wrote:> hemant wrote: > > > Somebody asked similar question earlier i guess...why run multiple > > instances of mongrel..when it is threaded? > > The simple answer is...ruby threads are not native threads.And > > hence..all the ruby threads are running your current interpretor. > > So Mongrel is threaded but can''t process concurrent requests so requires > multiple instances... > Am I getting that right?No. Mongrel is threaded and Mongrel can process concurrent requests. The handler for Rails is setup to not process concurrent requests, though, to avoid Rails badness. Other Mongrel handlers may be (and probably are, in general) fully capable of operating concurrently. Kirk Haines