Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
opendht
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
opendht
Commits
6c3c19c0
Commit
6c3c19c0
authored
Nov 16, 2015
by
Simon Désaulniers
Browse files
Options
Downloads
Patches
Plain Diff
add test for performance while deleting nodes
parent
252ff471
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
python/tools/benchmark.py
+63
-3
63 additions, 3 deletions
python/tools/benchmark.py
with
63 additions
and
3 deletions
python/tools/benchmark.py
+
63
−
3
View file @
6c3c19c0
...
...
@@ -527,8 +527,8 @@ class PersistenceTest(FeatureTest):
DhtNetwork
.
log
(
'
sending message stats request
'
)
stats
=
proc
.
sendGetMessageStats
()
cluster_ops_count
+=
sum
(
stats
[
1
:])
DhtNetwork
.
log
(
"
Waiting 15 seconds for packets to work their way effectively.
"
)
time
.
sleep
(
15
)
#
DhtNetwork.log("Waiting 15 seconds for packets to work their way effectively.")
#
time.sleep(15)
ops_count
.
append
(
cluster_ops_count
/
self
.
wb
.
node_num
)
# checking if values were transfered to new nodes
...
...
@@ -693,7 +693,7 @@ class PerformanceTest(FeatureTest):
"""
@param test: is one of the following:
-
'
gets
'
: multiple get operations and statistical results.
-
'
delete
_put
'
: perform multiple put() operations followed
-
'
delete
'
: perform multiple put() operations followed
by targeted deletion of nodes hosting the values. Doing
so until half of the nodes on the network remain.
@type test: string
...
...
@@ -703,6 +703,12 @@ class PerformanceTest(FeatureTest):
def
run
(
self
):
if
self
.
_test
==
'
gets
'
:
self
.
_getsTimesTest
()
elif
self
.
_test
==
'
delete
'
:
self
.
_delete
()
###########
# Tests #
###########
def
_getsTimesTest
(
self
):
"""
...
...
@@ -787,6 +793,60 @@ class PerformanceTest(FeatureTest):
plt
.
ioff
()
plt
.
show
()
def
_delete
(
self
):
"""
Tests for performance of get() and put() operations on the network while
deleting around the target hash.
"""
FeatureTest
.
done
=
0
FeatureTest
.
lock
=
threading
.
Condition
()
FeatureTest
.
foreign_nodes
=
[]
FeatureTest
.
foreign_values
=
[]
bootstrap
=
self
.
bootstrap
try
:
bootstrap
.
resize
(
3
)
consumer
=
bootstrap
.
get
(
1
)
producer
=
bootstrap
.
get
(
2
)
myhash
=
random_hash
()
local_values
=
[
Value
(
b
'
foo
'
),
Value
(
b
'
bar
'
),
Value
(
b
'
foobar
'
)]
for
_
in
range
(
max
(
1
,
int
(
self
.
wb
.
node_num
/
32
))):
self
.
_dhtGet
(
consumer
,
myhash
)
DhtNetwork
.
log
(
"
Waiting 15 seconds...
"
)
time
.
sleep
(
15
)
self
.
_dhtPut
(
producer
,
myhash
,
*
local_values
)
#checking if values were transfered
self
.
_dhtGet
(
consumer
,
myhash
)
DhtNetwork
.
log
(
'
Values are found on :
'
)
for
node
in
FeatureTest
.
foreign_nodes
:
DhtNetwork
.
log
(
node
)
if
not
FeatureTest
.
successfullTransfer
(
local_values
,
FeatureTest
.
foreign_values
):
if
FeatureTest
.
foreign_values
:
DhtNetwork
.
log
(
'
[GET]: Only
'
,
len
(
FeatureTest
.
foreign_values
)
,
'
on
'
,
len
(
local_values
),
'
values successfully put.
'
)
else
:
DhtNetwork
.
log
(
'
[GET]: 0 values successfully put
'
)
DhtNetwork
.
log
(
'
Removing all nodes hosting target values...
'
)
for
proc
in
self
.
wb
.
procs
:
DhtNetwork
.
log
(
'
[REMOVE]: sending shutdown request to
'
,
proc
)
proc
.
sendNodesRequest
(
DhtNetworkSubProcess
.
SHUTDOWN_NODE_REQ
,
FeatureTest
.
foreign_nodes
)
except
Exception
as
e
:
print
(
e
)
finally
:
bootstrap
.
resize
(
1
)
if
__name__
==
'
__main__
'
:
parser
=
argparse
.
ArgumentParser
(
description
=
'
Run, test and benchmark a
'
\
...
...
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