Bad session handling can lead to performance issues

The reason is shortly explained in the PHP documentation for session_start() function here:

http://php.net/manual/en/function.session-start.php#110649

Furthermore, you can read about it in the session_write_close() function reference page.

How we found this? We had slow loading of some admin pages (Plugins, All Pages) in WordPress and every time P3 Profiler was pointing to a different plugin, but never the real source of the problem. After enabling slow execution log in PHP-FPM, we found out it was exactly session-start, combined with some ajax calls.

Note: have in mind that too many session_start() calls can lead to too many cookies being generated:

https://bugs.php.net/bug.php?id=31455

This was marked as “won’t fix”, probably fixed at some of the currently used PHP versions but I’m still not aware if this is true.

Leave a comment

Your email address will not be published. Required fields are marked *