Re: A no brainer...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, October 14, 2006 5:57 pm, Ed Lazor wrote:
>
> On Oct 14, 2006, at 10:00 AM, Tony Di Croce wrote:
>
>> I think that the cost of de-serializing a session stored in files
>> should be significantly LESS than the cost of doing so through a
>> database, for the following reasons:
>>
>> 1) The db will need to parse querys. Not an issue for files.
>> 2) The session ID will tell PHP what file to open in O(1).
>> 3) The entire session needs to be de-serialized, not just some
>> portion of it. The database is optimized for returning subsets of
>> all the data.

As has been noted already, no blanket statement about peformance
should be blindly accepted -- Your hardware, your network, your app
framework (or lack thereof), your schema, etc. all affect that.

Not to mention any kind of fancy cache your DB might have going to
optimize queries versus your hard disk cache and how much data is
moving from A to B.

Almost ALL of this is moot for any but the hardest-hit sites -- So
choosing your session store based solely on performance for a boutique
store is just plain silly.

The de-serialization is also a red herring.  The data is serialized
independent of the storage mechanism.

Or, if ALL your data is scalar and needs no serialization, it looks
like you could NOT serialize/deserialize it and avoid the overhead, at
least in recent versions.  Might require changing PHP source in older
versions, but it's never been "impossible" :-)  Never tried this, but
it looks very do-able (and trivial) and could be fun.

You *might* even be able to write a custom serializer for your
specific data structures as a custom extension and significantly
improve on PHP's generalized approach.  Or not.  I dunno.  Try it and
see.

I suspect that serialization overhead is trivial for scalar data, and
only starts to kill you when one starts schlepping bloated OOP
structures or arrays back and forth -- at which point you messed up
your architecture, and the serialization performance is just a
symptom, not the disease.

YMMV

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux