Answer the question
In order to leave comments, you need to log in
After updating the software on the server, the site began to slow down
There is a server. FreeBSD 8.0, Apache 2.2.23, PHP 5.4.10, MySQL 5.1.67. It was necessary to update PHP on it (before that there was Apache 1.3 with PHP 5.2.4). As soon as Apache and PHP were updated, the pages of the site began to load in 2-5 seconds. Updated more thoroughly, with all sorts of dependencies, optimized / checked the tables in MySQL. It slows down when working with MySQL (I measured the execution time of various queries inside the running script itself). Moreover, the slow requests are constantly changing places in this script: either one was slowly executed, then another, then the third. I have already tried to find and optimize slow queries in MySQL logs, change MySQL and Apache settings. Put Nginx ahead. Did not help…
There are some embarrassing things about MySQL processes though. For example, there are many requests with the Sleep status and NULL instead of the table name, as well as many requests with the Locked status for one of the most used tables in the project. But requests to this table are normal, mostly by primary key. Separately, PHP scripts without MySQL, and even more so static pages, load quickly. I understand that everything points to a problem with either the MySQL configuration or crooked queries, but after all, everything was fine before the PHP and Apache upgrade.
What can be done? Help me please.
Answer the question
In order to leave comments, you need to log in
load averages: 26.49, 25.19, 23.14
This can be a terrible overload if there are few processor cores.
How many? sysctl -a | egrep -i 'hw.ncpu'
and who are the zombies? 1 zombie
Look at the disk load gstat
and netstat -n | grep80| awk '{print $5}' | cut-d. -f 1,2,3,4 | sort | uniq -c | sort -n
can be ddos.
Possibly something to do with this change in PHP 5.4:
ext/mysql, mysqli and pdo_mysql now use mysqlnd by default.
From the top you can see that the entire percentage is fried, there is one muscle, and a lot of Apache and one rm
To begin with, we remove rm
, it is logical that the brakes of mysql are not connected with the muscle itself, but with the fact that the Apache ate the entire percentage, if the Apache ate it, then it is either not correct apache config or wrong php config well, or php code as always is shit and in the new version of overloadid php module in apache.
If swap is loaded, then this is a serious problem. It is necessary to either optimize for memory loading (perhaps start with mysql), or add memory to the server.
For example, you can start by removing unnecessary modules and reducing the number of processes for apache.
Does apachetop -f /path/to/apache.access.log show the expected situation?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question