Tools to search for heavy php(5.2) scripts and resource-intensive database queries (mysql 5.1) on the server (freebsd 8.1)

0 like 0 dislike
86 views
Guys, help advice.

Original data:
Is there a site on Bitrix, which began to slow down although it seems nothing in the code has not changed and visitors.

Server:
  • FreeBSD lapsi.ru 8.1-RELEASE-p1
  • apache-2.2.17_1,
  • php52-5.2.14_1,
  • mysql-server-5.1.51_1,
  • nginx-0.8.53 (gives static)


Task:
To determine which module (in particular some php file) has to be load.
How do you get the heavy DB queries (like: SELECT SQL_CALC_FOUND_ROWS e.the name,e.id e.DETAIL_PICTURE,price.PRICE many times)
by | 86 views

7 Answers

0 like 0 dislike
you can log slow queries.
my.cf
\r
log_slow_queries = ON;
log_slow_queries = /var/log/mysql/mysql-slow.log
long_query_time = 5
\r
queries that lasted longer than 5 seconds, get into the log
by
0 like 0 dislike
I'm usually such requests to mc just regexpi looking for
by
0 like 0 dislike
For scripts, use a Profiler, such as Zend Debugger'and for base have said above, is slow.log
by
0 like 0 dislike
xdebug for profiling and pinba pinba.org/wiki/Main_Page
by
0 like 0 dislike
Usually parsu Apache logs to see the most long-running scripts.
by
0 like 0 dislike
Everything described above is useful, but I will add what we use
\r
A Profiler mirror.facebook.net/facebook/xhprof/doc.html Really very best thing. This extension, which is easily controlled from PHP. Of course the results looks not so nice like xdebug + kcachegrind but there is a very necessary feature for you. The profiling results of the various pages can be grigirovich one average report. It is possible in production to profilerate, say 0.01% of all requests, and then look grigorevny report. It will be clear what f-tsiya brake. With xdebug it is possible not to guess and profilerate not the URLs.
Just answer the questions, Yes I tried to turn it on under load and a strong overhead is not noticed.
\r
For SQL fiercely suggest www.maatkit.org/doc/mk-query-digest.html Able to use as a source of SHOW PROCESSLIST, and binlog even analyze the network traffic through tcpdump. The most useful — able to unites queries into logical classes with accuracy to parameters.
by
0 like 0 dislike
Set up normally(!) profiling xdebug and all.
by

Related questions

0 like 0 dislike
2 answers
0 like 0 dislike
3 answers
asked Mar 21, 2019 by Pavel_Osipov
0 like 0 dislike
7 answers
0 like 0 dislike
2 answers
asked Apr 1, 2019 by xandr0s
0 like 0 dislike
4 answers
110,608 questions
257,186 answers
0 comments
28,868 users