Date post: | 04-Dec-2014 |
Category: |
Technology |
Upload: | sven-rautenberg |
View: | 400 times |
Download: | 3 times |
Messen mit PHP
PHP Usergroup München10. Juli 2013
Über mich
● Sven Rautenberg● Senior Developer bei Kabel Deutschland● mit Vergangenheit bei SELFHTML
Motivation
„Ein Appetizer für statsd,
Live-Dashboards,Graphik,
Messungen“
Motivation
Etsy im Februar 2011
Prämisse
● Einfach messen● Alles messen● Und visualisieren
Dashboards
Let's try this at home!
Setup-Plan
Setup-PlanSoftware
Software
Software
System
Setup-PlanSoftware
Software
Software
System
Aggregatorstatsd
Setup-PlanSoftware
Software
Software
System
Aggregatorstatsd
StorageCarbon
Setup-PlanSoftware
Software
Software
System
Aggregatorstatsd
StorageCarbon
ViewerGraphite
Setup-PlanSoftware
Software
Software
System
Aggregatorstatsd
StorageCarbon
ViewerGraphite
Backendes gibt reichlich Auswahl,
auch SaaS-Angebote
Setup-PlanSoftware
Software
Software
System
Aggregatorstatsd
StorageCarbon
ViewerGraphite
Implementiert innode.js, Ruby, Python, Erlang, C, Scala, Clojure
Backendes gibt reichlich Auswahl,
auch SaaS-Angebote
Installieren
● Graphite einigermaßen schwierig– http://kaivanov.blogspot.de/2012/02/
how-to-install-and-use-graphite.html
● Django SECRET_KEY– „settings.py“ der Graphite Webapp
Installieren
● statsd supereinfach– apt-get install nodejs
– git clone https://github.com/etsy/statsd
– cd statsd
– cp exampleConfig.js yourConfig.js
– vi yourConfig.js
– node statsd.js ./yourConfig.js → läuft :)
Messen in PHP
Messen: Counter
foo.event:1|c
foo.event:-1|c
foo.event:20|c
Messen: Timer
foo.duration:123|ms
Messen: Gauges
foo.level:234|g
foo.level:+5|g
foo.level:-3|g
Messen: Sets
foo.ids:15675672|s
Counter vs. Gauges vs. Sets
● Counter: neu registrierte User pro Minute● Gauge: Anzahl existenter User● Set: Anzahl aktiver User
– aufgrund der UserId
– pro Zeit
Timer-Features
● Auto-Statistik– lower
– upper
– mean
– median
– count...
Sampling
foo.bar:1|c|@0.1
PHP Clients
● packagist.org → statsd suchen● in Code integrieren ;)
– $statsd->timing("foo.bar", 320);– $statsd->increment("foo.bar");
Messwerte wiederfinden
● Namensaspekte– http://matt.aimonetti.net/posts/2013/06/26/
practical-guide-to-graphite-monitoring/
● Antipattern– https://github.com/lukevenediger/statsd.net/
blob/master/statsd.net/Documentation/guidance/metric-anti-patterns.md
Erfahrungen aus 1 Tag rumspielen
● langweilig ohne Datenmengen● statistisch ungenau● Konfigurationsvielfalt● Funktionsvielfalt in Graphite
Fragen?
Anmerkungen?
Kommentare?
Kontakt
● Slideshare: http://www.slideshare.net/svenrtbg
● Twitter: @svenrtbg● http://www.rtbg.de
Attribution● Background: CC-BY
– http://www.freeimageslive.co.uk/free_stock_image/numbers-background-jpg
– http://www.freeimageslive.co.uk/users/gratuit