-1

I have a problem with my server, which hosts several sites with circa 400 concurrent visits at peak time.
The problem is that every few hours the load of the server gets very high for a minute or so, and then it will get back to normal again; this load peak makes my sites really slow to reach or not reachable at all. This is the output of top during a high load spell:

Server top output

I also noticed that sometimes this high load not related to the peak time. I also tried to tune the MYSQL but nothing changed.

My sever details:
Processor 1x Intel Quad-Core Xeon X3440 [ 4 Core(s) ]
RAM 16 GB

Ali Coder
  • 21
  • 2
  • Possible duplicate of [Can you help me with my capacity planning?](http://serverfault.com/questions/384686/can-you-help-me-with-my-capacity-planning) – yagmoth555 Feb 15 '17 at 21:15
  • It can be some mysql query that take too much load, but sadly it's really too broad to answer, I v-t-c, but you could check this question too to find the problem; http://serverfault.com/questions/350454/how-do-you-do-load-testing-and-capacity-planning-for-web-sites – yagmoth555 Feb 15 '17 at 21:17
  • I will also agree that this looks like a mysql server abuse. It looks like at peak time mysql server receives a big query queue it struggles to cope with. Probably your best first solution is to try and optimize your queries. A very possible suspect is looped queries in your code. Also you can turn on mysql query log to monitor the problem as it happens (performance killer - remember to switch it back off). – Louis Papaloizou Feb 15 '17 at 21:34
  • @LouisPapaloizou Can please you tell me how to turn on mysql query log to monitor the problem ? – Ali Coder Feb 15 '17 at 21:37
  • You need to edit your mysql configuration file (for ubuntu it's /etc/mysql/my.cnf) and uncomment the lines lines wich start wih **general_log_file** and **general_log**. As you will notice the default location is **/var/log/mysql/mysql.log**. If you also do a **tail -f /var/log/mysql/mysql.log** you will be able to monitor query execution in real time to try and trace what's going on. – Louis Papaloizou Feb 15 '17 at 21:41
  • @LouisPapaloizou I looked into mysqld.log to see what happens till now but I didn't see any thing happen. – Ali Coder Feb 16 '17 at 16:36

1 Answers1

0

Sorry, but everyone is going to vote to close this. In order to identify where the problem (likely) lies a competent analyst would need megabytes of log files, not a screenshot of 'top'. Describing the right questions to ask would fill a small book.

I would recommend using the slow query log (with a long query time of 0) as preferable to using the general log for analyzing performance problems, but a high load in combination with slow performance tends to point the finger elsewhere than the dbms.

symcbean
  • 19,931
  • 1
  • 29
  • 49