Answer the question
In order to leave comments, you need to log in
Tools for searching for heavy php(5.2) scripts and resource-intensive queries to the database (mysql 5.1) on the server (freebsd 8.1)
Guys, help advice.
Initial data:
There is a site on Bitrix, which began to slow down, although nothing seemed to be changed in the code and there were no more visitors.
Server:
Answer the question
In order to leave comments, you need to log in
you can log slow requests.
my.cf
log_slow_queries = ON;
log_slow_queries = /var/log/mysql/mysql-slow.log
long_query_time = 5
queries that last longer than 5 seconds will be logged
For scripts, use a profiler, for example, Zend Debugger, for the base it was already answered above, there is slow.log
Everything described above is useful, but I will add what we use
Profiler - mirror.facebook.net/facebook/xhprof/doc.html Really cool thing. This is an extension that is easily managed from PHP. Of course the results don't look as pretty as xdebug + kcachegrind but there is a very useful feature for you. The results of profiling different pages can be aggregated into one averaged report. That is, you can profile in production, say 0.01% of all queries, and then watch the aggregated report. You will immediately see which functions are slowing down. With xdebug, you can go wrong and profile the wrong URLs.
I will immediately answer the questions, but we tried to turn it on under load and did not notice a strong overhead.
For SQL, I strongly recommend www.maatkit.org/doc/mk-query-digest.htmlAble to use SHOW PROCESSLIST, binlog as a source and even analyze network traffic via tcpdump. The most useful thing is that it can combine queries into logical classes up to parameters.
I set up xdebug profiling normally (!) and that's it.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question