Roller 0.9.7 performance tweak.

When FreeRoller was attacked the other day, the system slowed to a crawl. I assumed that the problems were my fault and I started to look for performance problems. I noticed that we are running the RequestFilter, which is responsible for parsing the URL and handling request parameters, for every incoming request. The RequestFilter also hits the database to determine if the requested page and user are valid. Since many requests are for simple files, such as GIFs, JPGs, and CSS, this is not wise. So, I changed the Roller web.xml. I replaced this, which causes every request to go through the RequestFilter:

<filter-mapping>
    <filter-name>RequestFilter</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping>

With this, which only puts page, rss, comments, *.do, and *.jsp through the ringer:

<filter-mapping>
    <filter-name>RequestFilter</filter-name>
    <url-pattern>/page/*</url-pattern>
</filter-mapping>
<filter-mapping>
    <filter-name>RequestFilter</filter-name>
    <url-pattern>/rss/*</url-pattern>
</filter-mapping>
<filter-mapping>
    <filter-name>RequestFilter</filter-name>
    <url-pattern>/comments/*</url-pattern>
</filter-mapping>
<filter-mapping>
    <filter-name>RequestFilter</filter-name>
    <url-pattern>*.jsp</url-pattern>
</filter-mapping>
<filter-mapping>
    <filter-name>RequestFilter</filter-name>
    <url-pattern>*.do</url-pattern>
</filter-mapping>

This seemed to have a significant effect on FreeRoller performance and on the MySQL load. I'm still looking at some Java code changes to optimize RequestFilter and RollerRequest, but the above change is easy to apply, so if you are running Roller 0.9.7 (or later), give it a try.



Like this post?  del.icio.us Bookmark it   |   submit to dig digg.com Digg it   |   slashdot Slashdot it   |   technorati See who links to it

Comments:

You know, I'd wondered about that /* mapping, but never gave it the amount of thought it deserved. Thanks Dave!

Posted by Lance on June 04, 2003 at 01:07 PM EDT #

Post a Comment:
  • HTML Syntax: Allowed

This work is licensed under a Creative Commons License.
Copyright 2002-2007, David M Johnson (dave.johnson at rollerweblogger.org)

This is a personal weblog, I do not speak for my employer.