session_start is slow occasionally
| From: | al jo | Date: | Thu, 04 Oct 2007 14:37:17 +0000 |
| Subject: | session_start is slow occasionally | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-262748@lists.php.net to get a copy of this message | ||
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.
And i have one more question. How does apache handle high loads? Does it suspend the php script when
there are no resources and resume it when it frees some, or it doesn't pick it up at all?
Thank you
---------------------------------
Pinpoint customers who are looking for what you sell.