StatsD + Graphite: “super lightweight client side” graphing solution

StatsD is a NodeJS daemon, listening for udp message. It parses the message received, get the metrics and then flush it at periodic times. Its the perfect tool for monitoring anything like your own application metrics, without any overheads on your servers or your coders for starting using it.

StatsD benefits on other systems ?

  • Super  easy on client side: the client just send udp packet with a simple text protocol. No configuration needed, you just have to know the destination ip and port. You have client implementation on ruby, js, python, c etc…
  • Super light on client side: udp is fire and forget. On heavy loaded machines, you have a very very low overhead.
  • Manage data on server side: keep track of counters for you.
  • Trivial api: you deal with counters, timers and gauges. thats it !
  • Plug to other system like graphite: statesd don’t graph anything, but it natively supports graphite backend to flush data for graphing. I’ve also implemented a udp proxy backend in node, sending every datas to a eventmachine websocket broker: easy !
  • Business / Application ready api: just perfect for tracking db response times, user interactions on frontend, temperature, api response times, login errors / success etc…

Why i use StatsD and Graphite

  • i use StatsD because its the lightest solution in term of installation and code integration.
  • I use graphite because with graphs like munin we are very far from the real time (1 or 5 minutes) and with graphite we can really customize dashboards: its perfect !
note: there a lot of other reason you could use this tool, but for my production service it is my architectural constraints and choices.

Code examples (client side)

I  use statsd-ruby for my application. With this lib, code looks like this.

[cc lang=”ruby”]
# configuration
$statsd = ‘’, 8125

# using it
$statsd.increment ‘visits’ $statsd.timing ‘response time’, 320 $statsd.gauge ‘documents.count’, 42


Graphite performs two tasks:

  1. Storing numbers changing over time
  2. Graphing them
You should take a look at this great article on graphite architecture.  To have a complete view of its role.
StatsS can send natively or by default all its data to graphite near real time. So its the perfect companion !

More infos on StatsD

The StatsD code and doc at github.

StatsD is develop by the start-up Etsy: here is their blog post about this tool.

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *