patternsqlMinor
What are the potential causes for a sudden MySQL slowdown?
Viewed 0 times
thesuddenwhatareslowdownmysqlforpotentialcauses
Problem
A few days ago mysql became suddenly very slow with queries taking more than 10s to complete when they used to complete under 100ms... It lasted about an hour and then the speed was normal again. What could cause such a problem?
A few more information: The mysql version is 5.0.51a The mysql database is on a dedicated box with 1.5 GB ram. There was no swap being used when the mysql server was slow.
Here's the mysqlreport from the database http://pastebin.com/au6yMWqQ None of the caches are full..
I've noticed that the DNS server used by the server for resolving hostname was a bit slow sometimes lately. Could this have an impact?
Thanks,
I've crossposted this on serverfault, hope it's ok...
EDIT: Could I try to have a master master replication on ec2 to protect against the problem happening again? Half of the instances connecting to the mysql database are on ec2 (the rest directly from layeredtech)
A few more information: The mysql version is 5.0.51a The mysql database is on a dedicated box with 1.5 GB ram. There was no swap being used when the mysql server was slow.
Here's the mysqlreport from the database http://pastebin.com/au6yMWqQ None of the caches are full..
I've noticed that the DNS server used by the server for resolving hostname was a bit slow sometimes lately. Could this have an impact?
Thanks,
I've crossposted this on serverfault, hope it's ok...
EDIT: Could I try to have a master master replication on ec2 to protect against the problem happening again? Half of the instances connecting to the mysql database are on ec2 (the rest directly from layeredtech)
Solution
You could try the following to improve things
skip-host-cache and skip-name-resolve
Please follow these steps:
Step 01) Add the following to /etc/my.cnf
Step 02)
Step 03) Stop using mysql users that have DNS names. Run thus query:
Any user that has a DNS name, simply replace it with IP Address (such as 10.85.115.73) or a netblock (such as 10.85.115.%)
You may also want to run this command intermittently (say one an hour in a crontab)
Give it a Try !!!
skip-host-cache and skip-name-resolve
Please follow these steps:
Step 01) Add the following to /etc/my.cnf
[mysqld]
skip-host-cache
skip-name-resolveStep 02)
service mysql restartStep 03) Stop using mysql users that have DNS names. Run thus query:
SELECT user,host FROM mysql.user;Any user that has a DNS name, simply replace it with IP Address (such as 10.85.115.73) or a netblock (such as 10.85.115.%)
You may also want to run this command intermittently (say one an hour in a crontab)
FLUSH HOSTS;Give it a Try !!!
Code Snippets
[mysqld]
skip-host-cache
skip-name-resolveSELECT user,host FROM mysql.user;FLUSH HOSTS;Context
StackExchange Database Administrators Q#7120, answer score: 3
Revisions (0)
No revisions yet.