note 93670 deleted from function.session-start by danbrown
| From: | danbrown@php.net | Date: | Tue, 22 Sep 2009 14:42:20 +0000 |
| Subject: | note 93670 deleted from function.session-start by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-160931@lists.php.net to get a copy of this message | ||
Note Submitter: Charlie at NOSPAM dot example dot com
----
As noted before, if you have multiple concurrent requests from same session, they will serialize
based upon session_start()-end of script--unless you call session_write_close.
Practically speaking this is not usually an issue and using a single global lock over all session
use in a script is arguably the simplest effective mechanism. But be warned that depending on end
of script to close the session *will serialize concurrent session requests*. Background "data
retrieval" (e.g. AJAX or amfphp/Flex) can fall into this trap easily.
Holding the session_write_close until after an expensive operation is likewise problematic.
To minimize effects, call session_write_close (aka session_commit) as early as practical (e.g.
without introducing race conditions) -- often this possible quite early in the script or otherwise
avoid the serialization bottleneck.