Commit 4d37177c authored by nilanjandaw's avatar nilanjandaw

added request sampler for prob model

parent ca61f8b9
{"id":"192.168.31.51","master_node":"10.129.6.5"}
\ No newline at end of file
{"id":"10.196.6.51","master_node":"10.129.6.5"}
\ No newline at end of file
......@@ -47,10 +47,7 @@ function generateExecutor(functionPath, functionHash) {
}
function reverseProxy(req, res, functionToResource, resourceMap) {
if (req.headers["x-resource-id"]) {
branchChainPredictor(req, resourceMap)
}
return new Promise((resolve, reject) => {
let runtime = req.body.runtime
let id = req.params.id + runtime
......@@ -144,18 +141,39 @@ function compare(a, b) {
}
function branchChainPredictor(req, resourceMap) {
console.log(req.headers['x-resource-id']);
if (req.headers['x-resource-id'] === undefined) {
let functionHash = req.params.id
if (functionBranchTree.has(functionHash)) {
let branchInfo = functionBranchTree.get(functionHash)
branchInfo.req_count++
} else {
let data = {
req_count: 1,
parent: true,
branches: new Map()
}
functionBranchTree.set(functionHash, data)
}
} else {
let resource_id = req.headers['x-resource-id']
let resource = resourceMap.get(resource_id)
let forwardBranch = req.params.id
if (!functionBranchTree.has(resource.functionHash)) {
let data = {
req_count: 1,
parent: false,
branches: new Map()
}
data.branches.set(forwardBranch, 1)
functionBranchTree.set(resource.functionHash, data)
} else {
let branchInfo = functionBranchTree.get(resource.functionHash)
if (!branchInfo.parent)
branchInfo.req_count++
if (branchInfo.branches.has(forwardBranch)) {
let branchProb = branchInfo.branches.get(forwardBranch)
......@@ -171,6 +189,8 @@ function branchChainPredictor(req, resourceMap) {
branchInfo.branches.set(branch, prob)
}
}
}
console.log(functionBranchTree);
}
......
#!/usr/bin/env node
var mime = require('./mime.js');
var file = process.argv[2];
var type = mime.lookup(file);
process.stdout.write(type + '\n');
cJSON @ f790e17b
Subproject commit f790e17b6cecef030c4eda811149d238c2085fcf
nlib @ 75bc1a11
Subproject commit 75bc1a11e2a10cf249f566b40c85d6526c16f123
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