PHP applications/environments monitoring: APM & Pinba
-
Upload
patrick-allaert -
Category
Technology
-
view
10.332 -
download
7
Transcript of PHP applications/environments monitoring: APM & Pinba
PHP applications/environments monitoring:
APM & Pinba
DavideMendolia - PatrickAllaert
PHPBenelux Conference 2010
Davide Mendolia
http://davidemendolia.blogspot.com/
[email protected] or @davideme(Twitter)
Lead developer of APM
php-benchmark contributor
http://www.php-ci.net/
Works at Tuenti
Social network, based in Madrid
More than 20 billion page views per month
First Spanish website ahead Google, Microsoft and Facebook (Comscore)
International work environment (15 nationalities)
Developers wanted!
Patrick Allaert
http://patrickallaert.blogspot.com/
[email protected] or @patrick_allaert(Twitter)
Lead developer of APM
Works at eZSystems (eZPublish, eZComponents)
PHPBenelux staff member
(http://www.phpbenelux.eu/)
Patrick Allaert
Start programming with PHP 3
Ten years of Free Software evangelism
Contributions:PHP (ext/ldap, QA: PHPT)
KDESvn (Subversion client for KDE)
XOof (eXtensible Open Object Oriented Framework)
Tabellio (collaborative suite for parliamentary assembly)
Monitoring: Definition?
Being aware of the state of a system by watching and measuring it.
Indicators:the physical condition of a machine
load of a machine
application availability
the messages in system logs
network performance
known attacks
Surveiller d'eventuellle erreur comportementale de l'application.Surveiller au niveau des performances, afin de prevoir d'eventuel probleme
Monitoring: Why?
Need in terms of increasing availability
Economic reasons
User experience
Monitoring: Why?
When I get on the homepageI have a blank page []Seriously? One moment, checking []We are aware of the problem,our engineers have found the solution.Everything will be back to normalin 5 minutesHell! You're right!?
Monitoring: Presentation
Monitoring the P of LAMP.
In particular:Error handling in PHP
Execution performance.
What are the solutions ?
Current:PHP
Zend Platform
Newcomers:APM (Alternative PHP Monitor)
Pinba
PHP: integrated functions
error_reporting
display_errors
error_logfile
syslogWindows => event log
set_error_handler()
Page de demo avec E_NOTICE et autre,
Display avec tail
Zend Platform
All-in-One commercial solution of Zend.Includes:monitoring
performance
high availability
APM
Alternative PHP Monitor
Dedicated on error handling
Born in october 2008
APM demo !
Tail -f /var/log/php/error.log
Page vide de apm.phpPuis generation d'une page d'erreurAffichage de apm.php
Recommecer avec mutilple erreur
Why ?
LAMP + APC + Xdebug
Missing software building block in the Free Software landscape.
Performance problems indirectly related to the Zend Platform. Need of a solution with a minimum impact.
+ APM (LAMPAXA)
Rappel, qu'est ce que APC, Xdebug,
Compatbilit totale avec le monde du LL
Architecture
Database
event
idINTEGER
tsTEXT
typeINTEGER
fileTEXT
lineINTEGER
messageTEXT
backtraceTEXT
slow_request
idINTEGER
tsTEXT
durationFLOAT
fileTEXT
PHP functions
void apm_get_events([int limit[, int offset[, int order[, bool asc[, bool json]]]]])Prints events from the database in an HTML or JSON format.
void apm_get_slow_requests([int limit[, int offset[, int order[, bool asc[, bool json]]]]])Prints slow requests from the database in an HTML or JSON format.
int apm_get_events_count(void)
int apm_get_slow_requests_count(void)
Future
PHP monitoring framework
Customizable strategies backends:SNMP (in progress)
custom command
Alternative storage solutions:MySQL/MariaDB
Hadoop
Volatile backends
Contributing
APM contact info
Websites:
http://pecl.php.net/package/APM/
http://code.google.com/p/peclapm/
Twitter: @php_apm
Mailing lists:[email protected]
[email protected]
Pinba
PHP is not a bottleneck anymore
Dedicated to realtime performance monitoring
Born in 2009
Why ?
LAMP + APC + Xdebug + APM
LAMPAXAP
Missing software building block in the PHP landscape.
Gather performance metrics in production environments.
+ Pinba
Compatbilit totale avec le monde du LL
Architecture
L'extension PHP Pinba envoie un paquet UDP lors de la terminaison d'une requte qui contient des informations comme:hostname - gethostname() result
request_count - number of requests served by this process
server_name
script_name
document_size - size of the response body
memory_peak - memory allocation peak
request_time - time spent of processing the request
ru_utime - resource usage (user)
ru_stime - resource usage (system)
timers - array of timers (optional)
De la nature UDP, aucune connexion n'est ralise, ce qui permet d'avoir aucun impacte de performance, mais des pertes de paquets pourraient se produire.
De l'autre cot, le plugin MySQL Pinba coute sur le port configur pour rcuprer les paquets et les dcoder afin de les stocker dans ses pools d'enregistrements ainsi que de mettre jour les index, les rapports de bases et rapports de tags si ils existent.
Pinba demo!
Data sent
string hostname gethostname() result
int request_count number of requests served by this process
string server_name $_SERVER["SERVER_NAME"]
string script_name $_SERVER["SCRIPT_NAME"]
int document_size size of the response body
int memory_peak memory allocation peak
float request_time time spent of processing the request
float ru_utime resource usage (user)
float ru_stime resource usage (system)
array timers array of timers (optional)
Benchmarking ?