Measuring resources for a MySQL server on Linux

by Giuseppe Maxia

Sometimes my customers (especially the ones who are used to different database servers,) ask me about the CPU and memory consumption of a MySQL server process.

Initially I thought that this kind of requests were rather odd, mostly because the whole box was dedicated to the database, thus measuring the global usage of CPU and memory could give a rough estimate of how well the database server is performing.

With time, I came to appreciate the request, and I started digging into the operating system intricacies to find out as much as I could about the resources used by a single process. This information can be useful if there are different services running in the same machine, and it could be of paramount importance to find out if your DBMS process can exceed the operating system resources.



My measurements are referred to the GNU/Linux operating system. Other systems have different ways of gathering the same data.


5 Comments

anjan bacchu
2006-07-06 08:28:03
hi there,


nice post. thank you. i needed this info.


some comments.


1) the ps command you listed does NOT work on my box -- it just throws up the following error message
"ERROR: Improper list."
Is there a way to turn them ON ?


2) The book would be useful. I will try to get it for our group.


windows : is there a better way to do it on Windows ?


thank you,


BR,
~A

anjan bacchu
2006-07-06 08:44:39
hi there,


PS : I removed the spaces that I added and worked like a charm.


Thank you,


BR,
~A

anjan bacchu
2006-07-06 08:49:42
HI O'REILLY SITES,


Can you implement print specific page for the blog posts. This was more an article than a blog post.


BR,
~A

Giuseppe Maxia
2006-07-06 08:55:44
Hi Anjan,
Please check the docs for your version of ps.
I can only say that this tools works on a wide range of Linux distributions. I checked it in the following:



  • Red Hat Advanced server 2.1

  • Red Hat Advanced server 3.0

  • Red Hat Advanced server 4.0

  • Red Hat 9

  • Debian 3.1

  • Kubuntu 6.0

  • SUSE 10.0


As you see, it ranges from the very old to the shining new. Your ps should give you the information you need, even with a different syntax. If that's the case, you could make an alias or a script that accepts the syntax used in mysqlresources.


Cheers
Giuseppe

Sheeri
2006-07-11 13:15:31
Giuseppe,


What a coincidence! I've been doing some capacity planning with MySQL, using some shell status variables as well as MySQL variables. Look for a post soon....