We have different PHP Apps, both in symfony 1.4 and symfony 2, and all of them, at some point, have requests where sfSessionStorage::initialize takes a very very long time.
I'm talking about several minutes to load. Take this newrelic trace for example:
Here you can see sfSessionStorage::initialize took 185 seconds. We've been debugging this for several days now, with no success so far. We've looked into GC settings, event tried mounting where the sessions are stored in the filesystem into a RamDisk, with no effect.
What could be the cause of this? Have you ever encontered the same problem? Any help is greatly appreciated, thanks!
strace may shed some light on what's going on.
Assuming you cannot reproduce the problem with cli, I would recommend to limit number of processes to 1 (MaxRequestWorkers for mod_php and max_children for php_fpm), attach strace to the process and check where it hangs.
For example in php_fpm case:
open /etc/php5/fpm/pool.d/www.conf
and ensure settings
pm = static
pm.max_children = 1
restart php_fpm and nginx
grep aux | php
to find out the process idsudo strace -p
followed by the process idIf it sticks for minutes with a single system call, you will clearly see the blocker right in the stdout of strace. If there is no single blocker, but rather a long loop of repeated system calls, you will probably need to log it to a file and analyse it later. E.g. sudo strace -p {pid} | tee /tmp/strace.log
.
If problem is not reproducible with single worker, try to increase number of workers, and capture strace for all processes.
Not sure this will help, but check.
If you handling session manually then you should make Sessions Turning Off, in frontend/config/factories.yml
all:
storage:
class: sfSessionStorage
param:
auto_start: false
You should see Deactivating the Unused Features for increasing performance.
Just another guess :
Sessions are dependent on files. So check your system is capable of making that many files open required for sessions. Or is there any issue for creating files.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With