ID: 29460 Comment by: magnusw at gmail dot com Reported By: kylewong at southa dot com Status: Open Bug Type: Session related Operating System: linux kernel 2.6.1 PHP Version: 4.3.8 New Comment:
I have been seeing a similar problem for quite some time now. No idea if it's related to sessions or not, but we use custom session handling with "session_set_save_handler" to store sessiondata in MySQL. To the point, I run a site taking about 10 hits/s. Our apache processes keeps growing and growing over time. I have to set up 4 graceful restarts per day in my crontab to keep it running. After a graceful restart several hundred megabytes are freed to the operating system. After that, the process starts over with a slowly growing httpd. We have maxclients around 100 which theoretically should leave my server with plenty of cache and buffermem. This happens with apache 1.3.29-1.3.31 and php 4.3.3-4.3.9 No other modules except standard apache-stuff and php4. Hope this info helps someone. Regards M Previous Comments: ------------------------------------------------------------------------ [2004-07-31 08:34:59] kylewong at southa dot com 30 minutes after delete all session data files while apache running. 5500 sessions online, 22M disk space taken by session files. average session file size around 1.5kb. http://www2.southa.com/~kylewong/top-8.gif ------------------------------------------------------------------------ [2004-07-31 08:14:22] kylewong at southa dot com httpd grow back to 10-12MB http://www2.southa.com/~kylewong/top-6.gif 2 minutes later after delete all session data while apache running: http://www2.southa.com/~kylewong/top-7.gif session.php: class GallerySession {} if (session_id()) { $useStdClass = 1; } /* Start a new session, or resume our current one */ @session_start(); $sessionVar = "fsess"; session_register($sessionVar); if (isset($$sessionVar)) { $gallery->session =& $$sessionVar; } else { /* Register the session variable */ session_register($sessionVar); /* Create a new session container */ if ($useStdClass) { $$sessionVar = new stdClass(); } else { $$sessionVar = new GallerySession(); } $gallery->session =& $$sessionVar; } ------------------------------------------------------------------------ [2004-07-31 06:53:02] kylewong at southa dot com more informations: apache fresh start without any session data: http://www2.southa.com/~kylewong/top-1.gif about 30 minutes later, httpd size grow around 1.5M http://www2.southa.com/~kylewong/top-2.gif 1 hour later from beginning, httpd size reach 10M, total session data size around 16M, average session file size around 2kb, around 4k sessions online. http://www2.southa.com/~kylewong/top-3.gif stop and restart apache without delete session data, most httpd size reach 10M immediately after apache start. http://www2.southa.com/~kylewong/top-4.gif stop, delete all session data, and restart apache. http://www2.southa.com/~kylewong/top-5.gif ------------------------------------------------------------------------ [2004-07-30 18:49:24] kylewong at southa dot com Description: ------------ apache 2.0.48, php 4.3.7, 4.3.8 session handler = file apache keepalive timeout = 1 apache maxclient = 192 apache mpm = prefork session timeout = 1500 session file storage: tmpfs problem: php doesn't free memory used by session. My website is a high traffic site, process around 1800k php pages per day. The server always has around 5000-10000 sessions (25 mminutes) online. Each session file take around 200 bytes to several Kb, total session data take around 20-30MB. I found that my average httpd process size grow slowly from average 8MB to 1x-2xMB (take around 1-2 hours), my server always has around 200 httpd running (keepalive timeout = 1), system resouce decrease while httpd take more and more memory. At fresh start without any session data stored, my system has around 400MB buffer and 800MB cache, httpd size average round 8MB. When httpd processes grow to around 15MB, the system has only around 300MB buffer and 300MB cache, of course, server performance drop a lot since my site is very disk intensive (load lots of informations from thousands of serialized objects) It seems that the httpd process doesn't release all used memory after finish processing a page. I found that if I delete all the session data files while apache running, httpd processes start free up memory and system buffer and cache start growing to normal (400MB, 800MB), but after some time, httpd start grow again and system resources used for buffer and cache start decrease. Also, I found that, when the average httpd process size are at says 20MB, even if I stop and restart apache, all httpd process size will startup at 20MB, and keep growing. That's mean, I can't free up memory used by httpd processes by kill and restart apache, I need to delete the session data files to free up resouces. Sorry about my bad english, wish that someone can help me in my situation, thanks a lot. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=29460&edit=1