Re: sessions - max number of variables before things get bad?
| From: | Richard Lynch | Date: | Wed, 31 Jan 2001 01:55:14 +0000 |
| Subject: | Re: sessions - max number of variables before things get bad? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-37388@lists.php.net to get a copy of this message | ||
>I'm exploring sessions in PHP4 as I build a new site, and I have decided to
rely on them more heavily than in the past.
>
>Basically, I'd like to set things up so that when someone logs into the
site, all of their accounts variables are queried from a >database and
loaded into session variables (we're talking about 50 variables, most just
1-3 words). Does this sound >reasonable for a relatively high traffic site?
If I don't do this, then many of those variables will probably be queried
from a >database more than once during a visit, which seems unnecessary when
I can use session variables.
>
>Are there any guidelines on the performance penalty for using large numbers
of session variables? Or is the affect so minute >that I really shouldn't
worry about it? (especially compared to querying a database)
You'll have to experiment to be sure cuz it depends a lot on your
web/database server setup and, but I don't think 50 vars of a few words each
is even close to excessive. That's just a "gut" reaction, though.
Check out the http://php.net/set_session_save_handler function
for the
easiest description of how to integrate PHP sessions with your database.
--
Visit the Zend Store at http://www.zend.com/store/
Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm