Link to home
Start Free TrialLog in
Avatar of YorkData
YorkData

asked on

IIS Web Server PHP slow load times - cookie related

We currently have a pair of IIS servers using NLB to load balance web requests. We are currently having an issue with one of the servers where it takes a long time on the first visit for the time to first byte. On a repeat visit the load time loads within a normal time.

We have narrowed it down creating the session cookie. If we remove the cookie from the browser the web page takes a long time to load, but when the cookie is already there the page loads normally.

Thanks in advance
Oliver.
Avatar of gr8gonzo
gr8gonzo
Flag of United States of America image

I would use process monitor (free Technet tool from Microsoft) and run it on the server that's having the problems. Start capturing, then replicate the problem and stop capturing. Filter the results down to the IIS/PHP process(es) and look for any issues related to the session data being written.

Also, check your php.ini file and find out where your session files are being stored. Then create a standalone PHP script that tries to create a new file in that same folder and see if it takes a long time to do so.
Avatar of YorkData
YorkData

ASKER

Ok so we have pinpointed it to the session files not being destroyed.. It ended up with 2million session files in folder which was fun to delete.

I've checked permisisons on both IIS servers and they are exactly the same, the files themselves have exactly the same permission also but I can see the session files are still not being removed.

Any clues? We run each website with its own user which is in the permissions of the file.

Thanks.
ASKER CERTIFIED SOLUTION
Avatar of gr8gonzo
gr8gonzo
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks. One side note - if you're using FastCGI, then it's likely running as its own process. If the user running that FastCGI process doesn't have full privileges to the temp folder where the sessions are stored, then it might be unable to remove those sessions. You really shouldn't have to manually clean up files.
my solution also resolved the issue.