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.
YorkDataAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

gr8gonzoConsultantCommented:
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.
0
YorkDataAuthor Commented:
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.
0
gr8gonzoConsultantCommented:
That sounds strange. I'm not sure why IIS wouldn't clean up session files automatically. I'm assuming that those 2 million sessions also included very old sessions (session files that were last modified over a day ago, for example)?

I would check out this page and pay attention to the session configuration section at the bottom:
http://www.iis.net/learn/application-frameworks/install-and-configure-php-on-iis/install-and-configure-php

Also, if you're not using the FastCGI approach mentioned in that same guide, it's worth checking out. Not only is it faster (performance-wise), but it separates out PHP to its own process, which can be much easier to debug than trying to monitor what IIS does.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

YorkDataAuthor Commented:
We are using FastCGI.. I've ended up running a script on the Temp folder to clean up the session files every day. Thanks for your help.

Script below
forfiles /P C:\Windows\Temp\ /S /M sess* /D -4 /C "cmd /c del @PATH"
0
gr8gonzoConsultantCommented:
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.
0
YorkDataAuthor Commented:
my solution also resolved the issue.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft IIS Web Server

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.