CPU load

Started by sinelogixweb, Nov 27, 2022, 04:55 AM

Previous topic - Next topic

sinelogixwebTopic starter

Hello. I have 4 sites at different VPS/VDS from different hosting providers. Since this month, the CPU load has increased dramatically, reaching 100%.
I noticed that this affected two sites on the CentOS-7-amd64 server with the ISP panel. The third site on Ubuntu-16.04-amd64 with a free Vesta panel works fine.
Question: has anyone observed this on their servers and if so, what could it be related to?
 I haven't changed anything on the sites (content is just being uploaded, and the visitor has grown a little), it feels like the problem is on the server side, and I'm sure of it.


yum install htop
and run htop, see what the percentage is loading (the name of the process will be immediately visible).
You can also install some kind of server status monitoring service, such as servermonitoring.me (free) - in real time you will see what is happening with the server.


You can beat around the bush for a long time. Forum members are guessing on coffee grounds and maybe we'll get to the point))
It is necessary to look at what exactly creates a load and of what kind. CPU or IO, Apache, Nginx, PHP-FPM, MySQL, queries to the same page or different, etc.
Adequately, and not with a finger in the sky, can be assessed only by having SSH access to the server. And this cannot be posted on the forum!

Perhaps hosting support and rights, and indeed nothing more can be done, but without backing up your words with logs, screenshots, you can not trust this reliably.
If you really have a server with administration in practice, and not in words only, then ask support to conduct a more in-depth analysis, if such has not been carried out.
And if there was, then provide screenshots or parts of logs for a broader understanding of the situation.


Apache creates CPU load:
This occurs when scripts are working incorrectly (see above), working with audio/video, or using mod_gzip to compress data. Try disabling data compression or optimizing scripts.

MySQL creates disk load:
Incorrect MySQL configuration or query construction. Sometimes MySQL uses disk to store temporary tables. This happens when there is not enough space in the memory buffers or when using complex queries. The size of the buffers is regulated by directives in the my.cnf configuration file. In this case, it is necessary to increase the directives tmp_table_size and max_heap_table_size. The problem can be localized using the mysqladmin -i 2 processlist -p command with the MySQL administrator password. The output will contain Created_tmp_disk_tables entries. When optimizing settings, it is very convenient to use mysqltuner.p and tuning-primer scripts.

Attention! Incorrect configuration of MySQL parameters can lead to increased consumption of RAM and other system resources.

MySQL is guaranteed to create temporary tables on disk in cases where:

there is a BLOB or TEXT column in the table
column size when using GROUP BY or DISTINCT is greater than 512 bytes
column size in the SELECT output, when using UNION or UNION ALL is greater than 512 bytes
MySQL creates a load on the processor
Most likely, the problem is in "broken" indexes or tables. Information about this should be contained in MySQL logs. You need to run a table check. You can do this via phpMyAdmin or with the mysqlcheck -Arp command by entering the MySQL administrator password.