Re: session_start is slow occasionally
| From: | Chris | Date: | Fri, 05 Oct 2007 03:03:58 +0000 |
| Subject: | Re: session_start is slow occasionally | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-262781@lists.php.net to get a copy of this message | ||
al jo wrote:
Hi i have a site that is relatively high loaded (~200000 reloads/sec) and i am trying to optimize it. So i have started timing sections of the php scripts to find out which is the slowest so i optimize it first. I write the times to a database( timings are done on the live server). So now when a user reloads the page (timings are set on only one of the pages) i write to the database how long it took and how long different sections take. That way i noticed thar occasionally that page takes extremely long to generate (there are occasions of > 300sec), but generally it takes between 0.05 and 0.2 sec to generate. I started moving the sections to determine where the problem lies and it turned out that these three lines take that long from time to time: ini_set("session.gc_maxlifetime", "2400"); session_name('xxxxx'); session_start(); I measured each of them and seems that session_start is the problem(had a few ~11 sec loads, but not something this big yet, of which ~10.5 is taking session_start) Does anyone know what is going on? Sessions are stored in /tmp/sessions/ which is 100MB ram drive and at the moment when this occurs it was ~68% used with ~12000 files in it.My suggestion is check the php source for what session_start does. Maybe it scans the directory to make sure it's going to generate a unique id and even though it's on a ram drive it's taking a while because of the number of files already there. That's just a completely wild guess though ;) -- Postgresql & php tutorials http://www.designmagick.com/