Skip to content

Commit

Permalink
Bugs fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
esmaeilmirvakili committed Aug 10, 2020
1 parent c7d3d34 commit cd34107
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 12 deletions.
4 changes: 2 additions & 2 deletions experiments/latModel/latency_model_4K.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ compaction:
frequency: 512000000 #bytes
l1:
duration: 170709 # micro seconds
frequency: 2048000000 #bytes
frequency: 2052096000 #bytes
otherLevels:
duration: 137202 # micro seconds
frequency: 2048409600 #bytes
frequency: 2056192000 #bytes
33 changes: 23 additions & 10 deletions scripts/radossim.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def kvAndAioThread(env, srcQ, latencyModel, batchManagement, data=None, useCoDel
req = (req, kvQDispatch, kvCommit)
data.append(req)
if useCoDel:
batchManagement.manageBatch(kvBatch, batchReqSize, kvQDispatch, kvCommit)
batchManagement.manageBatch(kvBatch, batchReqSize, aioSubmit, kvCommit)


# Batch incoming requests and process
Expand Down Expand Up @@ -142,9 +142,10 @@ def __init__(self, queue, minLatTarget=5000, initInterval=100000):
self.batchUpSize = lambda x: int(x + 1)
# written data state
self.bytesWritten = 0
self.maxQueueLen = 0
self.batchSizeLog = []
self.timeLog = []
self.batchSizeLog.append(self.batchSize)
self.batchSizeLog.append(self.batchSizeInit)
self.timeLog.append(0)

def manageBatch(self, batch, batchSize, dispatchTime, commitTime):
Expand All @@ -153,6 +154,7 @@ def manageBatch(self, batch, batchSize, dispatchTime, commitTime):
# Account latencies
osdQLat = arrivalKV - arrivalOSD
kvQLat = dispatchTime - arrivalKV
# print(kvQLat)
self.bytesWritten += reqSize
self.count += 1
self.lat += osdQLat + kvQLat
Expand Down Expand Up @@ -189,6 +191,10 @@ def fightBufferbloat(self, currQLat, currentTime):
self.batchSizing(False)
self.minLat = None
self.intervalStart = currentTime
self.maxQueueLen = 0
else:
if self.maxQueueLen < len(self.queue.items):
self.maxQueueLen = len(self.queue.items)

def batchSizing(self, isTooLarge):
if isTooLarge:
Expand All @@ -197,13 +203,17 @@ def batchSizing(self, isTooLarge):
self.batchSize = self.batchSizeInit
else:
self.batchSize = self.batchDownSize(self.batchSize)
if self.batchSize == 0:
self.batchSize = 1
print("new batch size is", self.batchSize)
elif self.batchSize != float("inf"):
#elif self.batchSize != float("inf"):
elif self.batchSize < self.maxQueueLen * 2:
# print('batch size', self.batchSize, 'gets larger')
self.batchSize = self.batchUpSize(self.batchSize)
# print('new batch size is', self.batchSize)
self.batchSizeLog.append(self.batchSize)
self.timeLog.append(self.queue._env.now)
if self.batchSize != float("inf"):
self.batchSizeLog.append(self.batchSize)
self.timeLog.append(self.queue._env.now)

def printLats(self, freq=1000):
if self.count % freq == 0:
Expand Down Expand Up @@ -271,7 +281,7 @@ def __init__(self):
# osdQ = simpy.Store(env) # infinite capacity

# KV queue (capacity translates into initial batch size)
aioQ = simpy.Store(env, 1024)
aioQ = simpy.Store(env)

# monitoring
queuLenMonitor = QueueLenMonitor()
Expand Down Expand Up @@ -320,15 +330,18 @@ def __init__(self):
duration = env.now / 1_000_000 # to sec
bytesWritten = latencyModel.bytesWritten
avgThroughput = bytesWritten / duration

print(bytesWritten/4096)
# fig, ax = plt.subplots(figsize=(8, 4))
# ax.grid(True)
# ax.set_title('title')
# ax.set_xlabel('x_label')
# ax.set_ylabel('Likelihood of occurrence')
# ax.plot(queuLenMonitor.logTimeList, queuLenMonitor.queueLenList)
# plt.show()

def Average(lst):
return sum(lst) / len(lst)
print(f'Batch size: {max(bm.batchSizeLog)}')
print(f'Time size: {len(bm.timeLog)}')
fig, ax = plt.subplots(figsize=(8, 4))
ax.grid(True)
ax.set_xlabel('time')
Expand Down Expand Up @@ -358,8 +371,8 @@ def __init__(self):
help='Use CoDel algorithm for batch sizing?'
)
args = parser.parse_args()
targetLat = 1000
measInterval = 2
targetLat = 500
measInterval = 1000
time = 60 * 1_000_000 # 5 mins
if args.useCoDel:
print('Using CoDel algorithm ...')
Expand Down

0 comments on commit cd34107

Please sign in to comment.