Techblog

Tech Blog

Our latest geek adventures!

16 July Slow Rails in production mode due to Gems

Posted by jaap on in Ruby on Rails

Last week I decided to tune the performance of our Rails applications, because I had suspicions the app performed not at it’s best.
I installed a fresh Rails application and started the simple script/server -e production. I did the command: ab -c 5 -n 1000 http://localhost:3000/ and found out that we had only 396 requests per second. On my own, slower laptop, I had 500 requests per second for a test app of the same Rails version. Why o why?

Decided to take a look at the Gems. I saw that Gem installed a new version on top of an old version, when I updated. These old versions were still used in our production application, while these new versions were installed! You can specify your GEM version in the Rails app, but if you haven’t done this, Rails will apparently take the oldest version. After removing these old versions I benchmarked the server again, and now 560 request per second, ow yeah!

So an advice to all of you, figuring out why rails doesn’t perform at it’s best: update your gems AND remove the old versions. Now we updated our real applications and they are running lots faster.

Tags: , ,

Leave a Reply