Oct 29, 2007

Rails 2.0 Performance part 1

Recently, being myself, I couldn't resist the urge to try out preview release of Rails 2.0. So be prepared for series of posts about what's new and hot. First thing I've decided to test was performance. I've created an extremely simple rails app - just fetch a row from a database and render its contents - and ran benchmark against single mongrel instance with rails 1.2.5 and 2.0-pr. Results are pretty impressive! Check it out:

Rails 1.2.5:

Concurrency Level: 1
Time taken for tests: 44.663975 seconds
Complete requests: 2000
Failed requests: 0
Write errors: 0
Total transferred: 644000 bytes
HTML transferred: 104000 bytes
Requests per second: 44.78 [#/sec] (mean)
Time per request: 22.332 [ms] (mean)
Time per request: 22.332 [ms] (mean, across all concurrent requests)
Transfer rate: 14.06 [Kbytes/sec] received


Rails 2.0-pr:

Concurrency Level: 1
Time taken for tests: 16.249851 seconds
Complete requests: 2000
Failed requests: 0
Write errors: 0
Total transferred: 1158000 bytes
HTML transferred: 230000 bytes
Requests per second: 123.08 [#/sec] (mean)
Time per request: 8.125 [ms] (mean)
Time per request: 8.125 [ms] (mean, across all concurrent requests)
Transfer rate: 69.54 [Kbytes/sec] received


Pretty impressive, isn't it? Now before you go all crazy about how damn fast Rails 2.0 is keep in mind that:
  • This was a quick test, unverified, vulnerable to many environment variables
  • It was a very simple app, real-life apps are very different in nature and can get very little speed up compared to this test
I just wanted to say that surely a lot of effort was put on performance. I haven't had much time for real tests, but I'll try to find some time within next couple of days to do it the right way and share the results with you.

1 comments:

Stoyan Damov said...

It doesn't really matter whether the performance increase is two- or three-fold. What matters is that Rails performance is being considered and worked on.

I have this warm feeling that the time I've invested in Ruby and Rails learning will pay off in the end of the day :)