Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Monitoring PHP applications

Monitoring PHP applications

Talk from local meetup.

34be88398f623c109b61d23e8215bd23?s=128

Mariusz Gil

May 05, 2014
Tweet

Transcript

  1. MONITORING PHP APPS with metrics Mariusz Gil

  2. None
  3. architecture

  4. backend mods

  5. devops

  6. sexy frontend

  7. business logic

  8. technology

  9. the client

  10. None
  11. life guard

  12. monitoring and the answer is…

  13. fast deployment low price strength and power

  14. None
  15. None
  16. graphite even better monitoring

  17. carbon whisper web app

  18. carbon whisper web app metrics data charts

  19. carbon app metrics servers metrics

  20. carbon backtop bucky collectd diamond evenflow ganglia graphios grockets hoardid

    host sflow jmxtrans logster sensu statsd statsite
  21. web app

  22. php lang? what about

  23. None
  24. $log = new \StatsD\Client(! ! [$host=‚localhost']! ! [, $port=8125]! );

  25. $log->start($stat);! $log->stop($stat [, $sampleRate]);

  26. $log->timing($stat, $time [, $sampleRate]);!

  27. $log->increment($stat [, $sampleRate]);! $log->decrement($stat [, $sampleRate]);

  28. $log->gauge($stat, $val, [, $sampleRate]);!

  29. None
  30. None
  31. <?php   ! $cache            =

     apc_cache_info();   $cache_user  =  apc_cache_info('user',  1);   $mem                =  apc_sma_info();   ! $stats  =  array(          "mem"=>array(                  "segments"              =>  (int)$mem['num_seg'],                  "segment_size"      =>  (int)$mem['seg_size'],                  "total"                    =>  (int)$mem['num_seg']  *  $mem['seg_size'],          ),          "opcode"=>array(                  "files_count"        =>  (int)$cache['num_entries'],                  "files_size"          =>  (int)$cache['mem_size'],                  "hits"                      =>  (int)$cache['num_hits'],                  "misses"                  =>  (int)$cache['num_misses'],                  "full_count"          =>  (int)$cache['expunges'],          ),          "user"=>array(                  "vars_count"  =>  (int)$cache_user['num_entries'],                  "vars_size"    =>  (int)$cache_user['mem_size'],                  "hits"              =>  (int)$cache_user['num_hits'],                  "misses"          =>  (int)$cache_user['num_misses'],                  "full_count"  =>  (int)$cache_user['expunges'],          ),   );   ! echo  json_encode($stats);  
  32. app logs? metrics from

  33. None
  34. app server app server mobile apps

  35. mobile apps app server app server fluentd php php

  36. <?php! ! // you can choose your own AutoLoader! require_once

    __DIR__.'/src/Fluent/Autoloader.php';! ! use Fluent\Logger\FluentLogger;! ! Fluent\Autoloader::register();! ! $logger = new FluentLogger("localhost","24224");! $logger->post("debug.test",array("hello"=>"world"));!
  37. app server app server fluentd php php graphite logster mobile

    apps
  38. None
  39. THANKS! @mariuszgil