Announcing Clientperf: Simple Client-Side Rails Performance
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!
Source
http://github.com/efalcao/clientperf
Thanks
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.

Hi,
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.
Maxime
have a look at jiffy-web : it does the same thing but with far more statistics !
Very cool, Eric. I’m definitely looking forward now to your talk tonight at Austin on Rails.
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
ins/clientperf/views/clientperf/index.html.erb:
17: 0 %>
18:
19: 24 hour
20: <img src=”" />
21:
22:
23: 30 day
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.