Sometime ago we have came upon interesting problem. Sometime (not everytime, lets pretend nearly each 100-200 hit) session_start() takes very long time. Up to 60 seconds. (longest one was 63, generally around 50).
Server run CentOS 6.5 (linux kernel 2.6.32-431.17.1.el6.x86_64) nginx/1.4.7 (yep i know it is old) + Apache/2.2.15 + PHP 5.3.3 (using mod_php) Two intel SSD 530 makes Raid 0 There is a lot of free ram 5+ GB. I tried to tune vm.swappiness value may be it is because of some memory-disk transaction. No help.
It appears even if there is almost no load on server.
Session stored in files.
Put sessions on ramdrive (tmpfs). No help.
There are around couple hundreds session files in directory. So there shouldn't be lookup problem.
Sometimes the same issue occurs on include/require, php takes seconds to load file before starting it processing. So it is some io issue. atop/top hasn't shown anything abnormal while session start process hangs.
free -m output during hang
total used free shared buffers cached
Mem: 32101 23485 8616 0 1532 15642
-/+ buffers/cache: 6310 25790
Swap: 16383 1222 15160
free -m output normal
total used free shared buffers cached
Mem: 32101 23438 8662 0 1532 15623
-/+ buffers/cache: 6281 25819
Swap: 16383 1222 15160
nginx write this in log in time of slowdown
2015/09/29 15:40:36 [warn] 16854#0: *14779 an upstream response is buffered to a temporary file /var/cache/nginx/proxy_temp/1/02/0000000021 while reading upstream
tried setting proxy_max_temp_file_size but with no help.
May be anyone knows what could be the reason, or in this direction to dig