Re: Fw: [PHP] Custom database session handler and data concurrent access from ajax request
| From: | Richard Lynch | Date: | Thu, 03 May 2007 16:59:01 +0000 |
| Subject: | Re: Fw: [PHP] Custom database session handler and data concurrent access from ajax request | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-254359@lists.php.net to get a copy of this message | ||
On Thu, May 3, 2007 11:24 am, Nicolas Quirin wrote:
>> current session. Semaphore is created if not existent, semaphore is
>> acquired if free, blocking if process must wait for this ressource.
>>
>> From my first tests of it, less error occured...
less, or none?
If it's not "none" there is something wrong with the semaphore
implementation...
>> But having a semaphore by safe object stored in the current session
>> is
>> cost memory issue: a created semaphore must have a time to live
>> equal to
>> the life time of the current session since i could'nt know which
>> script is
>> executed before another and which script could remove the
>> semaphore...
>>
>> So semaphore are removed by session garbage collector. :-s.
...
[and I repeat myself]
>>> So you want to MINIMIZE your session writing section of code, call
>>> session_write_close at the end of it, and do that as soon as
>>> possible
>>> at the tip-top of the script, to make the serial-ness of the
>>> scripts
>>> as low-impact as possible.
So, no, you probably don't want to have a semaphore living for the
entire length of the script.
>>> Also re-consider if you really really need to cram as much "stuff"
>>> into a session as you originally architected. Often-times I've
>>> seen
>>> folks putting an awful lot of stuff in session data, and they don't
>>> NEED to, it was just "convenient" -- Once you start down the AJAX
>>> road, it seems to me like you want to re-think that "convenience"
>>> and
>>> go for minimalism of what you write into a session. But I ain't
>>> been
>>> down that road, so maybe I'm full of it. :-)
And you may want to minimize your session usage, as I said.
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?