You are here: Forums Ask a Rails expert Sensible number of mongrel ins...
Posted in Forums : Ask a Rails expert
Authority 0
Posting Rating 0
Sign in to rate this post
|
Hi All, Quick question. Being unfamiliar with the ins and outs (memory footprint, performance, etc.) of Nginx + Mongrel, I’m not sure how many mongrel instances to instantiate. My client has an application that perpetually uploads images for employees to comment on and categorize, etc. He has about 30-50 people logged on at any point in time and the photo uploader is going almost perpetually. He complains that he gets several “redirects” at a time after about 30 minutes and that he must wait for about 5 minutes or so after this happens, then have the uploader start again. He’s uploading about 200 photos per minute. Currently I have Nginx with 6 mongrel instances running. Is this way too few? How many should I add? The system is an Athlon 64 X2 3800+ with a gig of memory running BSD 6. Best, |
Authority 62
Posting Rating 100
Sign in to rate this post
|
I’ve never had an app with that many uploads in such a short period of time. But I may be able to give you a few hints. For starts: Rails is not really suited for longer tasks – long in this case means actions that take longer than a second or so to process. Each upload blocks one Mongrel until it’s done – so you can have at most 6 concurrent uploads with your application at the moment and users that only want to view your site (and not upload anything) don’t get served at all. I’ve seen and read a few approaches to deal with that: Regarding your server requirements question: In my experience, a fully busy Mongrel can eat up to 200 MB while it’s doing its job. So assuming that your OS already uses some 100 or 200 MB (I’m not really familiar with BSD), maybe 2 or 3 Mongrels already use swap instead of RAM. I guess the A64 is fine but you should probably give it some more RAM – 4 gig don’t really cost a lot of money nowadays. HTH (if it does, you could always recommend me ;-)) |
Authority 0
Posting Rating 0
Sign in to rate this post
|
Hrm, I thought I’d already recommended you. I always, at the very least, give a positive rating. I’ll see what I can do. ;) As for mod_rails (a.k.a. passenger), I’ve got it installed and I’ve got the following as my ‘passenger.conf’ file: <VirtualHost *:80> ServerName 127.0.0.1 #(I've also tried the public address as there is no domain just yet) DocumentRoot /home/git/apps/gittest/public ErrorLog /var/log/gittest_errors.log CustomLog /var/log/gittest_access.log combined </VirtualHost> ...however, I am now getting the following error: Cannot spawn application '/usr/home/git/apps/gittest': The spawn server has exited unexpectedly. I’m not really sure where to go from here. |
Authority 0
Posting Rating 0
Sign in to rate this post
|
Wow! I finally got it. I had a bad reference to ruby. Sheesh! Now passenger is up and running. It seems a bit slower to respond than did “nginx + mongrel”...Is this to be expected? It does, however, have a MUCH smaller memory footprint. Thanks! |
Authority 0
Posting Rating 0
Sign in to rate this post
|
Hrm…one problem I’m still having is the fact that Passenger isn’t picking up my CSS. Is this a permissions issue or what? |
Authority 0
Posting Rating 0
Sign in to rate this post
|
And, once again I find the answer buried. ;) I had to add the following:
<Directory "/home/git/apps/gittest/public">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
|
Authority 62
Posting Rating 100
Sign in to rate this post
|
Yeah this stuff with stylesheets was a bitch to find out for me, too. ;) I also had the feeling that it responds a little slower when servicing only one or two requests but as soon as real traffic hits your site it should kick Mongrel in the behind quite good! ;) There’s lots of blog posts out there that confirm that the performance is really great. I’m still running Mongrel in production for now but I think I’ll switch in 2 or 3 months – just have to check with the server admin first. ;) |
Authority 0
Posting Rating 0
Sign in to rate this post
|
Ok, so I’ve got everything functioning. Now I need to speed things up severely. The server can handle about 5 to 10 people on, but after that, requests just drag. It’s really as if rails just loses all sense of what it’s supposed to be doing. I don’t think it’s necessarily happening on the request side so much as the DB side (as unlikely as that may sound). The installation for ruby-prof isn’t very straightforward. I’m told to install it via gems then “copy the ruby package”—but it doesn’t seem to specify what package and from where. Basically the application is set up to allow the employees to make notes on and categorize Photos as they are uploaded. If there are no photos to be uploaded it sends them to a simple javascript waiting page that refreshes every 10 seconds. Once more photos are up, the process starts again. Once there are more than about 10 people working (and photos present), the application loses its mind. It will do things like place them in a perpetual redirect loop despite the fact that there are clearly Photos available. Sometimes if they log out then log back in they can get back into the real loop, but there’s no guarantee. If you guys have any suggestions – debug, speed, or otherwise – I’m all ears. I did change the log info to ‘debug’ despite it being in production, but I don’t see anything out of the ordinary. I’m guessing I really need to figure out ruby-prof? Best, |
Ask a Rails expert : calling functions from model to controller
Ask a Rails expert : calling functions from model to controller
Ask a Rails expert : rspec examples?
Ask a Rails expert : Radio buttons with Observe field
Ask a Rails expert : copy to clipboard
Ask a Rails expert : API call problem
Ask a Rails expert : Invoke a plugin from a plugin?
Ask a Rails expert : Restful problem