Measure Everything
-
Upload
arik-fraimovich -
Category
Technology
-
view
315 -
download
0
description
Transcript of Measure Everything
![Page 1: Measure Everything](https://reader033.fdocuments.in/reader033/viewer/2022051514/54b74f054a79592b5b8b458f/html5/thumbnails/1.jpg)
Measure everything
Ruby Underground, August 2012@arikfr
Tuesday, February 12, 13
![Page 2: Measure Everything](https://reader033.fdocuments.in/reader033/viewer/2022051514/54b74f054a79592b5b8b458f/html5/thumbnails/2.jpg)
Today’s plan
• Why measure
• How to measure
• Graphite / StatsD
• Using Graphite/StatsD with Ruby and Rails
Tuesday, February 12, 13
![Page 3: Measure Everything](https://reader033.fdocuments.in/reader033/viewer/2022051514/54b74f054a79592b5b8b458f/html5/thumbnails/3.jpg)
Questions to answer
• How fast is my system?
• Is it faster than last month?
• Did our last deploy affect database performance?
• How much time do we spend calling external web services?
Tuesday, February 12, 13
![Page 4: Measure Everything](https://reader033.fdocuments.in/reader033/viewer/2022051514/54b74f054a79592b5b8b458f/html5/thumbnails/4.jpg)
More questions
• How many errors do we have a day?
• How many failed logins?
• How many successful logins?
• How many orders without house number?
Tuesday, February 12, 13
![Page 5: Measure Everything](https://reader033.fdocuments.in/reader033/viewer/2022051514/54b74f054a79592b5b8b458f/html5/thumbnails/5.jpg)
And more questions!
• How many orders did we have today?
• How many orders did we have today from Android version 2.056?
• How many rejected orders did we have?
• How many rejected orders due to lack of coverage vs. lack of taxis?
Tuesday, February 12, 13
![Page 6: Measure Everything](https://reader033.fdocuments.in/reader033/viewer/2022051514/54b74f054a79592b5b8b458f/html5/thumbnails/6.jpg)
To answer all of this, you need a way to track different numbers.
Tuesday, February 12, 13
![Page 7: Measure Everything](https://reader033.fdocuments.in/reader033/viewer/2022051514/54b74f054a79592b5b8b458f/html5/thumbnails/7.jpg)
So now we know the why.
But how...?
Tuesday, February 12, 13
![Page 8: Measure Everything](https://reader033.fdocuments.in/reader033/viewer/2022051514/54b74f054a79592b5b8b458f/html5/thumbnails/8.jpg)
Tuesday, February 12, 13
![Page 9: Measure Everything](https://reader033.fdocuments.in/reader033/viewer/2022051514/54b74f054a79592b5b8b458f/html5/thumbnails/9.jpg)
But that’s not enough
• Not real time enough
• Hard to control what’s being collected
• Pricey for big deployments
Tuesday, February 12, 13
![Page 10: Measure Everything](https://reader033.fdocuments.in/reader033/viewer/2022051514/54b74f054a79592b5b8b458f/html5/thumbnails/10.jpg)
The Alternative
• Graphite (Whisper, Carbon, Graphite Web)
• StatsD
• CollectD
• (there are other options -- OpenTSDB, Liberato, home grown)
Tuesday, February 12, 13
![Page 11: Measure Everything](https://reader033.fdocuments.in/reader033/viewer/2022051514/54b74f054a79592b5b8b458f/html5/thumbnails/11.jpg)
Benefits
• Easy to install
• Highly scalable
• Practically zero cost to measure anything:
• efficient storage
• UDP packets to send data in
• Ecosystem
Tuesday, February 12, 13
![Page 12: Measure Everything](https://reader033.fdocuments.in/reader033/viewer/2022051514/54b74f054a79592b5b8b458f/html5/thumbnails/12.jpg)
Whisper
• Default settings:
• 6 hours of 10 second data
• 1 week of 1 minute data
• 5 years of 10 minute data
• That’s amounts to ~3.2MB per metric.
• Configurable.
Tuesday, February 12, 13
![Page 13: Measure Everything](https://reader033.fdocuments.in/reader033/viewer/2022051514/54b74f054a79592b5b8b458f/html5/thumbnails/13.jpg)
Types of data
• Counters - number of orders per sec
• Gauges - total orders today
• Timers - time to make an order
• (with additional values, such as: count, mean, 90th percentile, max, min, etc)
Tuesday, February 12, 13
![Page 14: Measure Everything](https://reader033.fdocuments.in/reader033/viewer/2022051514/54b74f054a79592b5b8b458f/html5/thumbnails/14.jpg)
Sending a number to Graphite
• metric number timestamp
• example.ruby.under_ground 20 1346075634
• echo "example.ruby_underground 20 `date +%s`" | nc graphite.yourcorp.com 2003
Tuesday, February 12, 13
![Page 15: Measure Everything](https://reader033.fdocuments.in/reader033/viewer/2022051514/54b74f054a79592b5b8b458f/html5/thumbnails/15.jpg)
Sending a number to StatsD
./statsd-client.sh 'my_metric:100|g'
Tuesday, February 12, 13
![Page 16: Measure Everything](https://reader033.fdocuments.in/reader033/viewer/2022051514/54b74f054a79592b5b8b458f/html5/thumbnails/16.jpg)
Naming Convention
• Whatever makes sense to you, just remember that it’s a tree.
• We use:
• {env}.{metric}.{region}.{hostname}
• You can use globs, when querying:
• app.orders.daily.completed.israel.*
• app.orders.daily.completed.*.*
Tuesday, February 12, 13
![Page 17: Measure Everything](https://reader033.fdocuments.in/reader033/viewer/2022051514/54b74f054a79592b5b8b458f/html5/thumbnails/17.jpg)
Ruby Examples
Tuesday, February 12, 13
![Page 18: Measure Everything](https://reader033.fdocuments.in/reader033/viewer/2022051514/54b74f054a79592b5b8b458f/html5/thumbnails/18.jpg)
$ gem install statsd-ruby(https://github.com/reinh/statsd)
Tuesday, February 12, 13
![Page 19: Measure Everything](https://reader033.fdocuments.in/reader033/viewer/2022051514/54b74f054a79592b5b8b458f/html5/thumbnails/19.jpg)
Track Deployments
Tuesday, February 12, 13
![Page 20: Measure Everything](https://reader033.fdocuments.in/reader033/viewer/2022051514/54b74f054a79592b5b8b458f/html5/thumbnails/20.jpg)
Measure controllers
Tuesday, February 12, 13
![Page 21: Measure Everything](https://reader033.fdocuments.in/reader033/viewer/2022051514/54b74f054a79592b5b8b458f/html5/thumbnails/21.jpg)
Measure Specific stuff
Tuesday, February 12, 13
![Page 22: Measure Everything](https://reader033.fdocuments.in/reader033/viewer/2022051514/54b74f054a79592b5b8b458f/html5/thumbnails/22.jpg)
Getting Data out
Tuesday, February 12, 13
![Page 23: Measure Everything](https://reader033.fdocuments.in/reader033/viewer/2022051514/54b74f054a79592b5b8b458f/html5/thumbnails/23.jpg)
Graphite web
Tuesday, February 12, 13
![Page 24: Measure Everything](https://reader033.fdocuments.in/reader033/viewer/2022051514/54b74f054a79592b5b8b458f/html5/thumbnails/24.jpg)
Tasseo
Tuesday, February 12, 13
![Page 25: Measure Everything](https://reader033.fdocuments.in/reader033/viewer/2022051514/54b74f054a79592b5b8b458f/html5/thumbnails/25.jpg)
Gdash
Tuesday, February 12, 13
![Page 26: Measure Everything](https://reader033.fdocuments.in/reader033/viewer/2022051514/54b74f054a79592b5b8b458f/html5/thumbnails/26.jpg)
Graphene
Tuesday, February 12, 13
![Page 27: Measure Everything](https://reader033.fdocuments.in/reader033/viewer/2022051514/54b74f054a79592b5b8b458f/html5/thumbnails/27.jpg)
Down sides
• Hard to track user analytics
• You can tell how many orders were done today
• You can’t tell (easily) how many unique users did those orders
• The tree of metrics is sometimes annoying
Tuesday, February 12, 13
![Page 28: Measure Everything](https://reader033.fdocuments.in/reader033/viewer/2022051514/54b74f054a79592b5b8b458f/html5/thumbnails/28.jpg)
Questions?
Tuesday, February 12, 13