sysbench和lua的简单研究

因为精力有限,所以先研究Mysql,等Mysql有些精通,再研究TiDB或其他开源数据库。

先从sysbench-0.4.12.14开始 - https://dev.mysql.com/downloads/benchmarks.html
create database sbtest;
grant all privileges on sbtest.* to test@‘localhost’ identified by ‘Welcome1+’;

采用–debug=on把“世界”变得更清澈
./sysbench --num-threads=1 --max-requests=2 --test=oltp --debug=on --mysql-table-engine=innodb --oltp-num-tables=1 --oltp-table-size=10 --mysql-user=test --mysql-password=Welcome1+ prepare
./sysbench --num-threads=1 --max-requests=2 --test=oltp --debug=on --mysql-table-engine=innodb --oltp-num-tables=1 --oltp-table-size=10 --mysql-user=test --mysql-password=Welcome1+ run
./sysbench --num-threads=1 --max-requests=2 --test=oltp --debug=on --mysql-table-engine=innodb --oltp-num-tables=1 --oltp-table-size=10 --mysql-user=test --mysql-password=Welcome1+ cleanup

表:
CREATE TABLE sbtest (
id int(10) unsigned NOT NULL AUTO_INCREMENT,
k int(10) unsigned NOT NULL DEFAULT ‘0’,
c char(120) NOT NULL DEFAULT ‘’,
pad char(60) NOT NULL DEFAULT ‘’,
PRIMARY KEY (id),
KEY k (k)
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=latin1;

压测SQL:
SELECT c from sbtest where id=?
SELECT c from sbtest where id in (?,?,?,?,?,?,?,?,?,?)
SELECT c from sbtest where id between ? and ?
SELECT SUM(K) from sbtest where id between ? and ?
SELECT c from sbtest where id between ? and ? order by c
SELECT DISTINCT c from sbtest where id between ? and ? order by c
UPDATE sbtest set k=k+1 where id=?
UPDATE sbtest set c=? where id=?
DELETE from sbtest where id=?
INSERT INTO sbtest values(?,0,’ ',‘aaaaaaaaaaffffffffffrrrrrrrrrreeeeeeeeeeyyyyyyyyyy’)
BEGIN
COMMIT
**Note:每次request会顺序执行以上SQL,而且UPDATE/DELETE/INSERT会使用同一个ID.

还有一个sysbench 1.1.0(基于LUA)- https://github.com/akopytov/sysbench
先简单学习LUA -
./third_party/luajit/bin/luajit-2.1.0-beta3
LuaJIT 2.1.0-beta3 – Copyright © 2005-2017 Mike Pall. http://luajit.org/
JIT: ON SSE2 SSE3 SSE4.1 fold cse dce fwd dse narrow loop abc sink fuse

print “Hello,world!”
Hello,world!
function create_a_counter()

local count=0
return function()
count = count + 1
return count
end
end
ct = create_a_counter()
print(ct())
1
print(ct())
2
print(ct())
3
print(create_a_counter())
function: 0x408aa1f8
print(create_a_counter())
function: 0x408aa388
print(create_a_counter())
function: 0x408aa518
print((create_a_counter())())
1
print((create_a_counter())())
1
print((create_a_counter())())

在oltp_common.lua有参数说明:
sysbench.cmdline.options = {

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值