Re: Session Vars and Performance

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

 



trlists@xxxxxxxxxx wrote:
> 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!)

Except that your MySQL buffers and caches may well be larger than, or
under-utilized when compared to, your already over-stressed file buffer in
the Operating System.

Sure the data all ends up being written by MySQL sooner or later, and
there's definitely more overhead with MySQL than with the file OS system.

*BUT* there are simply too many variables in buffers, caches, and OS
utilization for you to predict what's faster.

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

When the file system is already getting hammered, but MySQL is
"under-utilized" for the amount of RAM/cache/buffer space you've given it.

And we can safely assume MySQL has the file already opened up and ready
after your first request, so the file open, which *IS* expensive, will not
be there.

But you've got the MySQL overhead that is inherent to a connection.

But...

We could play this theoretical game all day.

Or you could spend an hour and TEST IT.

[shrug]

-- 
Like Music?
http://l-i-e.com/artists.htm

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