« Lance's Prevayler... | Main | Tuesday at the RTP-W... »

FreeRoller performance.

As FreeRoller users and readers know, FreeRoller is having problems keeping up with the load of 500+ weblogs and the 101-list traffic. Sometimes the main page takes several minutes to load and often the system just collapses under the stress. According to Anthony Eden, who runs FreeRoller, the system is powered by one little eMachines box. I could use that as an excuse, but, regardless of the hardware, the poor performance of FreeRoller reflects poorly on the Roller software.

I considered using a profiler to figure out the root cause of the performance problem, but a profiler is difficult to setup for a Servlet app, there's a learning curve, and there are only so many Roller hours in my weekend. Plus, I had a gut feeling that the Roller main page, index.jsp, was causing the slow-downs.

Looking at the code behind index.jsp, I found that it uses several queries to build a list of weblogs, hit counts, and the last update time for each weblog. The queries are not complex, but because they are executed using an Object-Relational (O/R) persistence framework (Castor) each query results in the creation of one object per row returned. FreeRoller has over 500 weblogs, so each refresh of the index.jsp page results in the creation of thousands of objects. Even with page caching in place to reduce the frequency of refreshes, this has the potential to bog down the whole system.

I rewrote the code behind index.jsp to use only one query and I also added a limit to that query so that a Roller administrator can limit the number of weblogs displayed on the main page. Next, I did some load testing with JMeter. I set up a JMeter test plan to use 3 threads to hit index.jsp, a 20-second ramp up, and a 300 ms delay between requests. I did this testing on a 1.5Ghz Athlon, 768MB RAM box running Windows XP, Java 1.4.1, and Tomcat 4.1.18. Here are the results:

                   Avg.  Dev.  Throughput  Note

1) Old index.jsp 1051ms  8629  120/min     Heavy CPU usage
2) New index.jsp  248ms  1326  248/min     Limit 500 weblogs
3) New index.jsp   93ms   186  247/min     Limit 30 weblogs
4) TC index.jsp    90ms    72  337/min     Tomcat example page

The old index.jsp would peg the CPU at 100% for minutes at a time during cache refreshes. I'm not sure why, but I suspect that multiple requests were simultaneously refreshing the cache (I'm not sure how OSCache hanldles this). During test #1, Roller was so slow as to be almost unusable. Test #2 and #3 show that the new index.jsp is a great improvement. With a limit of 500 weblogs, the CPU usage is very heavy during a cache refresh but doesn't get to 100%. With a limit of 30 weblogs, the cache refresh does not have a noticable effect on the CPU. Test #4 tests the Tomcat examples page, it is included only as a baseline for comparison.

I made the above changes in the Roller 0.9.6 code branch so that they can me applied to FreeRolller right away. I'm still not happy about Roller performance and memory usage. I'm sure there is plenty of room for improvement. My next experiment is implementing the Roller business tier with the Hibernate O/R framework. I'm curious to see how it compares to Castor.

Comments:

There was a patch for preventing updates while oscache is rebuilding sent the mailing list a while ago. It hasn't been applied yet AFAIK.

Posted by Scott Farquhar on February 25, 2003 at 11:44 AM EST #

Hey Dave, I haven't been following the dev discussion, so I don't know, but has there been any discussion of "Bloggerizing" Roller? What I mean is - you've got everything all set to go to publish weblogs via FTP away from the main Java server. It would limit the dynamic functions (referrers and comments) but it would solve scalability problems. Seems to me that someone could slap a few more fields on the sign up page for FTP server and password info, then set up a Quartz process to offload blog entries as static pages hosted locally or to their own FTP server. Now that I'm thinking about it, if you did indeed publish locally, you could still keep track of referrer info by using a Filter servlet before the pages hits - and comments could be a separate app (like in Radio) Showing the # of comments on the posts would be tricky, but there might be javascript goodness that could solve that... Dave Winer has a theory that Google bought Blogger in part for their new Java-based blogging code which they can slap on their Google Boxes, and it's not a bad thought. Roller could compete with that, and be OSS. Just my thought... -Russ

Posted by Russ on February 25, 2003 at 12:10 PM EST #

That is a good idea and it should not be too hard to do. I think Lance is working on a feature he calls blogbake that bakes a blog then uploads it to a static site.

Posted by Dave Johnson on February 25, 2003 at 05:48 PM EST #

Hmmm... Dave, I'm not sure you're getting my thought (or maybe you are, but don't agree ;-) ). I'm saying that Roller works, is cool, but isn't really scalable beyond a few thousand users, max. I wasn't thinking about another "feature" I was thinking about taking the plumbing that you have now and enabling, say, a MILLION or more users at once to use the software to create weblogs. If you made that fundamental shift in thinking and focus - without a lot of work (I hate people who leave suggestions on my site which would require 2000 man hours to implement) you could produce software that could be as valuable as whatever Google paid for Pyra. I'm suggesting this because I'm thinking to myself now the amount of work it would entail to write an app like Blogger (that produces static pages) and thought - "Roller does most of this already..." ;-) -Russ

Posted by Russ on February 26, 2003 at 07:22 AM EST #

I understand what you are saying, and I like it, but I think of it as a feature or an "option" because I see it as one of many ways that Roller could work: 1) Client-side app that publishes to static webserver (as Radio does). 2) Server-side app that publishes to static webserver (as Blogger does) 3) Server-side app that dynamically displays weblogs (as Roller does today). Ideally, a Roller admin should be able to configure Roller for any of these modes of operation.

Posted by Dave Johnson on February 27, 2003 at 02:07 AM EST #

Post a Comment:
  • HTML Syntax: NOT allowed

« Lance's Prevayler... | Main | Tuesday at the RTP-W... »

Welcome

This is just one entry in the weblog Blogging Roller. You may want to visit the main page of the weblog

Related entries

Below are the most recent entries in the category Roller, some may be related to this entry.