Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
picodata
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Container Registry
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
core
picodata
Commits
10fba8af
Commit
10fba8af
authored
2 years ago
by
Valentin Syrovatskiy
Browse files
Options
Downloads
Patches
Plain Diff
test: benchmark replaces
parent
bb21b6fd
No related branches found
No related tags found
1 merge request
!264
benchmark replaces and NOPs
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
Makefile
+4
-1
4 additions, 1 deletion
Makefile
Pipfile
+1
-0
1 addition, 0 deletions
Pipfile
Pipfile.lock
+156
-121
156 additions, 121 deletions
Pipfile.lock
test/manual/test_benchmark.py
+71
-0
71 additions, 0 deletions
test/manual/test_benchmark.py
with
232 additions
and
122 deletions
Makefile
+
4
−
1
View file @
10fba8af
.PHONY
:
default fmt lint test check fat clean
.PHONY
:
default fmt lint test check fat clean
benchmark
default
:
;
...
...
@@ -57,3 +57,6 @@ clean:
cargo clean
||
true
git submodule foreach
--recursive
'git clean -dxf && git reset --hard'
find
.
-type
d
-name
__pycache__ | xargs
-n
500
rm
-rf
benchmark
:
pytest
test
/manual/test_benchmark.py
This diff is collapsed.
Click to expand it.
Pipfile
+
1
−
0
View file @
10fba8af
...
...
@@ -12,6 +12,7 @@ tarantool = "*"
funcy
=
"*"
mypy
=
"*"
pytest-clarity
=
"*"
prettytable
=
"*"
[requires]
python_version
=
"3.10"
...
...
This diff is collapsed.
Click to expand it.
Pipfile.lock
+
156
−
121
View file @
10fba8af
This diff is collapsed.
Click to expand it.
test/manual/test_benchmark.py
0 → 100644
+
71
−
0
View file @
10fba8af
from
conftest
import
Cluster
from
prettytable
import
PrettyTable
# type: ignore
def
test_benchmark_replace
(
cluster
:
Cluster
,
capsys
):
ITERATIONS
=
99999
FIBERS
=
[
1
,
2
,
3
,
5
,
10
,
50
,
60
,
70
,
100
,
200
,
300
,
400
,
500
,
600
,
700
,
800
]
cluster
.
deploy
(
instance_count
=
1
)
[
i1
]
=
cluster
.
instances
luacode_init
=
"""
box.schema.space.create(
'
bench
'
, {
if_not_exists = true,
is_local = true,
format = {
{name =
'
id
'
, type =
'
unsigned
'
, is_nullable = false},
{name =
'
value
'
, type =
'
unsigned
'
, is_nullable = false}
}
})
box.space.bench:create_index(
'
pk
'
, {
if_not_exists = true,
parts = {{
'
id
'
}}
})
clock=require(
'
clock
'
)
fiber=require(
'
fiber
'
)
function f(n)
for i=1, n do
box.space.bench:replace({1, i})
end
end
function benchmark_replace(n, c)
local fibers = {}
local t1 = clock.monotonic()
for i=1, c do
fibers[i] = fiber.new(f, n)
fibers[i]:set_joinable(true)
end
for i=1, c do
fibers[i]:join()
end
local t2 = clock.monotonic();
return {c=c, nc = n*c, time = t2-t1, rps = n*c/(t2-t1)}
end
"""
i1
.
assert_raft_status
(
"
Leader
"
)
i1
.
eval
(
luacode_init
)
def
benchmark_one
(
n
:
int
,
c
:
int
):
return
i1
.
eval
(
"
return benchmark_replace(...)
"
,
n
,
c
,
timeout
=
60
)
def
benchmark
():
stats
=
[]
for
c
in
FIBERS
:
result
=
benchmark_one
(
int
(
ITERATIONS
/
c
),
c
)
stats
.
append
((
c
,
result
))
return
stats
def
report
(
stats
):
t
=
PrettyTable
()
t
.
title
=
"
tarantool replace/sec
"
t
.
field_names
=
[
"
fibers
"
,
"
rps
"
]
for
(
c
,
stat
)
in
stats
:
t
.
add_row
([
c
,
int
(
stat
[
"
rps
"
])])
t
.
align
=
"
r
"
return
t
with
capsys
.
disabled
():
print
(
""
)
print
(
report
(
benchmark
()))
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment