Don't forget that you can use the DB to store PHP Sessions as well, which
is faster than storing the sessions in /tmp on the file system.  If you
have well written SQL, you can have 5-30 queries per page, most of which
should return the data in under 1/100 of a second.

I was running a site doing 150 queries per second, serving 1M page views a
day.  That's about 13M DB queries per day at a rate of about 11-12 page
views per second.  All on a dual 800mhz and 1gb of memory on FreeBSD,
Apache, PHP and MySQL.

It can be done!


On Sun, 24 Nov 2002, Dave Smith wrote:

> Chris,
> I'm assuming you're running this thing on *nix.
> Session variables are stored on the file system. PHP writes them out to
> /tmp, where it subsequently reads them upon request. The question is:
> How good at caching is your DB? If it can cache common select queries,
> then you are probably better using the DB (since file system caching is
> usually not that great). If your DB is busy with other things while the
> file system is relatively idle, maybe it'd be better to store them in
> sessions.
> The only real way to know is to benchmark both methods. You could come
> up with some real quick code that implements both methods. Then, run
> ApacheBench (ab) or JMeter to test the performance. Be sure that you run
> the benchmark utility in such a way to use the session vars (ie,
> simulate a user login). During the tests, watch things like load average
> (top) and I/O activity (iostat).
> Let us know which method works best for you. Scalability issues are so cool.
> --Dave
> Chris Payne wrote:
> > Hi there everyone,
> >
> > I have a system I am programming, and each page needs to get various config
> > elements from a DB, of course this means lots of DB access for each page.
> > What I was wondering is, after the user has logged in successfully it
> > currently stores their email, name, address and a few other bits of data in
> > a session, would it also be a good idea to store other information in a
> > session at the very start when they login to ease DB access?  Are there
> > problems with having lots of data in a session?  Well when I say lots of
> > data, I mean things like font size, color, table images, background colors,
> > some normal text etc .... nothing like an essay or anything, just about
> > 30-50 different variables.
> >
> > Just want to make sure it won't slow my system down by doing this, or would
> > it speed it up because of less DB access?
> >
> > Thanks for your help
> >
> > Regards
> >
> > Chris
> >
> >
> --
> PHP Database Mailing List (
> To unsubscribe, visit:

Peter Beckman                                                  Internet Guy
[EMAIL PROTECTED]                   

PHP Database Mailing List (
To unsubscribe, visit:

Reply via email to