From jjones at raindrop.co.uk Wed Mar 1 11:34:54 2006 From: jjones at raindrop.co.uk (Jeff Jones) Date: Wed, 1 Mar 2006 16:34:54 -0000 Subject: [Mongrel] Threading & database connections. Message-ID: <2366790BFF3A2944A8ED995501FAA95001D6E136@rd-w2k3-svrexg.raindrop.uk.local> Hi Luis Thank you for the reply. It does shed some light on things. > If you check the code in mongrel_rails, you will see that because > rails isn't "thread-safe", a Mutex was used to avoid controllers from > executing simultaneously. The number of active connections shouldn't > be different from webrick. I have run the server with the -n 1 Parameter for a while now and it only uses two connections (as it should). Because of this I am drawing the following conclusion. 1. (Most likely) My code is somehow buggering up ( I am a beginner after all). 2. Rails is somehow thinking that there is no DB connection when run from a second thread due to a rails bug. 2. Rails is somehow thinking that there is no DB connection when run from a second thread due to the way the MUTEX is coded. (I haven't looked at the source code, being a beginner it probably wouldn't help) I will see if I can find out more but this is a personal project so I can only do it at lunchtime. Jeff From zedshaw at zedshaw.com Wed Mar 1 15:23:39 2006 From: zedshaw at zedshaw.com (zedshaw@zedshaw.com) Date: Wed, 1 Mar 2006 12:23:39 -0800 Subject: [Mongrel] Threading & database connections. In-Reply-To: <2366790BFF3A2944A8ED995501FAA95001D6E136@rd-w2k3-svrexg.raindrop.uk.local> References: <2366790BFF3A2944A8ED995501FAA95001D6E136@rd-w2k3-svrexg.raindrop.uk.local> Message-ID: <20060301202339.GA8958@pizarro.dreamhost.com> Hi Jeff, You've pretty much figured it out, but there's a bit more detail. First, here's how AR does "thread safety". AR creates DB connections and then puts them in the thread local storage. What this means is if you run any app with AR then you get one DB connection per thread you use AR in. Now, what mongrel does (which is shown by the -n option) is it creates a small set of work threads to process requests. Initially this is 20. What you should see is as AR gets used your connections will increase up to 20. The reason is each worker thread will get it's only copy of the thread local DB connection from AR. With your setting to -n 1 you can keep the DB connections down to 2, but then you don't get any advantage of parallel processing. So, you've got two choices: 1) Use a -n parameter that's reasonable for your uses but doesn't kill your performance. If you need to only ever have 2 then do #2. 2) Add ActiveRecord.threaded_connections = false to your environment.rb What #2 does is tells AR to make one connection and always use that. I may just add an option to mongrel_rails that sets this for you since people keep asking about it. Zed On Wed, Mar 01, 2006 at 04:34:54PM -0000, Jeff Jones wrote: > I have run the server with the -n 1 Parameter for a while now and it only uses two > connections (as it should). Because of this I am drawing the following conclusion. > > 1. (Most likely) My code is somehow buggering up ( I am a beginner after all). > 2. Rails is somehow thinking that there is no DB connection when run from a second thread due to a rails bug. > 2. Rails is somehow thinking that there is no DB connection when run from a second thread due to the way the MUTEX is coded. (I haven't looked at the source code, being a beginner it probably wouldn't help) > > I will see if I can find out more but this is a personal project so I can only do it at lunchtime. > > Jeff > > _______________________________________________ > Mongrel-users mailing list > Mongrel-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/mongrel-users From schoenm at earthlink.net Wed Mar 1 15:40:47 2006 From: schoenm at earthlink.net (Michael Schoen) Date: Wed, 01 Mar 2006 12:40:47 -0800 Subject: [Mongrel] Threading & database connections. In-Reply-To: <20060301202339.GA8958@pizarro.dreamhost.com> References: <2366790BFF3A2944A8ED995501FAA95001D6E136@rd-w2k3-svrexg.raindrop.uk.local> <20060301202339.GA8958@pizarro.dreamhost.com> Message-ID: <440606CF.6030005@earthlink.net> zedshaw at zedshaw.com wrote: > 2) Add ActiveRecord.threaded_connections = false to your environment.rb > > What #2 does is tells AR to make one connection and always use that. > > I may just add an option to mongrel_rails that sets this for you since > people keep asking about it. There's a thread on rails-core about this now, and in the ticket referenced below. That config is now called "allow_concurrency" (set to false), and is supposed to be set in environment.rb. http://dev.rubyonrails.org/ticket/3979 From jjones at raindrop.co.uk Wed Mar 1 17:37:28 2006 From: jjones at raindrop.co.uk (Jeff Jones) Date: Wed, 1 Mar 2006 22:37:28 -0000 Subject: [Mongrel] Threading & database connections. Message-ID: <2366790BFF3A2944A8ED995501FAA95001D6E144@rd-w2k3-svrexg.raindrop.uk.local> Hi Michael and Zed. Thank you for all the help. I actually read that thread a few days ago but the significance of it didn't dawn on me. I will try the allow_concurrency change and see if there is an obvious performance difference. Thanks for the help. Jeff -----Original Message----- From: mongrel-users-bounces at rubyforge.org [mailto:mongrel-users-bounces at rubyforge.org] On Behalf Of Michael Schoen Sent: 01 March 2006 20:41 To: mongrel-users at rubyforge.org Subject: Re: [Mongrel] Threading & database connections. zedshaw at zedshaw.com wrote: > 2) Add ActiveRecord.threaded_connections = false to your > environment.rb > > What #2 does is tells AR to make one connection and always use that. > > I may just add an option to mongrel_rails that sets this for you since > people keep asking about it. There's a thread on rails-core about this now, and in the ticket referenced below. That config is now called "allow_concurrency" (set to false), and is supposed to be set in environment.rb. http://dev.rubyonrails.org/ticket/3979 _______________________________________________ Mongrel-users mailing list Mongrel-users at rubyforge.org http://rubyforge.org/mailman/listinfo/mongrel-users From schoenm at earthlink.net Wed Mar 1 19:52:25 2006 From: schoenm at earthlink.net (Michael Schoen) Date: Wed, 01 Mar 2006 16:52:25 -0800 Subject: [Mongrel] Threading & database connections. In-Reply-To: <2366790BFF3A2944A8ED995501FAA95001D6E144@rd-w2k3-svrexg.raindrop.uk.local> References: <2366790BFF3A2944A8ED995501FAA95001D6E144@rd-w2k3-svrexg.raindrop.uk.local> Message-ID: <440641C9.2060003@earthlink.net> Jeff Jones wrote: > Thank you for all the help. I actually read that thread a few days ago > but the significance of it didn't dawn on me. I will try the > allow_concurrency change and see if there is an obvious performance > difference. Edge has now been patched to solve this, and allow_currency false is now the default. From zedshaw at zedshaw.com Thu Mar 2 02:40:36 2006 From: zedshaw at zedshaw.com (Zed Shaw) Date: Thu, 02 Mar 2006 02:40:36 -0500 Subject: [Mongrel] Ready to do 0.3.7 release. Message-ID: Hey Folks, I've got all the goods ready to go, but this time before I release I'd like people who are tracking svn to check out and try their apps. I'm specifically looking for: 1) Make sure the commands all work for you. 2) Tell me if your apps still are served correctly. 3) If you see a big performance drop. I'm finding that the BSD based OS are just horrible. FreeBSD and OSX are about 1/3 as fast as a dinky little Linux system. Even Windows beats them, so I'm interested in other people's performance stories. 4) People with multiple processors on Win32 should try Luis' new CPU affinity stuff. Check the: mongrel_rails_service install -h For how to use that. 5) Any other little bugs you think need fixing. I'm hoping this release is very stable and worthy enough for people to start playing with in semi-production deployments. If nobody objects then I'll post tomorrow afternoon. Zed From zedshaw at zedshaw.com Fri Mar 3 02:26:57 2006 From: zedshaw at zedshaw.com (Zed Shaw) Date: Fri, 03 Mar 2006 02:26:57 -0500 Subject: [Mongrel] [ANN] Mongrel 0.3.7.1 -- 1000 Paper Cuts Release Message-ID: This release of Mongrel is coming at you with lots of very little but important features and fixes. The big highlights are: * Initial beginning of the plugin support that will let people write their own handlers and other things for Mongrel. * Timeout now works again but couldn?t find an alternative to the buggy Timeout class. * SwitchTower friendly signal handling for mongrel_rails. * Win32: New option that lets you set a mongrel service?s CPU affinity. * Win32: Indicates default environment used for the services. * Win32: Avoids touching signals when on windows. * A fix for CGI encoding redirects wrong when SERVER_PORT isn?t specified. * Supports Rails page caching so that you can get reasonable speed without running a regular web server. * Tested on: Linux, Win32, FreeBSD, NetBSD, OSX. There's a few small additional things mostly related to documentation that will be rolled up into the 0.3.8 release sometime soon. == What's Mongrel? Mongrel is a fast HTTP library and server for Ruby that is intended for hosting Ruby web applications of any kind using plain HTTP rather than FastCGI or SCGI. It is framework agnostic and already supports Ruby On Rails, Og+Nitro, and Camping frameworks. == Getting Mongrel You should read the News at http://mongrel.rubyforge.org/news.html for more complete information on getting this release and what it has. For the lazy ones you can just do: $ gem update And for the next to lazy ones you can do: $ gem install mongrel People on win32 you pick the one that says Win32. == Documentation There's a lot more documentation now with more to come. There's specifically a document on setting up lighttpd+Mongrel using mod_proxy and CML power-magnet thanks to Bradley K. Taylor. * News -- http://mongrel.rubyforge.org/news.html * Getting Started -- http://mongrel.rubyforge.org/docs/started.html * FAQ -- http://mongrel.rubyforge.org/faq.html * Win32 -- http://mongrel.rubyforge.org/docs/win32.html * lighttpd -- http://mongrel.rubyforge.org/docs/lighttpd.html The configuration described in that last document is sort of running at http://zedapp.railsmachine.net/ and I'll be updating the docs as I fine tune that installation. == Special Thanks Gotta thank Luis again for getting in that CPU affinity stuff for Win32 and keeping the win32 stuff working. Also thanks to Bradley Taylor at http://www.railsmachine.net/ for giving me a few little VPS servers to play with. Check their video out. It's pretty hot. Finally keep sending in the bug reports and testing things out for me. Enjoy! Zed A. Shaw http://www.zedshaw.com/ From zedshaw at zedshaw.com Sat Mar 4 16:35:20 2006 From: zedshaw at zedshaw.com (Zed Shaw) Date: Sat, 04 Mar 2006 16:35:20 -0500 Subject: [Mongrel] [ANN] Mongrel 0.3.8 -- Bug Fixes Message-ID: Just a quick note that I rolled out a 0.3.8 release which fixes a bunch of minor bugs. I'm not announcing this one to the other mailing lists since the changes were fairly minor. Zed From zedshaw at zedshaw.com Sun Mar 5 18:14:48 2006 From: zedshaw at zedshaw.com (Zed Shaw) Date: Sun, 05 Mar 2006 18:14:48 -0500 Subject: [Mongrel] Test out the upcoming plugins stuff for me Message-ID: Hi folks, I've been working on the plugins system this weekend and I think I've nailed it down. The system will basically be able to load gems that are configured right to be plugins. It'll do it fairly dynamically and shouldn't require any configuration from the end user other than to install the gem. Doing this though will involve a bit of surgery on the svn repo since I've moved the mongrel/plugins.rb file into it's own complete little gem and project. Before I do this I want to make sure everything works for people from an end user point of view. If you all could hit http://zedshaw.homelinux.org:3000/files and follow the instructions in "test_for_me.txt" file I'd appreciate it. If it all works for everyone then I'll do a similar setup for the win32 stuff and a couple of sample plugins. Thanks! Zed From luislavena at gmail.com Sun Mar 5 19:14:32 2006 From: luislavena at gmail.com (Luis Lavena) Date: Sun, 5 Mar 2006 21:14:32 -0300 Subject: [Mongrel] Test out the upcoming plugins stuff for me In-Reply-To: References: Message-ID: <71166b3b0603051614h1f99f819w4ae76bab8d6b6eba@mail.gmail.com> Hello Zed, Reporting: Tested it here (win32) without problems, guess mswin32 gem will follow soon ;-) With this plugin system in place, we have plans to create standalone plugins for handlers? If so, mongrel_rails_service could be changed to mongrel_service and load "/handlers" for rails, nitro, camping, etc. Thats the idea? I quite don't follow... Let me now. Luis On 3/5/06, Zed Shaw wrote: > Hi folks, > > I've been working on the plugins system this weekend and I think I've nailed > it down. The system will basically be able to load gems that are configured > right to be plugins. It'll do it fairly dynamically and shouldn't require > any configuration from the end user other than to install the gem. > > Doing this though will involve a bit of surgery on the svn repo since I've > moved the mongrel/plugins.rb file into it's own complete little gem and > project. Before I do this I want to make sure everything works for people > from an end user point of view. > > If you all could hit http://zedshaw.homelinux.org:3000/files and follow the > instructions in "test_for_me.txt" file I'd appreciate it. If it all works > for everyone then I'll do a similar setup for the win32 stuff and a couple > of sample plugins. > > Thanks! > > Zed > > _______________________________________________ > Mongrel-users mailing list > Mongrel-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/mongrel-users > From zedshaw at zedshaw.com Sun Mar 5 19:36:16 2006 From: zedshaw at zedshaw.com (Zed Shaw) Date: Sun, 05 Mar 2006 19:36:16 -0500 Subject: [Mongrel] Test out the upcoming plugins stuff for me In-Reply-To: <71166b3b0603051614h1f99f819w4ae76bab8d6b6eba@mail.gmail.com> Message-ID: On 3/5/06 7:14 PM, "Luis Lavena" wrote: > Hello Zed, > > Reporting: > > Tested it here (win32) without problems, guess mswin32 gem will follow soon > ;-) > Great, yeah I'll look at how to bring it in. Probably modify the mongrel_rails_svc, > With this plugin system in place, we have plans to create standalone > plugins for handlers? > Yes, right now it just works for commands since that's the only place we're using plugins. Eventually you'll be able to write a plugin gem that includes handlers and filters (when those are available) and then people can include them into their mongrel setup. > If so, mongrel_rails_service could be changed to mongrel_service and > load "/handlers" for rails, nitro, camping, etc. > That would be the eventual direction, but right now I'm just focusing on rails. I'm thinking this would be the process: 1) Imagine I have a StatisticsHandler that displays some basic statistics about a running mongrel rails setup. 2) I package this up as mongrel_statistics-0.1.gem and put it on rubyforge. 3) Now you want to use my mongrel_statistics so you do: gem install mongrel_statistics 4) This plugin now loads whenever you start mongrel. 5) You then just need to "configure" your mongrel rails setup so that this new plugin is connected to some URI. (this is the next part I'm writing). 6) You modify a config/mongrel.yml file and add this line: /mystats handlers: - /handlers/statistics 7) Now when you go to /mystats you'll get the StatisticsHandler. The example you're playing with now is a command that sits at /commands/status and so mongrel_rails knows how to load it. It's a similar process except the commands don't need to be put on any URI. Does that make sense? Zed From luislavena at gmail.com Sun Mar 5 21:31:37 2006 From: luislavena at gmail.com (Luis Lavena) Date: Sun, 5 Mar 2006 23:31:37 -0300 Subject: [Mongrel] Test out the upcoming plugins stuff for me In-Reply-To: References: <71166b3b0603051614h1f99f819w4ae76bab8d6b6eba@mail.gmail.com> Message-ID: <71166b3b0603051831h18941841w7beb9a73f82a5d4b@mail.gmail.com> Yeah, now it does ;-) Ok, so we need to adapt/transform the mongrel_rails_service/svc to use this approach? I'll investigate if you want me to. But will be out of town until wednesday. Later, Luis On 3/5/06, Zed Shaw wrote: > On 3/5/06 7:14 PM, "Luis Lavena" wrote: > > > Hello Zed, > > > > Reporting: > > > > Tested it here (win32) without problems, guess mswin32 gem will follow soon > > ;-) > > > Great, yeah I'll look at how to bring it in. Probably modify the > mongrel_rails_svc, > > > With this plugin system in place, we have plans to create standalone > > plugins for handlers? > > > Yes, right now it just works for commands since that's the only place we're > using plugins. Eventually you'll be able to write a plugin gem that > includes handlers and filters (when those are available) and then people can > include them into their mongrel setup. > > > If so, mongrel_rails_service could be changed to mongrel_service and > > load "/handlers" for rails, nitro, camping, etc. > > > > That would be the eventual direction, but right now I'm just focusing on > rails. I'm thinking this would be the process: > > 1) Imagine I have a StatisticsHandler that displays some basic statistics > about a running mongrel rails setup. > 2) I package this up as mongrel_statistics-0.1.gem and put it on rubyforge. > 3) Now you want to use my mongrel_statistics so you do: > > gem install mongrel_statistics > > 4) This plugin now loads whenever you start mongrel. > 5) You then just need to "configure" your mongrel rails setup so that this > new plugin is connected to some URI. (this is the next part I'm writing). > 6) You modify a config/mongrel.yml file and add this line: > > /mystats > handlers: > - /handlers/statistics > 7) Now when you go to /mystats you'll get the StatisticsHandler. > > The example you're playing with now is a command that sits at > /commands/status and so mongrel_rails knows how to load it. It's a similar > process except the commands don't need to be put on any URI. > > Does that make sense? > > Zed > > _______________________________________________ > Mongrel-users mailing list > Mongrel-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/mongrel-users > From zedshaw at zedshaw.com Mon Mar 6 01:00:42 2006 From: zedshaw at zedshaw.com (Zed Shaw) Date: Mon, 06 Mar 2006 01:00:42 -0500 Subject: [Mongrel] Test out the upcoming plugins stuff for me In-Reply-To: <71166b3b0603051831h18941841w7beb9a73f82a5d4b@mail.gmail.com> Message-ID: I'll do it. It'll be my chance to learn the code you wrote. Anyway, I broke it. :-) Zed On 3/5/06 9:31 PM, "Luis Lavena" wrote: > Yeah, now it does ;-) > > Ok, so we need to adapt/transform the mongrel_rails_service/svc to use > this approach? I'll investigate if you want me to. But will be out of > town until wednesday. > > Later, > > From zedshaw at zedshaw.com Mon Mar 6 01:35:35 2006 From: zedshaw at zedshaw.com (Zed Shaw) Date: Mon, 06 Mar 2006 01:35:35 -0500 Subject: [Mongrel] [ANN] Mongrel 0.3.9 -- GemPlugin Based Message-ID: Hello everyone, Mongrel now has plugins that are based entirely on RubyGems. This feature was so slick that I decided to bust it out into a separate project called GemPlugin (more on that later). What the new plugin system does is makes it so that people can distribute Mongrel plugins as just plain gems, and mongrel will load them on the fly if people install them. There's no configuration necessary to get this working, and you can already write your own mongrel_rails commands. == What's Mongrel Mongrel is a fast HTTP library and server for Ruby that is intended for hosting Ruby web applications of any kind using plain HTTP rather than FastCGI or SCGI. It is framework agnostic and already supports Ruby On Rails, Og+Nitro, and Camping frameworks. == Win32 Warning I'm holding back win32 people for a day while I test this stuff out more completely. It has some slightly specific things that I still need to tweak on win32 to get everything working quite right. Super cool people with build tools can give this a shot and let me know how it goes. Everyone else needs to wait, sorry. == Plugins In Action The plugin system is actually pretty easy for people to use. Let's say you do your update: $ gem update Which should update mongrel to 0.3.9 and also install a gem_plugin 0.1. People who haven't used Mongrel before should do this: $ gem install mongrel Which will again install gem_plugin as a dependency. To see how the demo works, just run mongrel_rails and see what commands are available. Now for the cool part. Find a Rails application and run it in daemon mode: $ cd myapp $ mongrel_rails start -d Ok, now lets install the new mongrel_status plugin and use it to get the PID: $ sudo gem install mongrel_status $ mongrel_rails status If everything worked it should spit out the PID of whatever is running. If you now do mongrel_rails you'll see that there's this new "status" command. Feel free to do this too: $ mongrel_rails status -h Big deal right? Ok, remove it and watch the status command go away: $ sudo gem uninstall mongrel_status $ mongrel_rails See, no more status command. == How It Works I'm still wrestling with the explanation of how GemPlugin works, but go ahead and read: http://mongrel.rubyforge.org/gem_plugin_rdoc/ To get an idea. It's weird but works fantastic. == Next Steps In the push to 0.4 I'll be implementing handlers and filters as plugins and setting up the "grand config system" so that you can attach them to URIs. This should be point at which people can literally write their own plugins and extensions to Mongrel without much extra effort. Enjoy! And please post the bugs. Zed A. Shaw http://www.zedshaw.com/ From rsaccon at gmail.com Tue Mar 14 19:25:56 2006 From: rsaccon at gmail.com (Roberto Saccon) Date: Tue, 14 Mar 2006 21:25:56 -0300 Subject: [Mongrel] when to use mongrail plugins ? Message-ID: Hi all I just went throught the docomentation of mogrel and I am wondering wht the plugins are good for. I understood how the work and I am comparing the situation to Lighttpd where mods are available for specific tasks. But in Lighttpd (or apache) those mods are running at native speed. But at mongrel, if the plugins are writte in ruby, couldn't that code just be a rails plugin ? One thing I would like to have is a sophisticated upload handler, which stops upload if a preconfigured max. filesize gets reached. Ist that a problem which could be solved with a mongrel plugin ? -- Roberto Saccon - http://rsaccon.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/mongrel-users/attachments/20060314/8f3a0eb5/attachment.htm From zedshaw at zedshaw.com Wed Mar 15 01:19:33 2006 From: zedshaw at zedshaw.com (Zed Shaw) Date: Wed, 15 Mar 2006 01:19:33 -0500 Subject: [Mongrel] when to use mongrail plugins ? In-Reply-To: Message-ID: Roberto, Yes, your example would be a good example of a plugin. I?m currently doing the 0.3.11 release which is the ?official? release that works and has the initial gem plugins stuff going. 0.3.12 will feature the ability to actually configure the handlers and filters based on plugins from a config file. In this way, you?ll write the plugin like you describe, then people will attach it to the right URI and they get your feature. I?ll also be stealing the query string and file upload handling code from Camping so that Mongrel can handle those as well. In general the purpose of plugins is for people to extend mongrel?s features without having to modify mongrel code or do much configuration. If you compare it with rails plugins there?s usually a fair amount of install and configuration done even after you?d setup a plugin. Add to this the way you have to discover plugins and you?ll find that gem plugins are much easier to use. As examples of what I want to use gem plugins for: * Add filters for file upload handling to arbitrary handlers. * Create output filters for gzip * Implement a memcache on-the-fly response filter that will give you dynamic caching inside mongrel (rather than rails). * Automated hyper estraier indexing of content similar to mod_estraier * Statistics gathering and reporting. * Management tools or configuration tools. This I?ve already implemented in the 0.3.11 release?s configtool. But I?m sure other people will come up with their own neat things. Zed On 3/14/06 7:25 PM, "Roberto Saccon" wrote: > Hi all > > I just went throught the docomentation of mogrel and I am wondering wht the > plugins are good for. I understood how the work and I am comparing the > situation to Lighttpd where mods are available for specific tasks. But in > Lighttpd (or apache) those mods are running at native speed. But at mongrel, > if the plugins are writte in ruby, couldn't that code just be a rails plugin ? > > One thing I would like to have is a sophisticated upload handler, which stops > upload if a preconfigured max. filesize gets reached. Ist that a problem which > could be solved with a mongrel plugin ? From zedshaw at zedshaw.com Wed Mar 15 03:43:21 2006 From: zedshaw at zedshaw.com (Zed Shaw) Date: Wed, 15 Mar 2006 03:43:21 -0500 Subject: [Mongrel] Mongrel Web Server 0.3.11 -- Edge Rails and Win32 Compliant Message-ID: Hello Folks, This is the big release of Mongrel that's been in the works for a while now (well, like a week). It is chock full of changes and features, but mostly it syncs up the Win32 side of things, and validates that Edge Rails works without problems. It also features a more extensive and useful example of the GemPlugins called mongrel_config. First the usual stuff for people without a clue. WHAT IS MONGREL? Mongrel is a small fast little web server project trying to bring the speed of FastCGI and the simplicity of WEBrick for deploying any Ruby web application. It already supports Ruby on Rails, Camping, and Nitro and could soon support IOWA. Since it is a regular old HTTP based server it can be clustered, manipulated, and deployed like any other web server you use. Check out the nifty website at: http://mongrel.rubyforge.org/ TOP 10 REASONS TO USE MONGREL 10) It's damn fast without being a pain to install. 9) It works on tons of platforms with active testing on Win32, FreeBSD, Linux, OSX, and NetBSD. 8) It is probably the very best deployment solution for people doing Win32 Rails development, especially since it actively supports windows services and has a reasonably nice management tool. 7) It's fast enough that you could probably run your small to medium size Ruby web applications using just Mongrel and be perfectly happy. 6) It actively supports Rails style page caching which could give your application a major performance boost without any extra deployment effort. 5) It uses an insanely correct HTTP parser which I've found blocks quite a few exploits. This parser is also what makes Mongrel so Fast. 4) It has a great plugin system that lets you package your extensions as gems and your users just "gem install and go". 3) It is LGPL so you thieves can make money (but I get Mongrel mods back!) 2) It supports and uses Camping. Camping is cool. And the best reason to use Mongrel is... 1) Isn't a cool name like Mongrel enough? INSTALLING You might need sudo, you *will* need Ruby 1.8.4, and you'll need a compiler (unless you're on win32). Simple enough. If you have mongrel already try "gem upgrade". If that causes problems then you might have to clear out gem_plugin, mongrel, mongrel_config, and mongrel_status. This is rare and typically only if people have been tracking my development. For newbies just do this: $ gem install mongrel $ gem install mongrel_config $ gem install mongrel_status (if you want this) That's it. NEW STUFF TO TRY IN 0.3.11 The 0.3.11 release features edge Rails support, some great functionality, big stability improvements, some good docs for folks to start using, and finally the beginning of a config tool implemented as a GemPlugin. Most importantly it completely supports Win32 again and the mongrel_config tool actually works *better* in Win32. = Documentation If you haven't seen it yet, check out http://mongrel.rubyforge.org/docs/lighttpd.html For a good set of docs for getting Mongrel up in a very fast production deployment running on one machine. Check out http://mongrel.rubyforge.org/docs/gem_plugin.html for docs on writing your very own mongrel_rails commands as gem plugins. The ability to write your own handlers, filters, and potentially whole applications as plugins coming soon. Adventurous people could try doing a rails plugin by adding "rails" as a dependency on their plugin gem. Especially check out the gpgen tool for getting a mongrel plugin up with minimal effort. == Edge Rails This release was tested with Edge Rails and several applications, but I'd be interested in more people living on the edge. == Config Tool If you're on Unix (OSX too) or Windows you now have a new thing to play with: mongrel_config. Once you install the mongrel_config gem you get a new command for mongrel_rails. You can try it two ways depending on your platform: UNIX: 1) cd myrailsapp 2) $ mongrel_rails configtool 3) Hit the web page it says and try starting and stopping your rails app. WIN32: 1) $ mongrel_rails configtool 2) Hit the web page and install new services, delete them, start them, stop them, check out the start/stop logs, and view all of the service's parameters. Yeah, win32 wins on this one. And yes, win32 configtool doesn't need to be in any rails directory, which means smart people will make a simple link that runs this in order to manage their rails apps services. == Camping Mongrel now supports Camping a lot better and uses it extensively in the mongrel_config plugin. Camping is _why's little micro-framework for doing web applications. It's perfect for little tools like the mongrel_config plugin. If you're interested in writing a little application and don't want a full Rails app then try looking at the code to mongrel_config to get an idea. It works great, the only thing is that there's tons of PFM in Camping that seems to break Rails like crazy. Camping == oil. Rails == water. Don't mix. == The Dreaded TCP Hack Sean Treadway gave me a bit of hack code which jacks the OS listen queue from the default (usually 5) to a whopping 1024. This makes Mongrel handle concurrency much better. Give it a try and let me know how it works for you. THE FUTURE I'll be writing the filters feature and finally the configuration file that will let you configure any handlers and filters from a .yaml file. This is needed so that people can write plugins to give you special filters, handlers, or whole applications (similar to configtool). After this I'll be talking with Luis to see if we can consolidate the mongrel_rails_service and mongrel_rails by using the plugin system to implement the commands. We'll also look at making the mongrel_config more advanced. Finally I'm talking with the IOWA folks to roll their web app into the Mongrel kennel. Fun stuff! Enjoy the release and feel free to shoot me your problems, praise, and any features requests. Zed A. Shaw http://www.zedshaw.com/ From spmikedev at yahoo.com Thu Mar 16 12:21:28 2006 From: spmikedev at yahoo.com (Mike M) Date: Thu, 16 Mar 2006 09:21:28 -0800 (PST) Subject: [Mongrel] Apache and virtual hosts Message-ID: <20060316172128.24415.qmail@web50205.mail.yahoo.com> Dear Mongrel users, I would like to use Mongrel to introduce RoR on an existing Apache/PHP server. The server serves several domains, set up as virtual hosts. The idea is to install a Rails application to be used in addition to the existing configuration. Example: www.domain1.com/index.php -> Via Apache www.domain1.com/appname/controller/action -> RoR application I am at a loss how to do this, so help is appreciated! Thanks, Mike PS: One of the servers on which I want to do this is running Apache 1.3, the other Apache 2.2. __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com From zedshaw at zedshaw.com Fri Mar 17 00:59:16 2006 From: zedshaw at zedshaw.com (Zed Shaw) Date: Fri, 17 Mar 2006 00:59:16 -0500 Subject: [Mongrel] Apache and virtual hosts In-Reply-To: <20060316172128.24415.qmail@web50205.mail.yahoo.com> Message-ID: Mike, Should be possible, the trick will be to configure your routes.rb so that all Rails actions are prefixed with /appname and then setup mod_proxy and (possibly) mod_rewrite to send back to Mongrel. This will help with some typical issues: http://wiki.rubyonrails.org/rails/pages/HowtoDeployMoreThanOneRailsAppOnOneM achine Then you'll basically just have to prefix your routes appropriately and get the mod_proxy config working right. Zed\ On 3/16/06 12:21 PM, "Mike M" wrote: > Dear Mongrel users, > > I would like to use Mongrel to introduce RoR on an existing Apache/PHP server. > The server serves > several domains, set up as virtual hosts. > The idea is to install a Rails application to be used in addition to the > existing configuration. > Example: > www.domain1.com/index.php -> Via Apache > www.domain1.com/appname/controller/action -> RoR application > > I am at a loss how to do this, so help is appreciated! > > Thanks, > Mike > > PS: One of the servers on which I want to do this is running Apache 1.3, the > other Apache 2.2. > > __________________________________________________ > Do You Yahoo!? > Tired of spam? Yahoo! Mail has the best spam protection around > http://mail.yahoo.com > _______________________________________________ > Mongrel-users mailing list > Mongrel-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/mongrel-users From zedshaw at zedshaw.com Wed Mar 22 02:14:45 2006 From: zedshaw at zedshaw.com (Zed Shaw) Date: Wed, 22 Mar 2006 02:14:45 -0500 Subject: [Mongrel] 0.3.12 Pre-Release Gems Available Message-ID: Hi Folks, I'd love for everyone to grab the 0.3.12 pre-release gems from http://mongrel.rubyforge.org/releases/ and tell me if their stuff breaks. You can get it with a simple: gem install mongrel --source=http://mongrel.rubyforge.org/releases/ This release features the following goodies: * The -n and -t options to mongrel_rails start have changed in meaning to be the maximum number of concurrent processors and a throttle timeout between requests. This fits with the new thread model mongrel is sporting that is faster and a bit easier to manage. It will quite possibly produce too many DB connections from AR though. * You can now make handlers that are gem plugins. * You can now use the Mongrel::Configurator to wire up a mongrel server really quickly (example below). * You can now add as many handlers as you want to any URI and they will be processed in order until one of them finalizes the response object. This means that you can do chained request processing, request filters, response filters, and lots of other goodies. * You can use the DSL (Domain Specific Language) to create any number of port listeners with any number of URIs that have chained handlers on them. Here's an example DSL loading script: require 'mongrel' class TestPlugin < GemPlugin::Plugin "/handlers" include Mongrel::HttpHandlerPlugin def process(request, response) STDERR.puts "My options are: #{options.inspect}" STDERR.puts "Request Was:" STDERR.puts request.params.to_yaml end end config = Mongrel::Configurator.new :host => "127.0.0.1" do load_plugins :includes => ["mongrel"], :excludes => ["rails"] daemonize :cwd => Dir.pwd, :log_file => "mongrel.log", :pid_file => "mongrel.pid " listener :port => 3000 do uri "/app", :handler => plugin("/handlers/testplugin", :test => "that") uri "/app", :handler => Mongrel::DirHandler.new(".") load_plugins :includes => ["mongrel", "rails"] end trap("INT") { stop } run end config.join This is doing a lot but it's very cool stuff. First creates a handler that will act as a filter and is also a gem plugin. Then it makes a mongrel configuration using the Configurator. Then it loads plugins (but not rails), daemonizes, sets up a listener on port 3000, and attaches the /handlers/testplugin (remember TestPlugin?) and finally DirHandler to the /app URI. Last thing is it tells it to run and then goes. Please try out the gems with your existing stuff and report breakage. Thanks. Zed From kevwil at gmail.com Thu Mar 23 01:10:08 2006 From: kevwil at gmail.com (Kevin Williams) Date: Wed, 22 Mar 2006 23:10:08 -0700 Subject: [Mongrel] can't run on Windows Message-ID: <683a886f0603222210i65c760d1t6f919f70bb353134@mail.gmail.com> I tried installing the gem, but it told me it required Ruby >= 1.8.3.I haven't upgraded my Ruby OneClickInstaller setup because the 1.8.4installer isn't final yet. It might be worthwhile to mention thatdependency on the web site. --Cheers, Kevin From zedshaw at zedshaw.com Mon Mar 27 03:03:32 2006 From: zedshaw at zedshaw.com (Zed Shaw) Date: Mon, 27 Mar 2006 03:03:32 -0500 Subject: [Mongrel] [ANN] Mongrel Web Server 0.3.12 -- Pre-Release Message-ID: Hello Everyone, Mongrel is due for a 0.3.12 release which will feature some pretty insane goodies for everyone. There's talk of IOWA support, lots of speed improvements (including sendfile support), a great Configurator which makes configuring Mongrel a snap (especially for framework implementers), and a ton of debugging stuff. WARNING This is a pre-release announcement for the Mongrel Web Server 0.3.12. That's ****PRE-release*** not release, not gold, not stable, not will-keep-your-children-alive-in-a-snow-storm release. PRE. PRE means it will not work for you. PRE means you will test and tell me what's wrong because you like me and Mongrel. PRE means you will not run this release on your MoneyMakerWeb2OhMatic 6000 web site and then complain to me that you have lost billions in the baby trafficking market. DON'T CRY Now that everyone is sufficiently scared, the list of what's changed is given at: http://mongrel.rubyforge.org/news.html Go ahead and do this to try out the 0.3.12 release for me (pretty please): $ gem uninstall mongrel $ gem uninstall gem_plugin $ gem install mongrel --source=http://mongrel.rubyforge.org/releases/ And if you want to play with the deadly edge you can also do: $ gem install sendfile This will give you a sendfile send for all of your static files. Even though everyone was raving about sendfile speed being like setting a cat on fire, it's actually only about 20% faster. Let me know what you find (and if it works). CHANGES * A more complete Configurator and RailsConfigurator. These make setting up Rails super easy but is mostly for framework implementers to use. Still, it's wicked neat API. * The mongrel_rails script is implemented using the new Configurator scheme and works much better. * You can pass a config file to mongrel_rails start and it will load that (command line options override) using the -C option. * Graceful restart works more reliably (not in Win32 since it uses services). * Reload works better and doesn't break the restart. * More logging of the start-up process. * There is a wicked nice debugging framework that logs object counts, open files, and request params between each request. Try mongrel_rails start -B and look in log/mongrel_debug. * The Rails specific components are now in Mongrel::Rails modules. * More examples using the Mongrel::Configurator. * Dramatic speed improvements on FreeBSD, especially if you install the ruby18-nopthreads version. * Slight speed improvements on Mac OSX. OSX is like shoving a slug through a cheese grater. What's wrong with Apple? * Platforms that can install ruby-sendfile will get an estimated 20% speed boost in static file serving. This is currently FreeBSD, Linux, and Solaris. * Lots of little bug fixes and minor speed tweaks. Try out the release and let me know if I missed anything. It should work with Rails 1.1RC1 but I haven't tested extensively. SPONSORSHIP Mongrel now has sponsorship from Eastmedia (http://www.eastmedia.com) in partnership with Verisign (http://www.verisign.com/) to make Mongrel fast and stable enough for enterprise class loads (meaning "gigantic", not "Java style"). Their sponsorship has made it possible to get large pools of test servers, payment to work on Mongrel, and a real application to use Mongrel on. Everyone should toss out a thanks to them since this may mean I'll get to work on Mongrel full time in the near future and it will raise the quality of Ruby application hosting in general. Not to mention the fact that they are letting all of my Mongrel work stay LGPL licensed and open source. Other companies benefiting from Ruby should take this as an example. I can think of quite a few things (Ruby 1.9 and a real virtual machine are just two) that need some serious commercial cash to get them in gear. If you're making money off Ruby consider hiring a developer part-time, full-time, or posting a bounty for something you and the community needs. There's no better time for enlightened self-interest than now. Zed A. Shaw http://www.zedshaw.com/ From zedshaw at zedshaw.com Mon Mar 27 22:47:20 2006 From: zedshaw at zedshaw.com (Zed Shaw) Date: Mon, 27 Mar 2006 22:47:20 -0500 Subject: [Mongrel] Mongrel Web Server 0.3.12 -- Updated, Getting Closer Message-ID: Everyone tracking the Mongrel 0.3.12 pre-release should dump their current install and re-install: $ gem uninstall mongrel $ gem uninstall gem_plugin $ gem install mongrel --source=http://mongrel.rubyforge.org/releases/ This release fixes a problem with specifying a directory to change to, and fixes the incredibly broken DirHandler code from last night. The big change people will probably notice with static file serving is that IE will seem like it's flying. This is because the DirHandler properly implements the HEAD and GET requests differently for files, and denies anything else. IE is notorious for spamming web servers with tons of HEAD requests so this makes it speed up a bit. I'll be tweaking the DirHandler a bit more to include caching directives for the files it serves. Enjoy and let me know what people encounter. Zed A. Shaw http://www.zedshaw.com/ http://mongrel.rubyforge.org/releases/ From technoweenie at gmail.com Tue Mar 28 01:19:01 2006 From: technoweenie at gmail.com (Rick Olson) Date: Tue, 28 Mar 2006 00:19:01 -0600 Subject: [Mongrel] [ANN] Mongrel Web Server 0.3.12 -- Pre-Release In-Reply-To: References: Message-ID: <48fe25b0603272219s66b9acd0i9d566208abd94277@mail.gmail.com> On 3/27/06, Zed Shaw wrote: > Hello Everyone, > > Mongrel is due for a 0.3.12 release which will feature some pretty insane > goodies for everyone. There's talk of IOWA support, lots of speed > improvements (including sendfile support), a great Configurator which makes > configuring Mongrel a snap (especially for framework implementers), and a > ton of debugging stuff. Great stuff all around. I reran the debugger stuff in production mode, and got very similar results in objects.log: COUNTS: 0,1524,24501 TOP 20: [[Array, 16720], [Hash, 1718], [Regexp, 1259], [Proc, 1179], [Class, 1138], [Float, 645], [YAML::Syck::Scalar, 578], [Module, 381] .... However, the object_tracking log showed this (highlights reel only) Number of objects created = 4450 1750 YAML::Syck::Scalar objects created. 546 ActionController::CodeGeneration::GenerationGenerator objects created. 195 ActionController::CodeGeneration::RecognitionGenerator objects created. 179 SQLite::ParsedStatement::Token objects created. 109 Hash objects created. 101 Gem::Version objects created. 98 StringIO objects created. 75 Regexp objects created. 73 XSD::QName objects created. 69 Benchmark::Tms objects created. 68 ActiveRecord::ConnectionAdapters::SQLiteColumn objects created. 56 SQLite::ParsedStatement objects created. 56 SQLite::ResultSet objects created. 56 SQLite::Statement objects created. 51 Gem::Specification objects created. So that's good, my app isn't abusing 1300 regexes per request at least :) I did notice I was getting this in my mongrel log on each request: Error accessing file: Broken pipe /opt/local/lib/ruby/gems/1.8/gems/mongrel-0.3.12/lib/mongrel/handlers.rb:182:in `write' /opt/local/lib/ruby/gems/1.8/gems/mongrel-0.3.12/lib/mongrel/handlers.rb:182:in `send_file' /opt/local/lib/ruby/gems/1.8/gems/mongrel-0.3.12/lib/mongrel/handlers.rb:182:in `send_file' /opt/local/lib/ruby/gems/1.8/gems/mongrel-0.3.12/lib/mongrel/handlers.rb:201:in `process' /opt/local/lib/ruby/gems/1.8/gems/mongrel-0.3.12/lib/mongrel/rails.rb:54:in `process' /opt/local/lib/ruby/gems/1.8/gems/mongrel-0.3.12/lib/mongrel.rb:402:in `process_client' /opt/local/lib/ruby/gems/1.8/gems/mongrel-0.3.12/lib/mongrel.rb:401:in `process_client' /opt/local/lib/ruby/gems/1.8/gems/mongrel-0.3.12/lib/mongrel.rb:466:in `run' /opt/local/lib/ruby/gems/1.8/gems/mongrel-0.3.12/lib/mongrel.rb:465:in `run' /opt/local/lib/ruby/gems/1.8/gems/mongrel-0.3.12/lib/mongrel.rb:455:in `run' /opt/local/lib/ruby/gems/1.8/gems/mongrel-0.3.12/lib/mongrel.rb:735:in `run' /opt/local/lib/ruby/gems/1.8/gems/mongrel-0.3.12/lib/mongrel.rb:733:in `run' /opt/local/lib/ruby/gems/1.8/gems/mongrel-0.3.12/bin/mongrel_rails:90:in `run' /opt/local/lib/ruby/gems/1.8/gems/mongrel-0.3.12/lib/mongrel/command.rb:163:in `run' /opt/local/lib/ruby/gems/1.8/gems/mongrel-0.3.12/bin/mongrel_rails:187 /opt/local/bin/mongrel_rails:18 Everything still ran though. -- Rick Olson http://techno-weenie.net From zedshaw at zedshaw.com Tue Mar 28 10:01:06 2006 From: zedshaw at zedshaw.com (Zed Shaw) Date: Tue, 28 Mar 2006 10:01:06 -0500 Subject: [Mongrel] [ANN] Mongrel Web Server 0.3.12 -- Pre-Release In-Reply-To: <48fe25b0603272219s66b9acd0i9d566208abd94277@mail.gmail.com> Message-ID: Hey Rick, can you make sure you've got the very latest by uninstalling and then re-installing? I just added a few more exceptions that should get stuffed if the client closes the socket. Also, what browser and OS are you on? I'm guessing OSX right? Zed On 3/28/06 1:19 AM, "Rick Olson" wrote: > On 3/27/06, Zed Shaw wrote: >> Hello Everyone, >> >> Mongrel is due for a 0.3.12 release which will feature some pretty insane >> goodies for everyone. There's talk of IOWA support, lots of speed >> improvements (including sendfile support), a great Configurator which makes >> configuring Mongrel a snap (especially for framework implementers), and a >> ton of debugging stuff. > ... > I did notice I was getting this in my mongrel log on each request: > > Error accessing file: Broken pipe > /opt/local/lib/ruby/gems/1.8/gems/mongrel-0.3.12/lib/mongrel/handlers.rb:182:i> n > `write' > /opt/local/lib/ruby/gems/1.8/gems/mongrel-0.3.12/lib/mongrel/handlers.rb:182:i> n > `send_file' > /opt/local/lib/ruby/gems/1.8/gems/mongrel-0.3.12/lib/mongrel/handlers.rb:182:i> n > `send_file' > /opt/local/lib/ruby/gems/1.8/gems/mongrel-0.3.12/lib/mongrel/handlers.rb:201:i> n > `process' > /opt/local/lib/ruby/gems/1.8/gems/mongrel-0.3.12/lib/mongrel/rails.rb:54:in > `process' > /opt/local/lib/ruby/gems/1.8/gems/mongrel-0.3.12/lib/mongrel.rb:402:in > `process_client' > /opt/local/lib/ruby/gems/1.8/gems/mongrel-0.3.12/lib/mongrel.rb:401:in > `process_client' > /opt/local/lib/ruby/gems/1.8/gems/mongrel-0.3.12/lib/mongrel.rb:466:in `run' > /opt/local/lib/ruby/gems/1.8/gems/mongrel-0.3.12/lib/mongrel.rb:465:in `run' > /opt/local/lib/ruby/gems/1.8/gems/mongrel-0.3.12/lib/mongrel.rb:455:in `run' > /opt/local/lib/ruby/gems/1.8/gems/mongrel-0.3.12/lib/mongrel.rb:735:in `run' > /opt/local/lib/ruby/gems/1.8/gems/mongrel-0.3.12/lib/mongrel.rb:733:in `run' > /opt/local/lib/ruby/gems/1.8/gems/mongrel-0.3.12/bin/mongrel_rails:90:in `run' > /opt/local/lib/ruby/gems/1.8/gems/mongrel-0.3.12/lib/mongrel/command.rb:163:in > `run' > /opt/local/lib/ruby/gems/1.8/gems/mongrel-0.3.12/bin/mongrel_rails:187 > /opt/local/bin/mongrel_rails:18 > > Everything still ran though. From jegt at titanian.se Tue Mar 28 10:30:32 2006 From: jegt at titanian.se (Jonas Tehler) Date: Tue, 28 Mar 2006 17:30:32 +0200 Subject: [Mongrel] Rails and Mongrel Message-ID: <87D7B335-34DB-4DA4-A401-4B4359034275@titanian.se> Hi I have some questions regarding threads in Mongrel and Rails. According to the FAQ: "Ruby on Rails is not thread safe so there is a synchronized block around the calls to Dispatcher.dispatch. This means that everything is threaded right before and right after Rails runs. While Rails is running there is only one controller in operation at a time." Isn't this going to be a MAJOR bottleneck for most Rails apps? Or am I missing something? As I understand it a request comes is and gets routed to a controller which talks to the database (which takes up most of the time of the request) and no other request will be processed by rails until the database query is done and the result rendered and sent back to Mongrel? If this is the case, is there any work being done on making Rails threadsafe? I have tried to look for any info on this but haven't found any. / Jonas From zedshaw at zedshaw.com Tue Mar 28 11:06:33 2006 From: zedshaw at zedshaw.com (Zed Shaw) Date: Tue, 28 Mar 2006 11:06:33 -0500 Subject: [Mongrel] Rails and Mongrel In-Reply-To: <87D7B335-34DB-4DA4-A401-4B4359034275@titanian.se> Message-ID: Hi Jonas, Yes, this is a MAJOR bottleneck, but it isn't entirely all Rails' fault. A lot of it has to do with how the Ruby interpreter does not thread protect it's own dynamic class loading or quite a bit of the eval stuff that Rails uses. The other part is that Rails was developed mostly assuming that it's running like a CGI, so threads just weren't an issue there. This bites people in a couple of ways such as opening files and not closing them, spawning external programs and not waiting for them, opening sockets and not closing them, etc. It also makes Rails slower than it needs to be since there has to be this giant sync lock around the world. I have had a proposal or two to investigate various forking methods to improve things, but most of my experiments haven't been too useful. The best options seems to just create a bunch of Rails processors and then have a fronting web server or load balancer farm out the requests. Thankfully Mongrel makes this pretty easy to do and it's a standard best practice with any of the dynamic languages out there. Hope that helps explain the situation. Zed On 3/28/06 10:30 AM, "Jonas Tehler" wrote: > > Hi > > I have some questions regarding threads in Mongrel and Rails. > > According to the FAQ: > > "Ruby on Rails is not thread safe so there is a synchronized block > around the calls to Dispatcher.dispatch. This means that everything > is threaded right before and right after Rails runs. While Rails is > running there is only one controller in operation at a time." > > Isn't this going to be a MAJOR bottleneck for most Rails apps? Or > am I missing something? > > As I understand it a request comes is and gets routed to a controller > which talks to the database (which takes up most of the time of the > request) and no other request will be processed by rails until the > database query is done and the result rendered and sent back to Mongrel? > > If this is the case, is there any work being done on making Rails > threadsafe? I have tried to look for any info on this but haven't > found any. > > / Jonas > _______________________________________________ > Mongrel-users mailing list > Mongrel-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/mongrel-users From jegt at titanian.se Tue Mar 28 11:17:24 2006 From: jegt at titanian.se (Jonas Tehler) Date: Tue, 28 Mar 2006 18:17:24 +0200 Subject: [Mongrel] Rails and Mongrel In-Reply-To: References: Message-ID: <276DC764-4B3F-4086-B5EE-78A709004141@titanian.se> Hi OK. So the talk about making YARV threadsafe will make the situation better? / Jonas On 28 mar 2006, at 18.06, Zed Shaw wrote: > Hi Jonas, > > Yes, this is a MAJOR bottleneck, but it isn't entirely all Rails' > fault. A > lot of it has to do with how the Ruby interpreter does not thread > protect > it's own dynamic class loading or quite a bit of the eval stuff > that Rails > uses. The other part is that Rails was developed mostly assuming > that it's > running like a CGI, so threads just weren't an issue there. > > This bites people in a couple of ways such as opening files and not > closing > them, spawning external programs and not waiting for them, opening > sockets > and not closing them, etc. It also makes Rails slower than it > needs to be > since there has to be this giant sync lock around the world. > > I have had a proposal or two to investigate various forking methods to > improve things, but most of my experiments haven't been too > useful. The > best options seems to just create a bunch of Rails processors and > then have > a fronting web server or load balancer farm out the requests. > Thankfully > Mongrel makes this pretty easy to do and it's a standard best > practice with > any of the dynamic languages out there. > > Hope that helps explain the situation. > > Zed > > > On 3/28/06 10:30 AM, "Jonas Tehler" wrote: > >> >> Hi >> >> I have some questions regarding threads in Mongrel and Rails. >> >> According to the FAQ: >> >> "Ruby on Rails is not thread safe so there is a synchronized block >> around the calls to Dispatcher.dispatch. This means that everything >> is threaded right before and right after Rails runs. While Rails is >> running there is only one controller in operation at a time." >> >> Isn't this going to be a MAJOR bottleneck for most Rails apps? Or >> am I missing something? >> >> As I understand it a request comes is and gets routed to a controller >> which talks to the database (which takes up most of the time of the >> request) and no other request will be processed by rails until the >> database query is done and the result rendered and sent back to >> Mongrel? >> >> If this is the case, is there any work being done on making Rails >> threadsafe? I have tried to look for any info on this but haven't >> found any. >> >> / Jonas >> _______________________________________________ >> 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 > From spmikedev at yahoo.com Wed Mar 29 10:35:27 2006 From: spmikedev at yahoo.com (Mike M) Date: Wed, 29 Mar 2006 07:35:27 -0800 (PST) Subject: [Mongrel] Installing Ruby Message-ID: <20060329153527.14527.qmail@web50204.mail.yahoo.com> I just attempted to install Mongrel on Windows. I'm not going to run it as a service, so I thought I'd select the ruby flavor (option 1). See error message below. Q: Is the ruby flavor not supported on Windows? If so, it would be useful to update the website with this info. Thanks, Mike. K:\rails\apps\helloworld>gem install mongrel Attempting local installation of 'mongrel' Local gem file not found: mongrel*.gem Attempting remote installation of 'mongrel' Updating Gem source index for: http://gems.rubyforge.org Select which gem to install for your platform (i386-mswin32) 1. mongrel 0.3.11 (ruby) 2. mongrel 0.3.11 (mswin32) 3. mongrel 0.3.10.1 (ruby) 4. mongrel 0.3.10 (ruby) 5. mongrel 0.3.9 (ruby) 6. mongrel 0.3.8 (mswin32) 7. mongrel 0.3.8 (ruby) 8. mongrel 0.3.7.1 (mswin32) 9. mongrel 0.3.7.1 (ruby) 10. mongrel 0.3.7 (ruby) 11. mongrel 0.3.6 (mswin32) 12. mongrel 0.3.6 (ruby) 13. mongrel 0.3.5 (ruby) 14. mongrel 0.3.5 (mswin32) 15. mongrel 0.3.4 (mswin32) 16. mongrel 0.3.4 (ruby) 17. mongrel 0.3.3 (ruby) 18. mongrel 0.3.2 (ruby) 19. mongrel 0.3.1 (ruby) 20. mongrel 0.3 (ruby) 21. mongrel 0.2.2 (ruby) 22. mongrel 0.2.1 (ruby) 23. mongrel 0.2.0 (ruby) 24. Cancel installation > 1 Install required dependency daemons? [Yn] Install required dependency gem_plugin? [Yn] Building native extensions. This could take a while... ERROR: While executing gem ... (Errno::ENOENT) No such file or directory - nmake __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com From technoweenie at gmail.com Wed Mar 29 10:39:51 2006 From: technoweenie at gmail.com (Rick Olson) Date: Wed, 29 Mar 2006 09:39:51 -0600 Subject: [Mongrel] Installing Ruby In-Reply-To: <20060329153527.14527.qmail@web50204.mail.yahoo.com> References: <20060329153527.14527.qmail@web50204.mail.yahoo.com> Message-ID: <48fe25b0603290739n4b3d66b5jb1f3fe0a314b0a02@mail.gmail.com> > Q: Is the ruby flavor not supported on Windows? If so, it would be useful to update the website > with this info. No, it's not. That's why there is a windows version. -- Rick Olson http://techno-weenie.net From lists at kikobu.com Wed Mar 29 11:46:13 2006 From: lists at kikobu.com (Morten) Date: Wed, 29 Mar 2006 18:46:13 +0200 Subject: [Mongrel] Handlers Message-ID: <442AB9D5.4070909@kikobu.com> Anyone know where I can find some sample handlers? Has an API been released yet? Br, Morten From bryan.a.soto at gmail.com Wed Mar 29 12:15:59 2006 From: bryan.a.soto at gmail.com (Bryan Soto) Date: Wed, 29 Mar 2006 09:15:59 -0800 Subject: [Mongrel] Installing Ruby In-Reply-To: <20060329153527.14527.qmail@web50204.mail.yahoo.com> References: <20060329153527.14527.qmail@web50204.mail.yahoo.com> Message-ID: On 3/29/06, Mike M wrote: > I just attempted to install Mongrel on Windows. I'm not going to run it as a service, so I thought > I'd select the ruby flavor (option 1). See error message below. > > Q: Is the ruby flavor not supported on Windows? If so, it would be useful to update the website > with this info. With gems, the convention is that the ruby version is pure source code which in some cases means you need a C compiler to install. For Windows, where a compiler isn't available by default, a separate pre-compiled package is usually made available. Hence the split. Hope that helps, Bryan -- "Never tell people how to do things. Tell them what to do and they will surprise you with their ingenuity." ?General George S. Patton From zedshaw at zedshaw.com Wed Mar 29 23:52:54 2006 From: zedshaw at zedshaw.com (Zed Shaw) Date: Wed, 29 Mar 2006 23:52:54 -0500 Subject: [Mongrel] Handlers In-Reply-To: <442AB9D5.4070909@kikobu.com> Message-ID: Hi Morten, yeah the API has been around for a while. Check out the Mongrel::Congigurator for an easy way to configure them if you're doing your own setup. If you want to add to Rails then you will possibly have to wait until I get the handler config stuff working (0.3.13). In theory you'll do it this way: 1) Create a GemPlugin based handler and setup the init.rb for it to configure the handler as you need. 2) Use the Mongrel::Configurator.uri and plugin functions to set it up. I'll post more on this in the very near future (since I need it). Zed On 3/29/06 11:46 AM, "Morten" wrote: > > Anyone know where I can find some sample handlers? Has an API been > released yet? > > Br, > > Morten > > > > > _______________________________________________ > Mongrel-users mailing list > Mongrel-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/mongrel-users From zedshaw at zedshaw.com Thu Mar 30 05:36:57 2006 From: zedshaw at zedshaw.com (Zed Shaw) Date: Thu, 30 Mar 2006 05:36:57 -0500 Subject: [Mongrel] Mongrel Web Server 0.3.12 -- Finally Out Message-ID: Hello Folks, This is the long awaited (like 2 weeks) 0.3.12 release of Mongrel. This release has received heavier testing than previous releases and supports a whole raft of improvements to existing functionality plus some new stuff. For those not clued in, Mongrel is a web server written in (mostly) Ruby. Check the funny dogs and read the docs about it at http://mongrel.rubyforge.org/. The goal is to create a Ruby HTTP server to compete with Apache Tomcat or other Java application servers. The other goal is to have the speed of FastCGI with the ease of WEBrick. WHAT'S NEW The big points of this release are: * The Mongrel::Configurator and Mongrel::Rails::Configurator for simple configuration (mostly for framework implementers to use). * Dynamically loadable handlers from the GemPlugins system. Next release will let you write and add your own handlers. * Chained handlers. That's right, you can stack a series of handlers on any URIs and they'll be processed in order. This gives you an advanced and fast pipe-lined processing system and is already used to implement the extensive debugging support Mongrel has. * Debugging, Debugging, Debugging. Try the -B option and then look in the log/mongrel_debug logs. I'll be beefing this up to insane usefulness for the 0.3.13 release. * Support for sendfile on FreeBSD, Linux, and Solaris if you install the ruby-sendfile (http://rubyforge.org/projects/ruby-sendfile) gem. This is experimental but already gives a 20% boost on static files. * Additional proper headers for static files from the DirHandler in order to allow browsers to cache the content. People using Mongrel for development or small sites will love this combined with the sendfile support. * Lots and lots of little tweaks to improve speed and stability. Mongrel is starting to hit a wall again with performance so I'll be looking for new hot-spots to move to C in the near future. * Initial support for Rails 1.1. Remember *if you use Typo it is broken not Mongrel*. Typo is being frantically fixed so be patient. * Fix for a bad typo on Win32 that prevented people from using additional mime types files (stupid Emacs and it's damn capitalize command being exactly the same as Copy in every other editor). * Ability to specify a timeout throttling setting and a max number of concurrent connections with additional attempts at cleaning dead threads out. Future debugging will help people spot these. * Lots of new Camping support and integration (thanks to Trotter Cashion for using Mongrel with Camping like crazy). * A handy -C option for the mongrel_rails script that lets you specify the options you'd normally do on the command line as a YAML hash. More on this later. INSTALL Everyone can go download 0.3.12 from http://rubyforge.org/frs/?group_id=1306 like normal or do the usual "gem install mongrel" or "gem update" to get the latest and greatest. -- If you followed pre-release please uninstall first. NEXT STOP... The next steps with Mongrel will be to add the capability for users of Mongrel to write their own Configurator scripts and to test the living daylights out of it. If you missed my last announcement, Mongrel is getting *commercial sponsorship* from EastMedia (http://www.eastmedia.com/) in partnership with VeriSign (http://www.verisign.com/) for use in a potentially large scale project. My role in this is to make sure Mongrel can handle the required role and will not ever crash. I'll be spending the next few weeks putting out less features and doing more stability and speed tweaks. Stay tuned. Should be fun. Enjoy and report those bugs! Zed A. Shaw http://mongrel.rubyforge.org/ From amiroff at gmail.com Thu Mar 30 14:04:22 2006 From: amiroff at gmail.com (Metin Amiroff) Date: Thu, 30 Mar 2006 22:04:22 +0300 Subject: [Mongrel] Mongrel and capistrano Message-ID: <9328906b0603301104t43958e8eyf316608be8ee7f63@mail.gmail.com> Hello list, I discovered mongrel just a few days ago and it already won me overlighttpd for deployment of my future project, so my honestcongratulations to author. My question though is, how one could use capistrano with mongrel (orvice versa) to automate deployments. Since mongrel is plain HTTP anddoes not use fastcgi, will it need to be restarted after each checkouton deployment server like lighttpd? There is really so few documentson deploying Rails, especially with mongrel, I would really appreciateany help here. My second concirn is logging. Current apache + php setup allows me touse awstats to generate a plethora of statistics about visits. Sincewe decide to use mongrel instead of Apache what would the situation bein this case? How can I get some kind of statistics? Should I use abackup server or maybe mongrel is going to provide some apachecompatible log files in future? Best regards, Metin--Pace Peace Paix Paz Frieden Pax Pok?j Fri?ur Fred B?keHasiti Lap? Hetep Malu M?? Wolakota Santiphap Irini PeochShanti Vrede Bar?? R?j M?r Taika Rongo S?lh Py'guapy