Skip to content
This repository was archived by the owner on Apr 14, 2022. It is now read-only.

Commit 2f83a99

Browse files
committed
Add benchmarking cases with two connections
1 parent 5e9bff9 commit 2f83a99

5 files changed

+448
-8
lines changed

test/bench/forking-2-1-1.test.lua

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
#!/usr/bin/env tarantool
2+
3+
-- requires
4+
-- --------
5+
6+
local fio = require('fio')
7+
8+
-- require in-repo version of graphql/ sources despite current working directory
9+
package.path = fio.abspath(debug.getinfo(1).source:match("@?(.*/)")
10+
:gsub('/./', '/'):gsub('/+$', '')) .. '/../../?.lua' .. ';' .. package.path
11+
12+
local bench = require('test.bench.bench')
13+
local testdata = require('test.testdata.bench_testdata')
14+
15+
-- functions
16+
-- ---------
17+
18+
local function bench_prepare(state)
19+
local meta = testdata.meta or testdata.get_test_metadata()
20+
state.gql_wrapper = bench.bench_prepare_helper(testdata, state.shard, meta)
21+
local query = [[
22+
query match_by_user_and_passport_id_and_equipment_id(
23+
$user_id: String
24+
$passport_id: String
25+
$equipment_id: String
26+
) {
27+
user(
28+
user_id: $user_id
29+
user_to_passport_c: {passport_id: $passport_id}
30+
user_to_equipment_c: {equipment_id: $equipment_id}
31+
) {
32+
user_id
33+
first_name
34+
middle_name
35+
last_name
36+
user_to_passport_c {
37+
passport_id
38+
}
39+
user_to_equipment_c {
40+
equipment_id
41+
}
42+
}
43+
}
44+
]]
45+
state.variables = {
46+
user_id = 'user_id_42',
47+
passport_id = 'passport_id_42',
48+
equipment_id = 'equipment_id_42',
49+
}
50+
state.gql_query = state.gql_wrapper:compile(query)
51+
end
52+
53+
local function bench_iter(state)
54+
return state.gql_query:execute(state.variables)
55+
end
56+
57+
-- run
58+
-- ---
59+
60+
box.cfg({})
61+
62+
bench.run('forking-2-1-1', {
63+
init_function = testdata.init_spaces,
64+
cleanup_function = testdata.drop_spaces,
65+
bench_prepare = bench_prepare,
66+
bench_iter = bench_iter,
67+
iterations = {
68+
space = 100000,
69+
shard = 10000,
70+
},
71+
checksums = {
72+
space = 2631928398,
73+
shard = 2570197652,
74+
},
75+
})
76+
77+
os.exit()

test/bench/forking-2-100-1.test.lua

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
#!/usr/bin/env tarantool
2+
3+
-- requires
4+
-- --------
5+
6+
local fio = require('fio')
7+
8+
-- require in-repo version of graphql/ sources despite current working directory
9+
package.path = fio.abspath(debug.getinfo(1).source:match("@?(.*/)")
10+
:gsub('/./', '/'):gsub('/+$', '')) .. '/../../?.lua' .. ';' .. package.path
11+
12+
local bench = require('test.bench.bench')
13+
local testdata = require('test.testdata.bench_testdata')
14+
15+
-- functions
16+
-- ---------
17+
18+
local function bench_prepare(state)
19+
local meta = testdata.meta or testdata.get_test_metadata()
20+
state.gql_wrapper = bench.bench_prepare_helper(testdata, state.shard, meta)
21+
local query = [[
22+
query match_by_passport_id_and_equipment_id(
23+
$passport_id: String
24+
$equipment_id: String
25+
) {
26+
user(
27+
user_to_passport_c: {passport_id: $passport_id}
28+
user_to_equipment_c: {equipment_id: $equipment_id}
29+
) {
30+
user_id
31+
first_name
32+
middle_name
33+
last_name
34+
user_to_passport_c {
35+
passport_id
36+
}
37+
user_to_equipment_c {
38+
equipment_id
39+
}
40+
}
41+
}
42+
]]
43+
state.variables = {
44+
passport_id = 'passport_id_42',
45+
equipment_id = 'equipment_id_42',
46+
}
47+
state.gql_query = state.gql_wrapper:compile(query)
48+
end
49+
50+
local function bench_iter(state)
51+
return state.gql_query:execute(state.variables)
52+
end
53+
54+
-- run
55+
-- ---
56+
57+
box.cfg({})
58+
59+
bench.run('forking-2-100-1', {
60+
init_function = testdata.init_spaces,
61+
cleanup_function = testdata.drop_spaces,
62+
bench_prepare = bench_prepare,
63+
bench_iter = bench_iter,
64+
iterations = {
65+
space = 10000,
66+
shard = 1000,
67+
},
68+
checksums = {
69+
space = 2570197652,
70+
shard = 3470604763,
71+
},
72+
})
73+
74+
os.exit()

