Re: Sessio variables and Load Balancing

From: Date: Tue, 04 Jul 2000 23:14:32 +0000
Subject: Re: Sessio variables and Load Balancing
References: 1 2 3 4 5 6 7  Groups: php.dev 
Request: Send a blank email to php-dev+get-23513@lists.php.net to get a copy of this message
> Chris Adams wrote: > > The session read handler should be called once at the start of the page and > > the write handler once at the end. With a decent session handler, it's 2 > > queries per page (SELECT,UPDATE), with an additional INSERT when the session > > is first created and a DELETE when session_destroy() is called. > > Plus, these queries are with a constant against a unique index, zero > joins, which is the fastest query against a database you can have. > This is actually much faster than any file access, especially when > gc runs. I have much anecdotal evidence for this from PHPLIB users. Oh, and don't forget to declare the table as TYPE=HEAP. That means all of the data for that table will only be stored in memory (and very fast), but I think that if your database server goes down you have bigger problems than people having to login a second time. This works beautifully for things like a local cache as well - I use one for things like XML loaded from other sites and data structures that take awhile to generate; the worst case is that everything in the cache is lost and it must be reload on the next access. More than acceptable. On my not-very-tuned NT PII350, a table created with TYPE=HEAP and DELAY_KEY_WRITE=1 will see nearly a thousand SELECT, INSERT or UPDATE operations a second. Presumably a dedicated server tuned for MySQL performance would be able to increase this substantially. In my case, particularly with that caching package I developed, the time spent asking MySQL to retrieve something versus loading it over the network or regenerating it is something like 3-8 orders of magnitude.

« previous php.dev (#23513) next »