php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #19335 Garbage collection performance issue. gc_probability should be float not int
Submitted: 2002-09-10 09:47 UTC Modified: 2002-10-03 17:45 UTC
From: tomek at allegro dot pl Assigned:
Status: Closed Package: Session related
PHP Version: 4.2.2 OS: FreeBSD 4.5
Private report: No CVE-ID: None
 [2002-09-10 09:47 UTC] tomek at allegro dot pl
We're running a rather large PHP site (97 million pageviews in August). We try to minimize the number of open sessions by using session_start only if required. However we still have ~25,000 open sessions peak. With gc_probability set to 1, our server dies.

Currently I solved it by setting gc_probability to 0 and running find -amin +10 -delete from cron, however it would be nice if gc_probability could have a float value (say 0.1 or 0.01).

Regards,
Tomek

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-09-10 09:58 UTC] tomek at allegro dot pl
To clarify a bit:
The server dies because of slow operations on directories with large amounts of files. If garbage collection is started by every 100th Hit (which means often in highly trafficked websites), load jumps to 100s...
 [2002-09-10 10:39 UTC] sniper@php.net
Have you thought of using some other session.save_handler than files? For example shared memory? (--with-mm)


 [2002-09-10 14:54 UTC] tomek at allegro dot pl
Thank you for the tip. It solves my problem.

However I think using shm would be problematic when running on multiple hosts using mod_backhand - I think session files over NFS are the only way to go then, so maybe this change would be useful.
 [2002-09-10 14:58 UTC] derick@php.net
closing then. You might also want to try msession for this:
http://www.php.net/manual/en/ref.msession.php
http://www.mohawksoft.com/phoenix/msession.html

Derick
 [2002-10-03 17:45 UTC] sas@php.net
An additional note -- I've been aware of this performance issue for a long time and usually simply relied on find|xargs rm.

However, PHP 4.3 and later support session.gc_dividend now which lets you define arbitrary probabilities for kicking of the GC process.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon Dec 08 08:00:01 2025 UTC