-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf: speed up xqueue.upgrade() for large spaces (#22)
* perf: speed up xqueue.upgrade() for large spaces * test: fix flaky test
- Loading branch information
Showing
7 changed files
with
115 additions
and
22 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
BENCHER_PROJECT=xqueue | ||
BENCHER_ADAPTER=json | ||
BENCHER_TESTBED=localhost | ||
LUABENCH_USE_BMF=true |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: Benchmarking code | ||
|
||
on: | ||
- push | ||
|
||
jobs: | ||
run-unit-benchmarks: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
version: ["2.10.6", "2.11.0", "2.11.2"] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: tarantool/setup-tarantool@v3 | ||
with: | ||
tarantool-version: '${{matrix.version}}' | ||
- name: install argparse | ||
run: tarantoolctl rocks install argparse | ||
- name: install luabench | ||
run: tarantoolctl rocks --server=https://moonlibs.org install luabench 0.3.0 | ||
- name: run benchmarks | ||
env: | ||
LUABENCH_USE_BMF: false | ||
LUABENCH_TIMEOUT: 60 | ||
LUABENCH_DURATION: '10s' | ||
run: | | ||
.rocks/bin/luabench |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
jit = 'on' | ||
duration = '10s' |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
local lb = require 'luabench' | ||
local fiber = require 'fiber' | ||
local fun = require 'fun' | ||
|
||
local M = {} | ||
|
||
local STATUS = { 'R', 'T', 'W', 'B', 'Z', 'D' } | ||
|
||
lb.before_all(function() | ||
box.cfg{ memtx_memory = 2^30 } | ||
|
||
box.schema.space.create('q1', { | ||
if_not_exists = true, | ||
format = { | ||
{ name = 'id', type = 'unsigned' }, | ||
{ name = 'status', type = 'string' }, | ||
}, | ||
}) | ||
|
||
box.space.q1:create_index('primary', { parts = {'id'}, if_not_exists = true }) | ||
box.space.q1:create_index('xq', { parts = {'status', 'id'}, if_not_exists = true }) | ||
|
||
if fiber.extend_slice then | ||
fiber.extend_slice({ err = 3600, warn = 3600 }) | ||
end | ||
|
||
box.begin() | ||
local tab = {} | ||
for no = 1, 4e6 do | ||
tab[1], tab[2] = no, STATUS[math.random(#STATUS)] | ||
box.space.q1:replace(tab) | ||
end | ||
box.commit() | ||
end) | ||
|
||
lb.after_all(function() | ||
box.space.q1:drop() | ||
box.snapshot() | ||
end) | ||
|
||
function M.bench_iterate_all(b) | ||
local limit = b.N | ||
local scanned = 0 | ||
local stats = {} | ||
for _, t in box.space.q1:pairs({}, { iterator = "ALL" }) do | ||
stats[t.status] = (stats[t.status] or 0ULL) + 1 | ||
scanned = scanned + 1 | ||
if limit == scanned then break end | ||
end | ||
b.N = scanned | ||
end | ||
|
||
function M.bench_count(b) | ||
local total = 0 | ||
for _, s in pairs(STATUS) do | ||
total = total + box.space.q1.index.xq:count(s) | ||
if b.N < total then break end | ||
end | ||
b.N = total | ||
end | ||
|
||
return M |
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
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