DooVDe
DooVDe

Reputation: 11

Unexplainable Load Average CentOS Linux php-fpm

we have a strange problem with "Load average" on server, we tried to solve the problem but no luck and now we trying to find help.

We have a VPS CentOS Linux 2.6.18-274.18.1.el5 x86_64 GNU/Linux with 2 physical cores, 2GB RAM, this server is just running php-fpm 5.3.10 no other services running on it.

php using Redis via TCP (~1000 request per second), Redis server can easily make 60000 request per second and have a LA of 0.01.

Symptoms:

Random spikes of LA from 16 to 40 with no obvious reason. In spite of this fact CPU usage is ~40%, ~10% of system and memory usage is less then half.

Cpu0  : 36.7%us, 11.9%sy,  0.0%ni, 44.2%id,  0.0%wa,  0.0%hi,  7.2%si,  0.0%st
Cpu1  : 39.8%us, 10.0%sy,  0.0%ni, 26.2%id,  0.0%wa, 10.0%hi, 14.0%si,  0.0%st
Mem:   2058776k total,  1241500k used,   817276k free,   160172k buffers
Swap:  1048568k total,        0k used,  1048568k free,   876888k cached

Spikes are not related to network activity or cron jobs. Amount of requests to php per seconds is ~70.

PHP slow log shows us, that a lot of scripts not getting they turn to run even after 5 seconds! php Slow log (5s):

[pool www] pid 7016
script_filename = /var/www/myapp/index.php
[0x000000001820d230] session_start() /var/www/myapp/index.php:10

10 first lines of index.php:

<?php
$starttime=microtime(TRUE);
srand();

ob_start();

error_reporting(E_ALL);
ini_set('display_errors',1);

session_start();

Sessions located at memory partition... no problems with IO.

config php-fpm:

listen.backlog = 18192
pm = dynamic
pm.max_children = 256
pm.start_servers = 48
pm.min_spare_servers = 16
pm.max_spare_servers = 64
pm.max_requests = 512

Please if some one have any suggestions how to lower LA, and delays.

Upvotes: 1

Views: 3506

Answers (2)

Gadelkareem
Gadelkareem

Reputation: 1097

I think PHP config is high for your 2GB ram, try to decrease start_servers Check this config Install PHP 5.3.10 with PHP-FPM on CentOS 6.2

Upvotes: 0

Perry
Perry

Reputation: 4495

Load average is a measure of the number of processes you have in your run queue at any given time. It is not, per se, a measure of how overloaded your machine is, and it may not be a problem for your load average to spike at times -- it does not necessarily mean the machine is overloaded.

Without additional information about why you believe the load average to be a problem and the sort of load conditions the machine is experiencing, it is difficult to answer in more detail.

Upvotes: 1

Related Questions