Did you know that session_start() is a blocking call in PHP? I didn’t and it has some importance to know:
Now I didn’t know it but is seems that php’s session handling is blocking on a per request basis. Kinda makes sense if you think about it, that if two requests simultaneously try and change a session variable then you would get constancy issues. So php handles this by making session_start a blocking action and will wait for any other request to either finish or close the session using session_write_close.
So if you have a web application or website with a lot of concurrent calls for the same user having the same session, you could run into trouble. On of the easiest fixes is to only start your session when you need it and close it as soon as possible if you are done with the session.
I never thought about session_start() being blocking and I guess neither did you, but it could have serious performance implications when you are for example serving images built by PHP. Something to consider in your next project!
via session_start blocking in php | Tomrawciffe.co.uk
We built GroundControl to execute the ideas in this article. It puts our way of working, portfolio management, and innovation accounting in one place where innovation managers and corporate startups work seamlessly together. See How GroundControl Works.