您的位置:首页 > 数据库 > MySQL

gnuplot生成MySQL QPS图形

2017-10-27 17:10 239 查看
1、建立MySQL QPS执行脚本

#!/bin/bash
mysqladmin -uroot -p'123123' extended-status -i1|awk \
'BEGIN{flag=0;
print "";
print "QPS   TPS    Threads_con Threads_run ";
print "------------------------------------- "}
$2 ~ /Queries$/            {q=$4-lq;lq=$4;}
$2 ~ /Com_commit$/         {c=$4-lc;lc=$4;}
$2 ~ /Com_rollback$/       {r=$4-lr;lr=$4;}
$2 ~ /Threads_connected$/  {tc=$4;}
$2 ~ /Threads_running$/    {tr=$4;

if(flag==0){
flag=1; count=0
}else {
printf "%-6d %-8d %-10d %d \n", q,c+r,tc,tr;
}

}'


2、执行脚本

nohup sh mysql_qps.sh > qps_per_5



3、安装gnuplot

yum install gunplot

4、生成gnuplot图形

[root@test1 ~]# gnuplot

G N U P L O T
Version 4.2 patchlevel 6
last modified Sep 2009
System: Linux 2.6.32-431.el6.x86_64

Copyright (C) 1986 - 1993, 1998, 2004, 2007 - 2009
Thomas Williams, Colin Kelley and many others

Type `help` to access the on-line reference manual.
The gnuplot FAQ is available from http://www.gnuplot.info/faq/ 
Send bug reports and suggestions to <http://sourceforge.net/projects/gnuplot>

Terminal type set to 'x11'
gnuplot> plot "qps_per_5" using 1 w lines title "QPS"




生成QPS和load的截图

gnuplot> plot "qps_per_5" using 1 w lines title "QPS","qps_per_5" using 2 w lines title "load"




gnuplot的参数如下

【转】gnuplot分析多组数据绘图 - 剑帝的日志 - 网易博客 http://blog.163.com/heloyure@126/blog/static/64377576201181992822/
Tpcc-MySQL测试并使用gnuplot生成图表-鸟哥のlinux-ChinaUnix博客 http://blog.chinaunix.net/uid-25266990-id-4080103.html
使用gnuplot对tpcc-mysql压测结果生成图表 - lzfj - 博客园 http://www.cnblogs.com/lizhi221/p/6814025.html
gnuplot工具的安装与使用-陈舒婷-ChinaUnix博客 http://blog.chinaunix.net/uid-28412198-id-3763133.html
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: