Question

I run an Ubuntu 8.04 shared host (VMWare) with Apache + Passenger (= Mod Rails), MySQL and Acts_As_Ferret (in server mode). It's too slow at the first requests. I do a lot of REST operations on it and have very few users.

Now I want to do a fresh installation...

Which setup (based on Ubuntu) do you recommend for a really snappy RoR server? (e.g. Ngnix, Thin, Mongrels or other fancy stuff)

Was it helpful?

Solution

Check the ec2onrails mailing list, where there has been a lot of discussion of the various thin/nginx/passenger/apache alternatives and permutations, plus some hard data posted based on some decent tests.

You'll also find a nice packaged RoR/Ubuntu stack in the shape of the ec2onrails image (google ec2onrails) - it's for running on the amazon EC2 cloud but it's got a lot of nice stuff in there + capistrano tasks. Currently it's based on apache, but the version in progress is looking at the alternatives. No reason you couldn't use the same build script for a non EC2 server.

If your problem is simply the initial requests, try warming your server up before considering it live (e.g. by running a script to automatically exercise the basic operations).

Oh and I should add - are you sure the problem is your stack? More likely it is your code. It may be worth seeing where your bottlenecks are first and what you can get out of caching, improved queries and indexing, and especially memcached before tweaking anything else.

OTHER TIPS

Passenger is slow at first requests because it is idling and it shuts down all the rails processes so the first request has to load a rails process. You need to either ping regularly to avoid it idling and closing rails processes or set the idle timeout to a high value.

Look in the documentation for RailsPoolIdleTime

Well you could get a big speed boost by switching to Ubuntu 9.04 or even 8.10

I personally use nginx+passenger on my ubuntu stack. and use sphinx instead of ferret as well

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top