Re: [PHP-DB] Sessions Vs DB Access
Quick hack for those who think that the MM handler is not stable is to use the standard handler and the directory where the session files will be to be mounted as tmpfs (even /tmp). This will give almost of the MM's speed without worrying whether MM is stable or not. Andrey - Original Message - From: "Mika Tuupola" <[EMAIL PROTECTED]> To: "Peter Beckman" <[EMAIL PROTECTED]> Cc: "Dave Smith" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Monday, November 25, 2002 11:30 AM Subject: Re: [PHP-DB] Sessions Vs DB Access > On Sun, 24 Nov 2002, Peter Beckman wrote: > > > 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. > > Well it depends. On Solaris /tmp/ is tmpfs which is memory > based filesystem so it will essentially have speed of a > ram disk. > > -- > Mika Tuupola http://www.appelsiini.net/~tuupola/ > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Sessions Vs DB Access
On Sun, 24 Nov 2002, Peter Beckman wrote: > 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. Well it depends. On Solaris /tmp/ is tmpfs which is memory based filesystem so it will essentially have speed of a ram disk. -- Mika Tuupola http://www.appelsiini.net/~tuupola/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Sessions Vs DB Access
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! Peter 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 (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > --- Peter Beckman Internet Guy [EMAIL PROTECTED] http://www.purplecow.com/ --- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Sessions Vs DB Access
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 (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Sessions Vs DB Access
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 (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php