-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 01/17/2011 11:23 AM, Tanoor Dieng wrote: > Hi everybody, > I'm a php developper for a high traffic website. Our web servers run with > lightty? > > We have some issues with the cpu consumption of our servers. > > The problem is that, we don't know exactly which script consumes so much > cpu. > So, we cant to figure out how much cpu does a php script take. > > We have tried 3 methods: > > 1) Microtime: microtime at the beginning and at the end and make the diff. > The problem with that is that it takes the execution time of the script, but > in our script we make: > - connection to database > - connection to memcache > - connection to session server > > All of this is not taken into account, so microtime is not that accurate > > 2) Shell command: we get the pid of the process executing the script and > make a 'top' on this pid . The problem is that the php-cgi manages many > threads so it's not accurate too. > > Is there other methods for dealing with this problem. > > Thanks, > best regards, > > Tanoor. > Use something like xdebug & cachegrind to profile the application. This makes it easy to track down memory and CPU usage. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iQIcBAEBAgAGBQJNNB8vAAoJEMffsHAOnubXpRkP/2u0EHXnQR+kkp6pQqM8Gry1 1iFIfqck4Bco3rOYcsX9IK22c/YJZ3RGCMnyZyp+XUAmV615keAtqW/sRgWy/cO9 oaiDHdctdnLeFxmoyRVzR7/FkaeM/bJ7Tj29wnkii8gMbNi8W3zm/RQqBSxoAGig tJOx+SBi+jqgxfAn18dutRrqDm1lMRNi3wZI8k6Dg2U8i+s/sAjFMVPbNAvLfDzs uOisnYiJSCdA33zN3IkXD+W9vqVGdHjqF1UABG8srPY/DBUPDjtSrzuHICdQX4SJ luzgDvnoIVoOE0ntiAPIKba89iXDtIIIlvIX2BkQeGfNIoZWP0/M75siX4drLLI/ 6/omgCBOMXkjZ0GMJzdeLPsVjMqagNYKUZfor3KPj0PbpX4RoftWJgvLShHDv74v nusu8vClDwQNc9eBBZ5Kf7MkXzXVXnFUUO21PSb3WQtX/7eziGrhz8vxYEbR7/zA XidHE1vfyTr+DNdbkjkYPHyj/s+ZIloNmf/9rjdC8xpEYEevEErUxY+15MXvSZEq 4JmxVUOe3P9ICZSGMf1+BieH9oZRmteFLtMujwHdXVzWVDrCvurM6dwJVdSNZMhT Ct0PeOwJxJgAtvKL+bOpzd+AMHVEpoWETIYrpXepmCHxbCVCa0fDmxgZ73+32XI8 25mgBHxvMdfINaOjWZJf =mz+P -----END PGP SIGNATURE----- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php