Re: Session Vars and Performance

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

 



On 16 Feb 2005 Richard Lynch wrote:

> Use the exact same session stuff you have now and just dump the
> serialized data into SQL using the 5 functions for session handling. 

Oh, OK, that's what you meant about the 5 functions.  I am not sure of 
the advantage to that, actually something I've always wondered.  
Especially if I am serializing the data anyway -- the way I see it is 
as follows (we are in the realm of theorizing here):  Serializing is 
serializing, likely just as fast whether using the built-in session 
mechanism or a replacement, or even serializing it myself, I'm sure it 
all goes through the same underlying routine.  Writing and reading a 
single flat data record like this through MySQL has to be slower than 
using a flat file, unless PHP flat file access is somehow drastically 
slower than it should be.  Ergo, I'm likely to lose, not gain, by using 
MySQL.  (So why did I ask the original question?  Because I hadn't 
analyzed it this carefully first!)

> It's literally an hour's work to alter the code to use MySQL to store the
> sessions instead of the hard drive.
> 
> This might or might not improve performance.

As mentioned above -- under what circumstances would it improve?  
Perhaps if file open is an expensive operation and the database is 
already open.  But it's hard to think of where one would expect the SQL 
access to be faster.

> It's incredibly UNLIKELY that trying to send an SQL query for every single
> line of code that currently does $_SESSION[...] = ...; is going to be
> faster... I'd almost be willing to say IMPOSSIBLE that would be faster,
> but somebody would post a trivial example to prove me wrong :-)

Totally agree.

> But you'd probably find it easier to write a C extension and
> re-compile PHP to pre-load all the stuff. 
> 
> None of which applies to you, I don't think, but you may want to
> re-read that thread. 

Well when I am not doing PHP programming I do C and C++ programming so 
I could conceivably do that, but have no desire to -- and my client  
certainly wouldn't want to pay for it!

--
Tom

-- 
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