Saturday, August 23, 2008

Performance and Jruby

About a year ago I joined a new team at Sun. They were a handful of developers using jruby on rails to create a web application. My roll in this team was to help with database availability and performance. In my previous positions at Sun I had published several spec benchmarks, so I was familiar with that type of work.

By the time I joined the team little attention had been payed at the application's performance, but the assumption was that the database would be the biggest bottleneck. After all, that is usually the case, isn't it? Well, a year later I can say that we were all wrong.

In the first couple of days I started getting familiar with the application and using jmeter. I created a simple experiment that simulated 1 user hitting the home page several times. To my surprise, the average response time I got was more than 15 seconds and none of it was spent in the database; It was all in the app and web tiers! Lots of things have changed since then. We have found problems in many places and made big changes to keep performance in check.

In this series of blogs I'll go in detail about some of the problems we encountered and how they got fixed. Many of these topics will be touched in my presentation at this years rails conference, but most probably in less detail.

I hope these blogs help you tune your application and I hope they spare you some time.

Happy tuning!

2 comments:

Unknown said...

Hi Fernando!

I'm really interested in the performance area, I would like to know more details about what you discovered...

I have a question regarding Dtrace. Doing performance tests in three tier architectures, I often have the need to pinpoint quickly which layer is contributing the most on the response time. Can Dtrace be used to perform such tasks, for example measuring java method timing? I've taken a look around but didn't find anything useful.

Congratulation on this very interesting blog and rails presentation!

fdo said...

Hi Stefano,

trying to find out where the time is spent in a 3 tier architecture could be difficult. If you have a J2EE env, you can use tools like jprobe.

Dtrace could help you understand what is happening in each tier only. This is not exactly what you want, but can make you find your answer.

To measure java method timing you could use a profiler. netbeans has a nice profiler, and you can also use the profiler in the Sun Studio 12 product. Both are free and will tell you inclusive and exclusive times for each method in your java app. Here is a nice blog about it.


HTH