You need to sign in or sign up before continuing.
Commit 3d52f8b6 authored by Nilanjan Daw's avatar Nilanjan Daw

Deployment Aggressiveness parameter added

Support added for deployment aggressiveness parameter for implicit chains
parent 77e670aa
...@@ -37,6 +37,6 @@ ...@@ -37,6 +37,6 @@
}, },
"speculative_deployment": true, "speculative_deployment": true,
"JIT_deployment": true, "JIT_deployment": true,
"aggressivity": 0.6, "aggressivity": 0.2,
"id_size": 20 "id_size": 20
} }
\ No newline at end of file
...@@ -537,7 +537,10 @@ async function speculative_deployment(req, runtime) { ...@@ -537,7 +537,10 @@ async function speculative_deployment(req, runtime) {
console.log("mle_path", branchInfo.mle_path); console.log("mle_path", branchInfo.mle_path);
if (branchInfo.mle_path && branchInfo.mle_path.length > 1) { if (branchInfo.mle_path && branchInfo.mle_path.length > 1) {
/**
* calculating the depth upto which speculative deployment will work
*/
let deployDepth = branchInfo.mle_path.length * constants.aggressivity
if (constants.JIT_deployment) { if (constants.JIT_deployment) {
/** /**
* Perform Speculation with JIT * Perform Speculation with JIT
...@@ -559,13 +562,16 @@ async function speculative_deployment(req, runtime) { ...@@ -559,13 +562,16 @@ async function speculative_deployment(req, runtime) {
}), }),
headers: { 'Content-Type': 'application/json' }, headers: { 'Content-Type': 'application/json' },
}) })
/**
* Get the branch chain and the metrics data related to the MLE path
*/
Promise.all([metricsPromise, chainDataPromise]) Promise.all([metricsPromise, chainDataPromise])
.then(data => { .then(data => {
let metrics = new Map(), chainData = new Map() let metrics = new Map(), chainData = new Map()
let currentDelay = 0 let currentDelay = 0
data[0] = data[0].results, data[1] = data[1].results data[0] = data[0].results, data[1] = data[1].results
for (let i = 0; i < branchInfo.mle_path.length; i++) {
for (let i = 0; i < deployDepth; i++) {
let id = data[0][i].id let id = data[0][i].id
metrics[id] = data[0][i].docs[0].ok metrics[id] = data[0][i].docs[0].ok
id = data[1][i].id id = data[1][i].id
...@@ -575,17 +581,14 @@ async function speculative_deployment(req, runtime) { ...@@ -575,17 +581,14 @@ async function speculative_deployment(req, runtime) {
} }
currentDelay = metrics[branchInfo.mle_path[0].id].container.starttime currentDelay = metrics[branchInfo.mle_path[0].id].container.starttime
for (let i = 1; i < deployDepth; i++) {
for (let i = 1; i < branchInfo.mle_path.length; i++) {
let parent = chainData[branchInfo.mle_path[i - 1].id] let parent = chainData[branchInfo.mle_path[i - 1].id]
let self = branchInfo.mle_path[i].id let self = branchInfo.mle_path[i].id
console.log(self); console.log(self);
console.log("parent branches", parent.branches.get(self)[1]);
currentDelay += parent.branches.get(self)[1] currentDelay += parent.branches.get(self)[1]
let invokeTime = currentDelay - metrics[self].container.starttime let invokeTime = currentDelay - metrics[self].container.starttime
invokeTime = (invokeTime < 0)? 0: invokeTime invokeTime = (invokeTime < 0)? 0: invokeTime
console.log(self, "invoke time:", currentDelay - metrics[self].container.starttime); console.log(self, "current delay", currentDelay, "invoke time:", currentDelay - metrics[self].container.starttime);
console.log("current delay", currentDelay, "start time", metrics[self].container.starttime);
setTimeout(chainHandler.notify, invokeTime, "container", self) setTimeout(chainHandler.notify, invokeTime, "container", self)
} }
...@@ -595,9 +598,11 @@ async function speculative_deployment(req, runtime) { ...@@ -595,9 +598,11 @@ async function speculative_deployment(req, runtime) {
/** /**
* Perform Speculation without JIT * Perform Speculation without JIT
*/ */
let depthCounter = 0
for (let node of branchInfo.mle_path) { for (let node of branchInfo.mle_path) {
// console.log(functionToResource); // console.log(functionToResource);
if (depthCounter > deployDepth)
break
if (!functionToResource.has(node.node + runtime) && !db.has(node.node + runtime)) { if (!functionToResource.has(node.node + runtime) && !db.has(node.node + runtime)) {
console.log("Deploying according to MLE path: ", node.node); console.log("Deploying according to MLE path: ", node.node);
...@@ -608,6 +613,7 @@ async function speculative_deployment(req, runtime) { ...@@ -608,6 +613,7 @@ async function speculative_deployment(req, runtime) {
producer.send(payload, function () { }) producer.send(payload, function () { })
db.set(node.node + runtime, []) db.set(node.node + runtime, [])
} }
depthCounter++
} }
} }
} }
......
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