-
-
Save sergos/feb397ed4d5a5f739ee501f768da31e6 to your computer and use it in GitHub Desktop.
1Mop/Sec Tarantool
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
os.execute('rm *.snap *.xlog') | |
t=require('clock') | |
y=require('yaml') | |
f=require('fiber') | |
box.cfg{log_level = 0, | |
memtx_memory = 1024*1024*2048, | |
-- replication_synchro_quorum = 1 | |
} | |
s=box.schema.create_space('test' | |
-- , {is_sync = true} | |
) | |
pk=s:create_index('pk',{type = 'HASH'}) | |
-- number of transactions | |
num_ins = 100000 | |
-- number of fibers | |
num_fibers = 50 | |
if arg[1] ~= nil then num_fibers=arg[1] end | |
-- number of ops per transaction | |
num_ops = 10 | |
function fi(start, s) | |
local ss = start | |
for i = 1, num_ins/num_fibers do | |
box.begin() | |
for j=1, num_ops do | |
s:insert{start} | |
start=start+1 | |
end | |
box.commit() | |
end | |
end | |
-- fiber storage to join them | |
fs = {} | |
begin = {t.time(),t.proc()} | |
for i = 1, num_fibers do | |
fs[i] = f.create(fi, i*num_ins, s) | |
fs[i]:wakeup() -- needed for backward compatibility with 1.7 | |
end | |
for i=1,num_fibers do | |
while fs[i]:status() ~= 'dead' do f.yield() end -- needed for backward compatibility with 1.7 | |
end | |
len={t.time()-begin[1], t.proc()-begin[2]} | |
-- print(y.encode(len)) | |
-- print('inserted:', pk:count()) | |
print(num_fibers, pk:count() / len[1]) | |
os.exit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
taskset -a 0xe tarantool load.lua