Bad session handling can lead to performance issues

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

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:

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.

Spread the love

Leave a Reply

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