1

My website is randomly very slow by high MYSQL CPU, and I have no idea what the problem is. Hopefully I will come closer to the solution with this post.

If I check the mysql processes, I see a lot of open sleep commands when the website is slow. When there are none open sleep commands, there is no problem. So probably the problem lies there.

Screenshot 1

Curiously, this problem only happens sometimes. Sometimes I have no problems for 4 weeks, now the website is already 3 days in a row slow.

I already set the time_out mysql settings to 30 secs, but that does not help to solve the problem. So now I try to figure out what the problem is. Here are the alert status variables. Perhaps that gives some extra insights.

Screnshot 2

Could it be spambots/brute-force attacks?
Heavy/slow query's in the website? Bad server settings? Sql injections?

Other things that this problem can cause? What is the best way to tackle this problem now? Sending any direction will already help.

  • I would tend to think that the "sleeping" connections are part of a connection pool. Do you only see all those sleeping connections when the website is slow? Gathering some baselines when the site is performing well will help you tell what is and isn't normal. – RDFozz May 1 '17 at 15:04
-1

IMHO,reason can be one of the following

i) Inline query :It is prone to sql injection attack.but not necessarily website will be slow.It is Advisable to use parameterise proc.

ii) Unpotimize query : Yes.shortlist those page and related query/proc.

iii) CSRF Attack : your pages can be attack by malware or web crawler.There are various way to overcome it,one of them is Captcha, but not always.google it.

iv) Network/server configuration :this should point i).check with your admin.

v) check for infinite and uncessary loop in pages.Infact identiyfy pages which are slow then examine both code and query.

| improve this answer | |
  • is my answer really so poor ?can any one give reason ?@Ernst has himself mention about spambots/brute-force attacks/Sql injection?And i have replied on same line.Can you down vote without giving proper explanation ? – KumarHarsh May 1 '17 at 13:42
  • It was the Network/server configuration. – Ernst Wemmers May 2 '17 at 10:51
  • @ErnstWemmers , Good that it is network problem.But few point you hv urself guess like spambots/brute-force attacks ,Sql injections? are very important .So in case those thing r found then plug in.Also in case of .net code ,due to bad coding garbage collector fire very quickly. – KumarHarsh May 2 '17 at 10:56

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.