Measuring A Rails API With Graphite and StatsD

There are already a ton of great articles and tutorials discussing the finer details of insturmenting a rest API with graphite, but I wanted to share my experience and a few little lessons I’ve learned so far.

  • Graphite is a pain to install. I spent the better part of a day trying to get the requiset pieces up and running locally. Python wasn’t cooperating and put yo a string fight every step of the way. Installing on an EC2 Ubuntu instance was considerably easier, but it’s definitely something worth taking the time to script out.
  • Use a third party graphs dashboard. The graphite web package is an ok tool for prototyping new data streams, but it’s really pretty useless as far as day to day use is concerned. There are a few Sinatra/Rails options out there, as well as a few strictly client side dashboards. That being said, it I think there is still plenty of room for competition. A well designed mobile view would go a long way.
  • Don’t hesitate to experiment. There is no downside to collecting a ton of metrics and trying different combinations. Early on, I wasn’t 100% clear on what the difference between the different types of metrics was, so I threw a bunch of almost-but-not-quite the same metrics in there so see what they did over time.

So far, I’ve been able to find a couple of areas in my API that are worthy of a closer inspection. I should be able to use what I’ve learned from careful tracking to pull out some quick performance improvement wins with minimal effort.