February 13, 2006
Tips for optimizing your Rails app
Over on the TextDrive weblog, Julik shares some tips for keeping your server resource usage to a minimum when deploying a Rails app.
Rails is nuclear stuff, it allows you to do wonders in minutes but you have to be careful with it. The amount of magic contained in Rails imposes quite an overhead“ that you, as a developer, are obliged to manage. These things not only make your application faster, scalable and tolerant, but also bearable for people living on the same web and application servers. Failures to do this in a shared heteregenous environment certifably leads to memory leaks and hard crashes. These tips are good standard procedures for a Rails application at any level (even if you are on a dedicated cluster setup).
Here are the tips Julik suggests, with explanations for each in the weblog post linked above:
- Minimize the amount of FCGI listeners
- Use caching
- NEVER run development on FastCGI for more than 1-2 hours
- Observe your memory consumption
- Rotate your logs
- Write and run unit tests
- Check for memory leaks when you are developing
- Be careful with iterations
- Watch the Rails TRAC for bug reports
- Be vigilant when restarting your server