Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Felix Seibert
xtreemfs_client
Commits
d633ecc8
Commit
d633ecc8
authored
Jul 24, 2018
by
Felix Seibert
Browse files
add random assignment two step rebalancing
parent
c3bdc9ec
Changes
2
Hide whitespace changes
Inline
Side-by-side
tests/test_dataDistribution.py
View file @
d633ecc8
...
...
@@ -259,7 +259,7 @@ class TestDataDistribution(unittest.TestCase):
distribution
.
add_osd_list
(
create_test_osd_list
(
num_osds
,
osd_bandwidths
))
distribution
.
add_folders
(
create_test_folder_list
(
num_folders
,
folder_sizes
),
random_osd_assignment
=
True
)
distribution
.
rebalance_two_steps
()
distribution
.
rebalance_two_steps
_optimal_matching
()
osds
=
distribution
.
get_osd_list
()
total_folder_sizes
=
list
(
map
(
lambda
x
:
distribution
.
OSDs
[
x
].
total_folder_size
,
osds
))
...
...
@@ -276,7 +276,7 @@ class TestDataDistribution(unittest.TestCase):
distribution
.
add_osd_list
(
create_test_osd_list
(
num_osds
,
osd_bandwidths
))
distribution
.
add_folders
(
create_test_folder_list
(
num_folders
,
folder_sizes
),
random_osd_assignment
=
True
)
distribution
.
rebalance_two_steps
()
distribution
.
rebalance_two_steps
_optimal_matching
()
osds
=
distribution
.
get_osd_list
()
total_folder_sizes
=
list
(
map
(
lambda
x
:
distribution
.
OSDs
[
x
].
total_folder_size
,
osds
))
...
...
xtreemfs_client/dataDistribution.py
View file @
d633ecc8
...
...
@@ -340,7 +340,7 @@ class DataDistribution(object):
return
movements
def
rebalance_two_steps
(
self
):
def
rebalance_two_steps
_optimal_matching
(
self
):
"""
rebalance the distribution in two steps:
1. calculate new distribution, independently of the current one
...
...
@@ -440,6 +440,31 @@ class DataDistribution(object):
return
movements
def
rebalance_two_steps_random_matching
(
self
):
"""
rebalance the distribution in two steps:
1. calculate new distribution, independently of the current one
2. the OSDs of the new (virtual) matching are randomly assigned to the actual (current OSDs), i.e.,
no matter which OSD has which folders.
while any algorithm (solving/approximating that kind of problem) could be used for the first step,
we here only implement the LPT algorithm, as it is a pretty good approximation with extremely good running time.
:return:
"""
virtual_distribution
=
copy
.
deepcopy
(
self
)
virtual_distribution
.
rebalance_lpt
(
rebalance_factor
=
0
)
movements
=
{}
for
virtual_osd
in
virtual_distribution
.
OSDs
.
values
():
for
virtual_folder
in
virtual_osd
.
folders
.
keys
():
if
not
self
.
OSDs
[
virtual_osd
.
uuid
].
contains_folder
(
virtual_folder
):
movements
[
virtual_folder
]
=
(
self
.
get_containing_osd
(
virtual_folder
).
uuid
,
virtual_osd
.
uuid
)
for
virtual_osd
in
virtual_distribution
.
OSDs
.
values
():
self
.
replace_osd
(
virtual_osd
)
return
movements
def
get_suitable_osds
(
self
,
folder_size
):
"""
create a list of OSDs with at least folder_size free capacity.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment