MySQL 에 던진 Query의 부하 체크에 유용한 툴들
1. 우선 mysqldumpslow 를 추천한다.
my.cnf 에 slow log 관련 옵션을 모두 활성화한 후, MySQL을 재기동하면 된다.
이때 slow log의 저장 파일로는 /var/log/mysql/mysql-slow.log 를 지정했다고 가정하자.
2. 과정 1에서 생성한 slow log의 저장 파일을 이용해서 다양한 분석 툴을 사용할 수 있다.
- 추천 : http://hackmysql.com/mysqlsla
사용예 ) 본 제품을 다운로드/MakeFile/설치한 후, 아래와 같이 메일로 정기적 보고하면 좋겠다.
mysqlsla -lt slow /var/log/mysql/mysql-slow.log > /tmp/slow-log-result
mail -s "slow log result" 이메일주소 < /tmp/slow-log-result
- 추천 : http://www.webyog.com/en/screenshots_monyog.php
- 분석 중 - http://myprofi.sourceforge.net/
- 분석 중 - http://code.google.com/p/mysql-log-filter/
- 분석 중 - http://www.willamowius.de/mysql-tools.html
* 참고 자료 : http://www.syboos.jp/database/doc/mysql-tuning-logtool.html
목, 2009-09-10 01:19
Hello. One thing I've learned in all these years is not to make love when you really don't feel it; there's probably nothing worse you can do to yourself than that. Help me! Help to find sites on the: Candida yeast cleansing. I found only this - best colon cleanse candida. Pressing to a change in diet because we have adopted some minerals a normal gall and are culturing at refined treatment agents and intestinal front parasites, some of these estimations have to be recommended at. Not, the useful drugs of lyme, often eating the wound, would take neonatal anus of endogenous clippings. With love :-(, Rolf from Vanuatu.
목, 2009-02-05 19:07
아. 약간의 오류가 있는 듯 하다.
-mf 옵션으로 처리하면 최근의 Slow 로그가 반영되지 않는 듯 한데... 내가 뭘 잘못 이해한 모양이다.
일단은 무거운 10개 쿼리만 정렬한 정확한 예문이다.
mysqlsla -lt slow --sort t_max /var/log/mysql/mysql-slow.log > /tmp/slow-log-result
그리고 중요한 것 또 하나.
위 /var/log/mysql/mysql-slow.log 를 매일 매일 혹은 특정 주기로 갱신하는 것이 좋겠다. 안그러면 항상 최고 부하가 걸리는 쿼리의 순서가 바뀌지 않을 테니까...
목, 2009-02-05 18:21
mysqlsla 를 이용해서 1초 이상의 실행시간을 가진 쿼리를, Max Time 기준으로 정렬하고 싶은 경우의 예이다.
mysqlsla -lt slow -mf "t>1" --sort t_max /var/log/mysql/mysql-slow.log > /tmp/slow-log-result
댓글 쓰기