+ All Categories
Home > Technology > You can't optimize what you cannot measure - Lone Star PHP

You can't optimize what you cannot measure - Lone Star PHP

Date post: 15-Jan-2015
Category:
Upload: juozas-kaziukenas
View: 10,489 times
Download: 2 times
Share this document with a friend
Description:
 
Popular Tags:
54
You Can't Optimize What You Can't Measure Juozas Kaziukėnas // juokaz.com // @juokaz
Transcript
Page 1: You can't optimize what you cannot measure - Lone Star PHP

You Can't Optimize What You Can't Measure

Juozas Kaziukėnas // juokaz.com // @juokaz

Page 2: You can't optimize what you cannot measure - Lone Star PHP
Page 3: You can't optimize what you cannot measure - Lone Star PHP
Page 4: You can't optimize what you cannot measure - Lone Star PHP

Juozas Kaziukėnas, Lithuanian

You can call me Joe

More info http://juokaz.com

Page 5: You can't optimize what you cannot measure - Lone Star PHP

Why?

Page 6: You can't optimize what you cannot measure - Lone Star PHP

Data

Page 7: You can't optimize what you cannot measure - Lone Star PHP

Looking for lies

Page 8: You can't optimize what you cannot measure - Lone Star PHP

Looking for lies

Page 9: You can't optimize what you cannot measure - Lone Star PHP

Looking for lies

Page 10: You can't optimize what you cannot measure - Lone Star PHP

Data

• Metrics

• Removes subjective decisions

• Can be aggregated and related

• If it’s 0, it is 0

• Tesla was probably right

Page 11: You can't optimize what you cannot measure - Lone Star PHP

Debugging production

Page 12: You can't optimize what you cannot measure - Lone Star PHP

Debugging production

• Behavioral patterns

• When something changes - something is not right

• You better notice it

• Facebook deployment process

• What caused it?

Page 13: You can't optimize what you cannot measure - Lone Star PHP

What happened?

Page 14: You can't optimize what you cannot measure - Lone Star PHP

What happened?

• Previous and current state

• Events

• Correlated events

• State information

Page 15: You can't optimize what you cannot measure - Lone Star PHP

What happened here?

Page 16: You can't optimize what you cannot measure - Lone Star PHP

What happened here?

Page 17: You can't optimize what you cannot measure - Lone Star PHP

Nothing happened here

Page 18: You can't optimize what you cannot measure - Lone Star PHP

Something happened here

Page 19: You can't optimize what you cannot measure - Lone Star PHP

Logs suck

Page 20: You can't optimize what you cannot measure - Lone Star PHP

Logs suck

• Someone needs to be checking them

• Need to be aggregated

• Need to be visualized

• High I/O to write

• Distributed logs?

Page 21: You can't optimize what you cannot measure - Lone Star PHP

Logs don’t suck

• Logging exceptions

• Detailed information about what happened

• If used effectively (processing)

Page 22: You can't optimize what you cannot measure - Lone Star PHP

Logs don’t suck

Page 23: You can't optimize what you cannot measure - Lone Star PHP

I want to sleep

Page 24: You can't optimize what you cannot measure - Lone Star PHP

I want to sleep

• Call me when things go wrong

• Otherwise everything is working

• Things don’t break silently anymore

Page 25: You can't optimize what you cannot measure - Lone Star PHP

Business problems

Page 26: You can't optimize what you cannot measure - Lone Star PHP

Business problems

• Detecting when business tools stop working

• No PHP errors, no database errors

• Failures of APIs, empty responses, invalid data

• Things stop working silently

Page 27: You can't optimize what you cannot measure - Lone Star PHP

Counting and timing

Page 28: You can't optimize what you cannot measure - Lone Star PHP

Counting and timing

• Record when something happens

• Record how long it takes for something to happen

• Use this to know how many things are happening

Page 29: You can't optimize what you cannot measure - Lone Star PHP

The solution

Page 30: You can't optimize what you cannot measure - Lone Star PHP

Statsd

Page 31: You can't optimize what you cannot measure - Lone Star PHP

Statsd

• Counters and timing

• No need to initialize or set up counters

• Non-blocking writes

• Originally written by Etsy.com

• Just works

• https://github.com/etsy/statsd/

Page 32: You can't optimize what you cannot measure - Lone Star PHP

StatsD::increment("coffee.melbourne");

Page 33: You can't optimize what you cannot measure - Lone Star PHP

$start = microtime(true);

have_a_coffee();

$spent = (microtime(true) - $start) * 1000;

StatsD::timing("coffee.timespent", $spent);

Page 34: You can't optimize what you cannot measure - Lone Star PHP

How it works

Page 35: You can't optimize what you cannot measure - Lone Star PHP

Graphite

Page 36: You can't optimize what you cannot measure - Lone Star PHP

Graphite

• Real-time charts

• Data collection

• Data aggregation

• Specialized database

• http://graphite.wikidot.com/

Page 37: You can't optimize what you cannot measure - Lone Star PHP

How it works

Page 38: You can't optimize what you cannot measure - Lone Star PHP

Lobster

Page 39: You can't optimize what you cannot measure - Lone Star PHP

Logster

Page 40: You can't optimize what you cannot measure - Lone Star PHP

Logster

• Parse log files

• Send data to graphite

• Integration with existing applications easier

• Also from Etsy.com

• https://github.com/etsy/logster

Page 41: You can't optimize what you cannot measure - Lone Star PHP

DataDogHQ.com

Page 42: You can't optimize what you cannot measure - Lone Star PHP

DataDogHQ.com

Page 43: You can't optimize what you cannot measure - Lone Star PHP

DataDogHQ.com

• Hosted solution

• Collect data from statsd

• Store and aggregate from multiple servers

• Chart combining any data

• Real time charts

• Alerts

Page 44: You can't optimize what you cannot measure - Lone Star PHP

Amazon outage

Page 45: You can't optimize what you cannot measure - Lone Star PHP

Amazon outage

Page 46: You can't optimize what you cannot measure - Lone Star PHP

Amazon outage

Page 47: You can't optimize what you cannot measure - Lone Star PHP

Amazon outage

Page 48: You can't optimize what you cannot measure - Lone Star PHP

How I use this

Page 49: You can't optimize what you cannot measure - Lone Star PHP

Web spiders

Page 50: You can't optimize what you cannot measure - Lone Star PHP

Web spiders

• ~250 nodes

• Couple thousand requests per second

• Increasing throughput - main goal

• Increasing reliability - secondary goal

• Metrics for: request time, error rate, error types, proxy failures, unknown responses, etc.

Page 51: You can't optimize what you cannot measure - Lone Star PHP

Web spiders

• Performance increased 1000% in 3 months

• Reliability increased to being 24/7 stable

• I can sleep

Page 52: You can't optimize what you cannot measure - Lone Star PHP

Wrapping up

Page 53: You can't optimize what you cannot measure - Lone Star PHP

Wrapping up

• Measure things

• Use statsd to collect data

• Graph it

• Sleep

Page 54: You can't optimize what you cannot measure - Lone Star PHP

THANKS!Juozas Kaziukėnas

@juokaz


Recommended