austin entrepreneur

Announcing Clientperf: Simple Client-Side Rails Performance

Posted in Uncategorized by efalcao on June 21, 2008

I’m giving a talk at Austin on Rails next Tuesday on applying the 14 rules of high-performance websites in the typical rails mongrel/nginx stack, the main idea being to focus on some of the important implementation details when it comes to client-side performance optimization.

As I was planning, I realized that there was no simple as in the we’re-all-spoiled-with-rails simple way to measure client download times in production. Now, there is clientperf. It’s just a start, but decent enough to benchmark the actual client performance impact of any optimizations you make:

How it works

It injects javascript into the page that takes a timestamp at the top of the page and at the bottom of the page. Once the browser is done downloading, evaluating and rendering all assets, clientperf makes one last image request to your server with the start time, end time and the URL. Piece of cake.

How to install

gem install clientperf
clientperf /path/to/rails/app
rake db:migrate

and that’s it!



Thanks to Howard Rauscher for the javascript. Thanks to FiveRuns dev team for helping me learn neat things.

Enjoy and please let me know about bugs.


5 Responses

Subscribe to comments with RSS.

  1. Maxime said, on June 24, 2008 at 1:09 pm


    I am definitely going to have a try, there is finally a solution to really measure the time for our visitors to get that page.

    I am just throwing ideas to the wall: Do you think it could be interesting to measure and include the X-Runtime header that could be sent by mongrel instances? what does the start time is exactly corresponding to? when the javascript code in the html header is executed?

    Thanks for this tool.

  2. chris said, on June 24, 2008 at 1:17 pm

    have a look at jiffy-web : it does the same thing but with far more statistics !

  3. brian said, on June 24, 2008 at 2:16 pm

    Very cool, Eric. I’m definitely looking forward now to your talk tonight at Austin on Rails.

  4. Ankur Jain said, on June 25, 2008 at 6:48 am

    It doesn’t work with sqlite3.

    ActionView::TemplateError (SQLite3::SQLException: no such function: date_format: SELECT avg(milliseconds) AS avg_milliseconds, date_format(created_at,’%Y-%m-%d %H’) AS date
    _format_created_at_y_m_d_h FROM clientperf_results WHERE (created_at > ‘2008-06-24 07:00:00′) GROUP BY date_format(created_at,’%Y-%m-%d %H’) ) on line #20 of vendor/plug
    17: 0 %>
    19: 24 hour
    20: <img src=”” />
    23: 30 day

  5. Tobin Harris said, on March 7, 2009 at 11:04 pm

    Hey Eric

    I really like Clientperf – great job. Simple and effective!

    Is there a message board for it? I’ve found that it won’t run in production mode in Rails 2.2.2 and could do with a bit of help (it works in development mode). Any help appreciated.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: