Commit 9df9f975 authored by Felix Seibert's avatar Felix Seibert
Browse files

use more meaningful per-OSD reassignment limit

parent 81dce78f
......@@ -104,6 +104,18 @@ class DataDistribution(object):
self.OSDs[new_osd].add_folder(folder_id, self.OSDs[old_osd.uuid].folders[folder_id])
self.OSDs[old_osd.uuid].remove_folder(folder_id)
def get_total_folder_size(self):
total_size = 0
for one_osd in self.OSDs.values():
total_size += one_osd.total_folder_size
return total_size
def get_total_bandwidth(self):
total_bandwidth = 0
for one_osd in self.OSDs.values():
total_bandwidth += one_osd.bandwidth
return total_bandwidth
def get_average_folder_size(self):
"""
get the average folder size of all folders of all OSDs.
......@@ -258,17 +270,13 @@ class DataDistribution(object):
"""
movements = {}
folders_to_be_reassigned = []
# TODO reassignment factor based on load or based on processing time?
# as long as we use OSDs with the same bandwidth, there is no difference.
reassignment_limit = self.get_average_processing_time() * rebalance_factor
# for each OSD, remove the smallest folder until its total_folder_size does not exceed the reassignment_limit
# unrolling
for osd in self.OSDs.values():
# TODO how to calculate the 'unrolling limit' for each individual OSD?
# again, as long as all OSDs have the same bandwidth, there is no difference.
# BUT it should definitely not depend on the load or pt of the OSD.
# so for now we use a static limit, the same for all OSDs.
# self.get_total_folder_size / self.get_total_bandwidth() is the optimal processing time for each OSD:
# this value is a lower bound for the makespan
reassignment_limit = osd.bandwidth * (self.get_total_folder_size() / self.get_total_bandwidth())
while osd.get_processing_time() > reassignment_limit:
folder_id, folder_size = osd.get_smallest_folder()
folders_to_be_reassigned.append(folder.Folder(folder_id, folder_size, None))
......@@ -281,7 +289,7 @@ class DataDistribution(object):
for folder_id, target in new_assignments:
movements[folder_id] = (movements[folder_id], target)
return movements, reassignment_limit
return movements
def rebalance_one_folder(self):
"""
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment