-2

I have a PHP website which uses $_SESSION variables. It runs on Apache, Mysql and Ubuntu 14.04 on a very resourceful server (Amazon EC2 - M3.X-large)

For some unknown reason, the website virtually grinds to a halt every so often, and I don't know why. When this occurs, very few people are visiting the website, and server load is very low. Restarting Apache & MySQL does nothing, however, after about an hour the website speed returns to normal. Restarting my entire server also temporarily fixes the problem, but after a few days the problem reoccurs.

My question is - what could be causing this problem, and what can I do to debug / fix it? Like I said - traffic is very low when the problem occurs so I don't think apache / php require more resources. I think the problem runs deeper. Could the amount of session data being saved be causing the issue?

Thanks in advance.

  • i doubt it's the amount of session data. while the problem is happening try to analyze what's going on. check the memory usage with top check the web logs for hits to particular scripts; check mysql with > show processlist; check your bandwidth by testing the web server from the local server vs remote, etc, hopefully you find the next clue, good luck. – user16081-JoeT Jan 6 '15 at 16:28
  • I think the downvotes here are responses to the "why" question, which is broad and impossible for us to answer from the information you provided. But "how can I debug" seems like a good question to me, and it should be the focus here. Title revised to reflect that. – Andrew Schulman Jan 6 '15 at 17:46
  • Ok fair enough. So Andrew - any ideas on how to de-bug?? – richelliot Jan 6 '15 at 17:48
  • Have you checked any logs at the time of the issue? @user16081-JoeT has given some information on how to debug, you could also look at using strace to get more information on what processes are doing at this time. I'll be happy to help more but you'll probably need to provide a little more information. – Chris Davidson Jan 6 '15 at 18:14
  • Yes, I have checked the logs but I can see anything that is giving me any clues. Looking at 'top' and 'apachetop' doesn't shed any light either. However, next time it occurs I will look at using 'strace' and check whats going on with bandwidth etc. Thanks for the tips guys. – richelliot Jan 7 '15 at 9:32
0

Another useful tool is iotop, although its possible that (since this is a VM) that its nothing on your system causing the slowdown but resource consumption on the virtualization host / storage. In addition to the tools already mentioned you might want to have a look at hprof and compare the profiles outside and during a performance incident.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.