Mysqld Taking alot of memory
I have an issue with mysql taking upto 200% cpu. I have tried to upgrade my linode package 3x but the issues persisit.
Anyone who can give me a clue to resolve it , I will appreciate very much.
Thanks.
2 Replies
If you're going by the graphs in the Linode Dashboard, each 100% represents one core. So if you're using say, a 4-core Linode plan, 200% usage on that graph really means you're only using half of what's allotted to your plan.
When diagnosing performance issues the first step is to make an observation. You've already done that and you've observed heavy CPU utilization. The next step is locating the root cause. Things to consider here are …
- What is the growth pattern for transactions e.g. the number of queries being run. Has this been steadily increasing? Did it increase a lot all of the sudden?
- Have there been any changes to which queries are executed the most?
- Has the datasets your queries work against seen any changes? Does a table now have 10x as many rows as it had a month ago?
- Do you have a query that is poorly optimized? Does it join millions of rows? execute loads of full table scans?
The key here is visibility. The gold standard is Percona, but that can be pricey. If you don't have the budget you can definitely get some mileage out of tools like mtop
Once you know what's causing your problem then you can weigh your options to fix it.
- Do you introduce replication to spread the load across multiple linodes?
- Do you break some queries apart and wire them together with application logic?
- Do you add additional indices?
- Do you do all of these things?