$30 off During Our Annual Pro Sale. View Details »

Measure your Rails app

Measure your Rails app

So you've done a web app, you tested it, deployed it, and your first customers begin to use your product and share it to their friends. That's great! Now, how do you know how are they using your application? Are you sure of the impacts of your deployments? What if you doubled the response time by fixing a bug and didn't see it?

In order to watch your application behavior, you need real-time metrics.

What are exactly real-time metrics? What can you use to store and watch them? What are exactly RRDtool, Graphite, StatsD? Can we improve existing solutions?

Jean-Daniel Guyot

April 12, 2012

More Decks by Jean-Daniel Guyot

Other Decks in Programming


  1. measure your rails app

  2. metrics solutions going further

  3. Jean-Daniel Guyot @jdguyot

  4. None
  5. metrics solutions going further

  6. Statistics

  7. Statistics ≠ Real-time metrics

  8. Statistics = Play with your model

  9. Statistics SELECT AVG(price), date_trunc('month', created_at) d FROM payments WHERE state

    = ‘paid’ GROUP BY d
  10. 0 € 43 € 85 € 128 € 170 €

    dec. jan. feb. mar.
  11. real-time metrics

  12. real-time trends metrics

  13. system application

  14. system application

  15. Good ol’ tools Syslog RRDtool Munin Cacti

  16. None
  17. None
  18. data value Minute Hour Day Month Year

  19. data compression 10 sec during 1 day 1 min during

    1 week 10 min
  20. issues No way to insert data on an irregular basis

    No way to insert data in the past Insert one value at a time (I/O performance issue)
  21. metrics solutions going further

  22. graphite

  23. graphite Easy to use Combine graphs easily Apply functions Save

    graphs & dashboards (Python)
  24. More than storage Whisper (DB) Carbon (Backend) Webapp (UI) inspired

    from RRDtool
  25. timestamp key value

  26. pimp my gaphite Whisper (DB) Carbon (Backend) Webapp (UI) Graphiti

  27. sending data to graphite

  28. App

  29. App Graphite timestamp key value

  30. issues

  31. App Graphite OMGTCP!

  32. App Graphite 2 values in 10 seconds interval: OVERWRITE

  33. App Graphite Counters?

  34. flickr StatsD (Perl)

  35. etsy StatsD (Node.js)

  36. Statsd Ruby, JS, C++, whatever Counters, Timers Automatic simple statistics

    values computation (95% percentile, average, …)
  37. StatsD Graphite App

  38. metrics solutions going further

  39. issues

  40. StatsD Graphite App Monitoring Maintenance 3 standalone apps =

  41. 2 solutions

  42. ambroise github.com/capitainetrain/ambroise

  43. App Graphite Unicorn + after_fork + StatsD Ambroise =

  44. ambroise Nothing to start Less code Simple

  45. statsd + rabbitmq

  46. StatsD Graphite App Classic architecture

  47. StatsD Graphite App Add RabbitMQ RabbitMQ

  48. RMQ Graphite App Detach StatsD StatsD MQ RMQ

  49. statsd + rabbitmq No latency Fault-resistant Only one running app

  50. a few graphite tips

  51. timestamp key value

  52. folder.folder.key

  53. tip #1 Pay attention to values overwriting Several machines: add

    a namespace per machine mystat.machine1.my_counter To get all stats: mystat.*.counter
  54. tip #2 Use only 1 RabbitMQ for all the hosts

    (development machines/integration) hostname.app_name.mystat.machin e1.my_counter
  55. Thanks.