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
ad830605
Commit
ad830605
authored
2 years ago
by
Valentin Syrovatskiy
Browse files
Options
Downloads
Patches
Plain Diff
test: benchmark replaces
parent
6379a7e5
No related branches found
No related tags found
No related merge requests found
Pipeline
#12250
failed
2 years ago
Stage: build
Changes
4
Pipelines
1
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
+87
-0
87 additions, 0 deletions
test/manual/test_benchmark.py
with
248 additions
and
122 deletions
Makefile
+
4
−
1
View file @
ad830605
.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 @
ad830605
...
...
@@ -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 @
ad830605
This diff is collapsed.
Click to expand it.
test/manual/test_benchmark.py
0 → 100644
+
87
−
0
View file @
ad830605
from
this
import
d
from
conftest
import
Cluster
import
json
from
prettytable
import
PrettyTable
def
test_benchmark_replace
(
cluster
:
Cluster
,
capsys
):
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
'
)
json=require(
'
json
'
)
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, 1e5)
fibers[i]:set_joinable(true)
end;
for i=1, c do
fibers[i]:join()
end
local t2 = clock.monotonic();
local result = {c=c, nc = n*c, time = t2-t1, rps = n*c/(t2-t1)}
return json.encode(result)
end
"""
i1
.
assert_raft_status
(
"
Leader
"
)
i1
.
eval
(
luacode_init
)
def
b
(
n
:
int
,
c
:
int
):
data
=
i1
.
eval
(
"
return benchmark_replace(...)
"
,
n
,
c
,
timeout
=
60
)
return
json
.
loads
(
data
)
def
b_retr
(
n
:
int
,
c
:
int
):
return
list
(
map
(
lambda
_
:
b
(
n
,
c
),
range
(
0
,
4
)))
def
benchmark
():
stats
=
[]
fibers
=
[
1
,
2
,
3
,
5
,
10
,
50
]
for
c
in
fibers
:
result
=
b_retr
(
100000
,
c
)
key
=
{
"
fibers
"
:
c
}
stats
.
append
((
key
,
result
))
return
stats
def
rps
(
stat
):
return
list
(
map
(
lambda
s
:
s
[
"
rps
"
],
stat
))
def
avg
(
x
):
return
sum
(
x
)
/
len
(
x
)
def
remove_min
(
x
:
list
):
min_value
=
min
(
x
)
return
list
(
filter
(
lambda
v
:
v
!=
min_value
,
x
))
def
report
(
stats
):
t
=
PrettyTable
()
t
.
field_names
=
[
"
fibers
"
,
"
rps
"
]
for
(
key
,
stat
)
in
stats
:
t
.
add_row
([
key
[
"
fibers
"
],
int
(
avg
(
remove_min
(
rps
(
stat
))))])
t
.
align
=
"
r
"
return
t
with
capsys
.
disabled
():
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