You are here: Re: [PHP] Session Vars and Performance « PHP « IT news, forums, messages
Re: [PHP] Session Vars and Performance

Posted by Richard Lynch on 02/17/05 21:45

trlists@clayst.com 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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация