MySQL_tps
2016-12-06 23:32
274 查看
TPS(Transaction Per Second) 一个系统的吞度量(承压能力)与request对CPU的消耗、外部接口、IO等等紧密关联。 单个reqeust 对CPU消耗越高,外部系统接口、IO影响速度越慢,系统吞吐能力越低,反之越高。 MySQL-tps:每秒钟系统能够处理的交易或事务的数量。它是衡量系统处理能力的重要指标。 TPS是LoadRunner中重要的性能参数指标。 #!/usr/bin/env python #_*_coding:utf8 _*_ import MySQLdb import datetime #qps #!/usr/bin/env python import MySQLdb import time from influxdb import InfluxDBClient def getInfluxdb(): client=InfluxDBClient(host='192.168.15.104', port=8086, username='admin', password='root123', database='mysql15104') return client def get_cur(): conn=MySQLdb.connect(host="192.168.30.103",user="dlan",passwd="root123",port=3307,db="test",charset='utf8') conn.select_db("test") cur=conn.cursor() return cur def get_mysql_status(cursor): data=cursor.execute('show global status;'); data_list=cursor.fetchall() data_dict={} for item in data_list: data_dict[item[0]] = item[1] return data_dict def getQPS(cursor): first_status=get_mysql_status(cursor) time.sleep(1) second_status=get_mysql_status(cursor) tps=int(second_status['Com_commit'])-int(first_status['Com_commit']) return qps if __name__=='__main__': while True: cur=get_cur() aa=getQPS(cur) print aa date=int(time.time()) json_body = [ { "measurement":'wangyuan', "tags":{ "host": "mycat", "time":date }, "fields":{ "qps":aa } } ] print json_body
相关文章推荐
- IPTV的新方案TPS技术
- 并发用户数和TPS的解释
- 系统吞吐量评估方法(冯凌圣)
- 并发用户数与TPS之间的关系
- tps系统吞吐量计算公式
- hibernate继承关系映射关系方法(二)--每个子类一张表
- hibernate继承关系映射方法(三)--每个具体类一张表TPC
- hibernate的3种继承映射关系总结——TPH,TPS,TPC
- Java TPS实现
- DBA,QPS,TPS,OLAP,IO
- MySQL实时统计脚本--计算QPS,TPS和线程连接数等
- TPS和事务响应时间的关系、计算公式
- LoadRunner性能测试指标 TPS(Transaction per Second)总结
- 概念TPS和QPS
- 系统吞吐量、TPS(QPS)、用户并发量、性能测试概念和公式
- Jmeter性能测试中Tps图与响应时间图
- 性能测试TPS与用户之间转换
- TPS从300笔/秒到5500笔/秒的性能测试优化之路
- QPS/TPS/并发量/系统吞吐量的概念
- 系统吞吐量、TPS(QPS)、用户并发量、性能测试概念和公式