Novembro, 16 2006
Quinta-feira
MySQL monitoring tools
In the last couple of weeks I've been feedling with MySQL, you know, that "not so serious database" as some people like to call it. ;-) I'm glad I did because I was not expecting that some days after, the server would be so hammered by a new feature in the portuguese version of Firefox 2. That particular site saw a 400% increment on it's daily none unique visits. Although that particular recuring request is cached, it can stress the database, and I'm not even mentioning some other couple of sites on the same server that are also growing it's daily visitors and use the same MySQL server, and share the same hard drive.
Anyway, I wanted to tweak MySQL because some weeks ago it was acting up on me, clogging all Apache processes, making them wait for it to respond. So i searched for some tools so i could monitor it, see what it was doing, when and why.
mytop - a life saver
I found about mytop some years ago but never got any use out of it because small sites don't even tickle a MySQL server and fast queries don't even showed up... till now.
I've been using mytop for the last couple of weeks and it's a life saver. Basicaly mytop is a console-based (non-gui) tool for monitoring the threads and overall performance of a MySQL just like top, the unix command line. It helped me understand exactly why MySQL was choking. mytop never got updated to handle MySQL 5, so if you are wondering why the command statistics aren't working, search the source code for she SHOW STATUS line and change it to this
Show me the graphs
Then I wanted some graphs. Sure, there's the awesome Cacti project with some nice monitoring templates (scrool down), but I wanted something simpler than Cacti (I've used it before).
For starters, there's a point and shoot graphing script here called mrtg-mysql-load. Brainless to install and obviousely it requires MRTG, wich probably everyone has allready installed. The output one gets is something like this...
![[image]](http://mowser.com/img?url=http%3A%2F%2Fblog.karlus.net%2Fmedia%2Fmrtg-mysql-load.png)
Searching around for some more detailed graphs I found MySQL Activity Report.
The MySQL Activity Report package is a tool to help MySQL database administrators to collect several database parameters and variables. These collected values can be used for server monitoring or performance tuning purposes.
The instalation is trickier than mrtg-mysql-load, it envolves a daemon, but the end result is far better. A demo can be seen here.
Basicaly, it gives you a connections graph, a questions (select,insert,update...) graphs and some others, but best of all, if you have the server running for some time it also gives you some server tunning tips like...
The table cache hit rate is 98 %, while 99 % of your table cache is in use.
You should raize your table_cache to improve your server's performance.
For example, the connections graph looks like this...
![[image]](http://mowser.com/img?url=http%3A%2F%2Fblog.karlus.net%2Fmedia%2Fmysqlard.png)
On a related note I found two other tools, one for Apache called ApacheTop (guess what) and another called htop (top on steroids).
What do you use ? Wanna share ? :-)
ps: Looking at the graphs, it seems like MySQL went balistic around 13:00
16 Novembro 2006 - 23:51
3 Comentário(s) Technorati links
16 Novembro 2006 - 00:48
5 Comentário(s) Technorati links
Tem 33 anos, é natural de Vila Nova de Famalicão mas mora no Porto desde que veio para a universidade... bem, morou. Agora já casado, está pela Maia. Anda pela internet há já uns 13 anos tendo trabalhado em vários projectos como foram o caso do Mail.pt ou no Sapo. Também conhecido como o responsável pelo ITJobs e o Destakes entre outras brincadeiras. De resto já bloga há uns 8 anos apesar de ter perdido parte da "vida" numa mudança de hosting provider. Algumas restias ainda por aí andam... ah, e o email de contacto está no footer.
Julho 2009 (2)
Junho 2009 (2)
Maio 2009 (10)
Abril 2009 (5)
Março 2009 (7)
Fevereiro 2009 (16)
Janeiro 2009 (15)
Dezembro 2008 (18)
Novembro 2008 (9)
Outubro 2008 (15)
Setembro 2008 (13)
Agosto 2008 (11)
Julho 2008 (17)
Junho 2008 (28)
Maio 2008 (17)
Abril 2008 (14)
Março 2008 (21)
Fevereiro 2008 (21)
Janeiro 2008 (33)
Dezembro 2007 (23)
Novembro 2007 (16)
Outubro 2007 (6)
Setembro 2007 (16)
Agosto 2007 (18)
Julho 2007 (17)
Junho 2007 (10)
Maio 2007 (30)
Abril 2007 (17)
Março 2007 (24)
Fevereiro 2007 (27)
Janeiro 2007 (20)
Dezembro 2006 (16)
Novembro 2006 (20)
Outubro 2006 (24)
Setembro 2006 (18)
Agosto 2006 (33)
Julho 2006 (30)
Junho 2006 (31)
Maio 2006 (17)
Abril 2006 (21)
Março 2006 (23)
Fevereiro 2006 (26)
Janeiro 2006 (38)
Dezembro 2005 (33)
Novembro 2005 (28)
Outubro 2005 (33)
Setembro 2005 (48)
Agosto 2005 (43)
Julho 2005 (35)
Junho 2005 (47)
Maio 2005 (37)
Abril 2005 (38)
Março 2005 (25)
Fevereiro 2005 (27)
Janeiro 2005 (35)
Dezembro 2004 (42)
Novembro 2004 (26)
Outubro 2004 (45)
Setembro 2004 (52)
Agosto 2004 (25)
Julho 2004 (53)
Junho 2004 (55)
Maio 2004 (60)
Abril 2004 (46)
Março 2004 (65)
Fevereiro 2004 (45)
Janeiro 2004 (68)
Dezembro 2003 (68)
Novembro 2003 (59)
Outubro 2003 (67)
Setembro 2003 (46)
Agosto 2003 (31)
Julho 2003 (36)
You are viewing a mobilized version of this site...
View original page here