LiteSpeed Ruby on Rails Optimizations
Posted by Sam
LiteSpeed and Ruby on Rails are a dream come true. If you are deploying Rails apps on anything else in a production environment you are nuts. Not only is LiteSpeed/Rails one of the fastest (if not THE fastest) combinations for serving up Rails, it's also by far the simplest. LiteSpeed is also many times faster than Apache at serving regular files. Benchmark it for yourself and you'll see that it is indeed many times faster. So like I said, you are nuts if you are using anything else for your Rails applications.
One of the things that I do find annoying though is that by default LiteSpeed shuts down Rails applications after one minute of inactivity. Which means that if somebody hits your site every two minutes they have to wait for LiteSpeed to reload your application every time they hit a dynamic page. Which, even on a fast machine, might take a second or more. To change this in LiteSpeed 3.2.2 go to the Ruby Rails tab and change LSAPI_MAX_IDLE to the same value as "Max Idle Time". I set mine to 3600 seconds (one hour).
LSAPI_MAX_IDLE=3600
After one hour if nobody hits your Rails site then it will unload and free up memory. Of course all of my sites are monitored with Nagios every five minutes so there is always at least one Rails instance running. Check out LiteSpeed's Ruby LSAPI page for more information on tuning Rails on LiteSpeed.
Tags: litespeed rubyonrails
Comments
Be the first to leave a comment.