Date: 10/02/00
- Next message: Maurice Jumelet: "Re: [phplib] Garbage Collection/Sessions"
- Previous message: Josh Sisk: "[phplib] Garbage Collection/Sessions"
- In reply to: Josh Sisk: "[phplib] Garbage Collection/Sessions"
- Next in thread: Maurice Jumelet: "Re: [phplib] Garbage Collection/Sessions"
- Reply: Maurice Jumelet: "Re: [phplib] Garbage Collection/Sessions"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
> I'm running a site with Phplib and MySQL. I have garbage collection
> probability set to 2 and and time set to 40 minutes. I also have my
> $lifetime set to 40.
>
> I've noticed that some sessions seem to avoid being deleted by garbage
> collection. It's not _that_ many, but it adds up over a period of a week
or
> two. (We're talking maybe a hundred or two a day on a site that gets 4000+
> visits a day). The only way to remove them is to manually delete them. I
was
> wondering if anyone has had a similar occurance and knows a) why this is
> happening b) is it a serious problem if there are older sessions in the db
> and c) how to prevent it?
I have the same thing. I've seen the active_sessions table get up in the
20,000's, even though most were old. I'm set for 2 hour collection with a
1% probability.
The proper way to clean it out, especially for a large site, is to write a
[gasp] Perl script that runs as a cron job every 15 or 30 minutes. It'll
only be a few lines. Actually, you can do it with a single MySQL statement,
but it will differ for other RDBMS products since the date functions tend to
differ among them.
The *proper* way to do it under Oracle, Sybase, Informix, or any other db
that has stored procedure functionality is to do it via a stored procedure.
Most of the sessioning interface to those db's should be stored procedures &
views, anyway. It would then be a matter of running a stored procedure from
a cron job periodically.
The point of this whole post, if there can be one, is that garbage
collection should take place outside the context of page generation.
Michael
-- Michael Darrin Chaney mdchaney <email protected> http://www.michaelchaney.com--------------------------------------------------------------------- To unsubscribe, e-mail: phplib-unsubscribe <email protected> For additional commands, e-mail: phplib-help <email protected>
- Next message: Maurice Jumelet: "Re: [phplib] Garbage Collection/Sessions"
- Previous message: Josh Sisk: "[phplib] Garbage Collection/Sessions"
- In reply to: Josh Sisk: "[phplib] Garbage Collection/Sessions"
- Next in thread: Maurice Jumelet: "Re: [phplib] Garbage Collection/Sessions"
- Reply: Maurice Jumelet: "Re: [phplib] Garbage Collection/Sessions"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

