Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cse138-assignment-4-test-suite
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
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
Evan Kelly Jones
cse138-assignment-4-test-suite
Commits
f3a50fcf
Commit
f3a50fcf
authored
1 month ago
by
Thomas Dillow
Browse files
Options
Downloads
Patches
Plain Diff
can now change bench size stuff easily
parent
d0c99e5d
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/bench/benchmark.py
+7
-5
7 additions, 5 deletions
tests/bench/benchmark.py
with
7 additions
and
5 deletions
tests/bench/benchmark.py
+
7
−
5
View file @
f3a50fcf
...
...
@@ -7,14 +7,16 @@ import time
import
asyncio
import
matplotlib.pyplot
as
plt
NUM_SHARDS
=
16
NUM_KEYS
=
10000
def
benchmark_add_shard
(
conductor
:
ClusterConductor
,
dir
,
log
:
Logger
):
with
KVSTestFixture
(
conductor
,
dir
,
log
,
node_count
=
16
)
as
fx
:
with
KVSTestFixture
(
conductor
,
dir
,
log
,
node_count
=
NUM_SHARDS
)
as
fx
:
conductor
.
add_shard
(
"
shard1
"
,
conductor
.
get_nodes
([
0
]))
fx
.
broadcast_view
(
conductor
.
get_shard_view
())
log
(
"
putting 100 keys
\n
"
)
put_times
=
[]
for
i
in
range
(
1000
):
for
i
in
range
(
NUM_SHARDS
):
c
=
KVSMultiClient
(
fx
.
clients
,
"
client
"
,
log
)
start_time
=
time
.
time
()
r
=
c
.
put
(
0
,
f
"
key
{
i
}
"
,
f
"
value
{
i
}
"
,
timeout
=
10
)
...
...
@@ -24,7 +26,7 @@ def benchmark_add_shard(conductor: ClusterConductor, dir, log: Logger):
log
(
"
Starting benchmark
\n
"
)
reshard_times
=
[]
for
shard
in
range
(
2
,
1
7
):
for
shard
in
range
(
2
,
NUM_SHARDS
+
1
):
start_time
=
time
.
time
()
log
(
f
"
adding shard
{
shard
}
\n
"
)
conductor
.
add_shard
(
f
"
shard
{
shard
}
"
,
conductor
.
get_nodes
([
shard
-
1
]))
...
...
@@ -38,8 +40,8 @@ def benchmark_add_shard(conductor: ClusterConductor, dir, log: Logger):
log
(
f
"
shard count:
{
shard
}
, reshard time:
{
time_taken
}
"
)
# Generate plot
plt
.
figure
(
figsize
=
(
10
,
6
))
plt
.
plot
(
range
(
2
,
1
7
),
reshard_times
,
marker
=
'
o
'
)
plt
.
figure
(
figsize
=
(
NUM_SHARDS
,
10
))
plt
.
plot
(
range
(
2
,
NUM_SHARDS
+
1
),
reshard_times
,
marker
=
'
o
'
)
plt
.
title
(
'
Reshard Times
'
)
plt
.
xlabel
(
'
Number of Shards
'
)
plt
.
ylabel
(
'
Time (seconds)
'
)
...
...
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