Vasileios Kontorinis wrote:
... Imagine having to debug a performance issue
and olio providing an average breakdown of response time to web/db/filestore
time. It would immediately tell you where you should start looking for the
problem.
Actually I don't have to imagine it, having done this in the past!
For the PHP code itself, I have used microtime() to instrument
bits of the code, then used a convenience function that I put
in config.php to log it.
$t0 = microtime(true);
...code...
$t1 = microtime(true);
timing("APRS01", $t0, $t1);
For db and filestore times I used a couple of different approaches.
Since I was using Solaris, I could use DTrace to put probes on
key functions in the PHP runtime that requests to db and filestore
pass through. Apart from the webserver-specific probe points
[I was using Sun Java System Web Server] for measuring the
handling of web requests and the handing off to PHP, I used
zim_PDO_* for db (MySQL), zif_memcache_* for memcached,
zif_readfile for filestore.
Looking at it in hindsight, it seems that list doesn't capture
the cost of writing images to the filestore. I think that's
one area where I explicitly instrumented the PHP code instead.
Session files themselves had to be distributed over a directory
hierarchy to avoid lock contention on a single directory.
Since the webserver was multithreaded, I used thread id (tid), as
a filter to control how much data I collected. All users should
have been identical profiles, so I collected data from a subset
of the threads servicing incoming threads. [I had about
210 threads in the pool and traced 10 of them.]
If you didn't have DTrace, then it should still be possible to
write an interpose library to get the data. That does leave a
challenge as to what to do with the data once collected.
It does seem desirable to me to have a more scalable, integrated,
logging mechanism available inside the webserver environment to
which performance data can be added to augment URL, response time,
etc.
FWIW I also used DTrace at the db backend to measure database
activity for individual requests. It would be helpful if there
was some sort of tag or transaction identifier that followed
a request around the system, so when data is collected it can
be tagged. This would facilitate combining data from multiple
sources in a post-experiment phase.
--
============================================================================
,-_|\ Richard Smith PAE
/ \ Oracle Phone : +61 3 9869 6200
[email protected] Direct : +61 3 9869 6224
\_,-._/ 476 St Kilda Road Fax : +61 3 9869 6290
v Melbourne Vic 3004 Australia
===========================================================================