Re: [Phplib-users] Sessions in text files
Brought to you by:
nhruby,
richardarcher
From: Hristo O. <od...@gm...> - 2004-12-06 11:51:53
|
Hi guys, First thanks for the competent replies. >With a heavily used application, you are most likely going to see a slowdown >in using native PHP4 sessions due to the disk I/O. How often are you seeing >a corrupted active_sessions table? (In the last 6 years, I've only seen a >corrupted active_sessions table once.) You could set a cron job to check the >table and repair it if there are problems, or if you have a short period of >no activity (early Sunday morning almost always works for me) you could drop >and rebuild the table daily or weekly. If I say that the table is constantly in some inconsistent state, I will not lie you. When I run a repair, I stop the webserver and mysql. Then run a myisamchk -r. The table is ok although a lot of the sessions are lost due to the repair. After starting the mysql and the apache and waiting for 5 min., the table is again reported "corrupted but usable". I gave up using myisamchk -c as it is reported unsafe while running mysql. So the table seems to get corrupted immediately after starting to write in it. I guess size dosn't play a role here. My last experience was that the last time I did a repair I got a 11MB table (before repair - 233MB). As you see that is really a problem. And if I don't do anything the table grows to 2Gb which is really an overkill for mysql. But that was just some background info. Why do you think that the I/O will become a problem? Could you give me some reasoning? I guess that the size of the sessions will not be so big as it is in the DB. At current its extreme size is mostly due to the corrupted data. On Fri, 03 Dec 2004 09:12:41 -0700, Nathaniel Price <np...@te...> wrote: > Hristo Odiseev wrote: > > > > >Hi everybody, > >I have trouble with phplib because it is writing its sessions in a > >mysql DB. It happens quite often that my active_sessions table is > >corrupted or inconsistent in some way. I would like to use PHP's > >session mechanism and even prefer its default setting of writing > >sessions in txt files somewhere. Did anyone make such a conversion and > >if yes could you give me some hints. An example will be greatly > >appreciated. > > > >As to the DB corruption, I can only say that my application is heavily > >used and my session data is quite big sometimes. The active_session > >table is usually 500+MB. > >May be the smoothest way would be to wrap PHP's functionality using > >PHPLIB's function so that such a conversion is less painful. > > > > > This has been part of PHPlib for some time. Make sure you have the > latest distribution of PHPlib and use prepend.php to include PHPlib > instead of prepend.php3. The prepend.php file includes classes designed > to work with PHP4 sessions (namely local4.inc, page4.inc, session4.inc, > auth4.inc, and user4.inc). Their default configuration uses native PHP > sessions, though it provides some hooks to make sessions work like > PHPlib sessions, so you should have few problems porting an application > over from one to another. Also, if you have customized your local.inc or > prepend.php3, make sure you port those customizations over to local4.inc > and prepend.php. Be aware, however, that you will lose any existing > session data. (User data, if you use it, should be unaffected; it will > still use the active_sessions table for that.) Thanks for that! I should say that my phplib version is not the latest one (found 2001/01/19 in the files that were obviously not changed). These changes won't be easy because the programming practices were not always the best ones. > > I'd point you to the relevant documentation, but the website appears to > be down at the moment. > > -- > ___________________________ > Nathaniel Price > http://www.tesserportal.net > Webmaster > > |