test/bench/forking-3-1-1-1.test.lua

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
#!/usr/bin/env tarantool
2+
3+
-- requires
4+
-- --------
5+
6+
local fio = require('fio')
7+
8+
-- require in-repo version of graphql/ sources despite current working directory
9+
package.path = fio.abspath(debug.getinfo(1).source:match("@?(.*/)")
10+
:gsub('/./', '/'):gsub('/+$', '')) .. '/../../?.lua' .. ';' .. package.path
11+
12+
local bench = require('test.bench.bench')
13+
local testdata = require('test.testdata.bench_testdata')
14+
15+
-- functions
16+
-- ---------
17+
18+
local function bench_prepare(state)
19+
local meta = testdata.meta or testdata.get_test_metadata()
20+
state.gql_wrapper = bench.bench_prepare_helper(testdata, state.shard, meta)
21+
local query = [[
22+
query match_by_user_and_passport_and_equipment(
23+
$user_id: String, $number: String
24+
) {
25+
user(
26+
user_id: $user_id,
27+
user_to_passport_c: {passport_c: {number: $number}}
28+
user_to_equipment_c: {equipment_c: {number: $number}}
29+
) {
30+
user_id
31+
first_name
32+
middle_name
33+
last_name
34+
user_to_passport_c {
35+
passport_c {
36+
passport_id
37+
number
38+
}
39+
}
40+
user_to_equipment_c {
41+
equipment_c {
42+
equipment_id
43+
number
44+
}
45+
}
46+
}
47+
}
48+
]]
49+
state.variables = {
50+
user_id = 'user_id_42',
51+
number = 'number_42',
52+
}
53+
state.gql_query = state.gql_wrapper:compile(query)
54+
end
55+
56+
local function bench_iter(state)
57+
return state.gql_query:execute(state.variables)
58+
end
59+
60+
-- run
61+
-- ---
62+
63+
box.cfg({})
64+
65+
bench.run('forking-3-1-1-1', {
66+
init_function = testdata.init_spaces,
67+
cleanup_function = testdata.drop_spaces,
68+
bench_prepare = bench_prepare,
69+
bench_iter = bench_iter,
70+
iterations = {
71+
space = 100000,
72+
shard = 10000,
73+
},
74+
checksums = {
75+
space = 3712855152,
76+
shard = 2948309431,
77+
},
78+
})
79+
80+
os.exit()
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
#!/usr/bin/env tarantool
2+
3+
-- requires
4+
-- --------
5+
6+
local fio = require('fio')
7+
8+
-- require in-repo version of graphql/ sources despite current working directory
9+
package.path = fio.abspath(debug.getinfo(1).source:match("@?(.*/)")
10+
:gsub('/./', '/'):gsub('/+$', '')) .. '/../../?.lua' .. ';' .. package.path
11+
12+
local bench = require('test.bench.bench')
13+
local testdata = require('test.testdata.bench_testdata')
14+
15+
-- functions
16+
-- ---------
17+
18+
local function bench_prepare(state)
19+
local meta = testdata.meta or testdata.get_test_metadata()
20+
state.gql_wrapper = bench.bench_prepare_helper(testdata, state.shard, meta)
21+
local query = [[
22+
query match_by_passport_and_equipment($number: String) {
23+
user(
24+
user_to_passport_c: {passport_c: {number: $number}}
25+
user_to_equipment_c: {equipment_c: {number: $number}}
26+
) {
27+
user_id
28+
first_name
29+
middle_name
30+
last_name
31+
user_to_passport_c {
32+
passport_c {
33+
passport_id
34+
number
35+
}
36+
}
37+
user_to_equipment_c {
38+
equipment_c {
39+
equipment_id
40+
number
41+
}
42+
}
43+
}
44+
}
45+
]]
46+
state.variables = {
47+
number = 'number_42',
48+
}
49+
state.gql_query = state.gql_wrapper:compile(query)
50+
end
51+
52+
local function bench_iter(state)
53+
return state.gql_query:execute(state.variables)
54+
end
55+
56+
-- run
57+
-- ---
58+
59+
box.cfg({})
60+
61+
bench.run('forking-3-100-100-1', {
62+
init_function = testdata.init_spaces,
63+
cleanup_function = testdata.drop_spaces,
64+
bench_prepare = bench_prepare,
65+
bench_iter = bench_iter,
66+
iterations = {
67+
space = 10000,
68+
shard = 1000,
69+
},
70+
checksums = {
71+
space = 2948309431,
72+
shard = 3663249523,
73+
},
74+
})
75+
76+
os.exit()

0 commit comments

Comments
 (0)