Re: Sessions
| From: | Dan Joseph | Date: | Mon, 15 Sep 2008 17:31:17 +0000 |
| Subject: | Re: Sessions | ||
| References: | 1 2 3 4 5 6 7 8 9 10 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-280203@lists.php.net to get a copy of this message | ||
On Mon, Sep 15, 2008 at 1:27 PM, Stut <stuttle@gmail.com> wrote:
> On 15 Sep 2008, at 18:10, Dan Joseph wrote:
>
>>
>>
>> Stut, something I noticed you do is run the GC 10% of the time. I am
>> currently running mine with the session.gc_probability = 50. Do you find
>> that 10% is enough? Or was that really just for example?
>>
>
> It's really just an example, and it's worth noting that your custom session
> handler doesn't need to call the GC explicitly at all since the session
> extension will do it for you.
>
> The history behind this code is that it was designed for a high traffic
> site with a high repeat visitor ratio. The 10% of the time was actually 0.1%
> on the site when it launched and it worked really well, but it was a very
> specific set of circumstances. At 10% the DB was spending most of its time
> cleaning up the session table. I should also probably say that I removed a
> large chunk of code before posting it (which lead to the errors Jim
> spotted). It was doing analysis on the sessions before deciding which to
> clean up, based mainly on the activity level of each user. But like I said,
> this was a very specific set of circumstances.
>
> A lot will depend on the performance of your database, how often visitors
> come back, what your desired session lifetime is and a number of other
> factors - every site is different. I've found 10% to work well for smaller
> sites but it really is a balancing act that can only be mastered through
> trial and error.
>
> -Stut
>
> --
> http://stut.net/
>
Ah ok. That's good information. I'm not sure how active the system I just
built is truly going to be. We're growing, they're focusing more on it,
etc. I will keep that busy site you talked about in mind though. My 50% is
probably way high.
--
-Dan Joseph
www.canishosting.com - Plans start @ $1.99/month.
"Build a man a fire, and he will be warm for the rest of the day.
Light a man on fire, and will be warm for the rest of his life."