Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
xanadu
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
SYNERG
xanadu
Commits
05a35530
Commit
05a35530
authored
Apr 27, 2020
by
Nilanjan Daw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
JIT deployment for implicit chains
Added support for JIT deployment of implicit chains. Primary testing done
parent
190809a4
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
85 additions
and
24 deletions
+85
-24
dispatch_system/dispatch_manager/explicit_chain_handler.js
dispatch_system/dispatch_manager/explicit_chain_handler.js
+1
-1
dispatch_system/dispatch_manager/index.js
dispatch_system/dispatch_manager/index.js
+84
-23
No files found.
dispatch_system/dispatch_manager/explicit_chain_handler.js
View file @
05a35530
...
@@ -522,5 +522,5 @@ function createDirectory(path) {
...
@@ -522,5 +522,5 @@ function createDirectory(path) {
module
.
exports
=
{
module
.
exports
=
{
router
router
,
notify
}
}
dispatch_system/dispatch_manager/index.js
View file @
05a35530
...
@@ -515,26 +515,86 @@ function autoscalar() {
...
@@ -515,26 +515,86 @@ function autoscalar() {
*
*
* FIXME: Currently supports homogenous runtime chain i.e takes runtime as a param.
* FIXME: Currently supports homogenous runtime chain i.e takes runtime as a param.
* Change it to also profile runtime
* Change it to also profile runtime
* FIXME: Hardcoded container as a runtime. Make dynamic.
*/
*/
async
function
speculative_deployment
(
req
,
runtime
)
{
async
function
speculative_deployment
(
req
,
runtime
)
{
if
(
constants
.
speculative_deployment
&&
req
.
headers
[
'
x-resource-id
'
]
===
undefined
)
{
if
(
constants
.
speculative_deployment
&&
req
.
headers
[
'
x-resource-id
'
]
===
undefined
)
{
// console.log(functionBranchTree, req.params.id);
// console.log(functionBranchTree, req.params.id);
if
(
!
functionBranchTree
.
has
(
req
.
params
.
id
))
{
let
data
=
await
libSupport
.
fetchData
(
implicitChainDB
+
req
.
params
.
id
)
if
(
data
.
error
!==
"
not_found
"
)
{
data
.
branches
=
new
Map
(
data
.
branches
)
functionBranchTree
.
set
(
req
.
params
.
id
,
data
)
}
}
console
.
log
(
util
.
inspect
(
functionBranchTree
,
false
,
null
,
true
/* enable colors */
));
if
(
functionBranchTree
.
has
(
req
.
params
.
id
))
{
if
(
functionBranchTree
.
has
(
req
.
params
.
id
))
{
let
branchInfo
=
functionBranchTree
.
get
(
req
.
params
.
id
)
let
branchInfo
=
functionBranchTree
.
get
(
req
.
params
.
id
)
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
)
{
if
(
constants
.
JIT_deployment
)
{
/**
* Perform Speculation with JIT
*/
for
(
let
node
of
branchInfo
.
mle_path
)
for
(
let
node
of
branchInfo
.
mle_path
)
node
.
id
=
node
.
node
node
.
id
=
node
.
node
let
metrics
=
await
libSupport
.
fetchData
(
metricsDB
+
"
_bulk_get
"
,
{
let
metricsPromise
=
libSupport
.
fetchData
(
metricsDB
+
"
_bulk_get
"
,
{
method
:
'
post
'
,
body
:
JSON
.
stringify
({
docs
:
branchInfo
.
mle_path
}),
headers
:
{
'
Content-Type
'
:
'
application/json
'
},
})
let
chainDataPromise
=
libSupport
.
fetchData
(
implicitChainDB
+
"
_bulk_get
"
,
{
method
:
'
post
'
,
method
:
'
post
'
,
body
:
JSON
.
stringify
({
body
:
JSON
.
stringify
({
docs
:
branchInfo
.
mle_path
docs
:
branchInfo
.
mle_path
}),
}),
headers
:
{
'
Content-Type
'
:
'
application/json
'
},
headers
:
{
'
Content-Type
'
:
'
application/json
'
},
})
})
console
.
log
(
util
.
inspect
(
metrics
,
false
,
null
,
true
/* enable colors */
))
Promise
.
all
([
metricsPromise
,
chainDataPromise
])
.
then
(
data
=>
{
let
metrics
=
new
Map
(),
chainData
=
new
Map
()
let
currentDelay
=
0
data
[
0
]
=
data
[
0
].
results
,
data
[
1
]
=
data
[
1
].
results
for
(
let
i
=
0
;
i
<
branchInfo
.
mle_path
.
length
;
i
++
)
{
let
id
=
data
[
0
][
i
].
id
metrics
[
id
]
=
data
[
0
][
i
].
docs
[
0
].
ok
id
=
data
[
1
][
i
].
id
chainData
[
id
]
=
data
[
1
][
i
].
docs
[
0
].
ok
if
(
chainData
[
id
])
chainData
[
id
].
branches
=
new
Map
(
chainData
[
id
].
branches
)
}
currentDelay
=
metrics
[
branchInfo
.
mle_path
[
0
].
id
].
container
.
starttime
for
(
let
i
=
1
;
i
<
branchInfo
.
mle_path
.
length
;
i
++
)
{
let
parent
=
chainData
[
branchInfo
.
mle_path
[
i
-
1
].
id
]
let
self
=
branchInfo
.
mle_path
[
i
].
id
console
.
log
(
self
);
console
.
log
(
"
parent branches
"
,
parent
.
branches
.
get
(
self
)[
1
]);
currentDelay
+=
parent
.
branches
.
get
(
self
)[
1
]
let
invokeTime
=
currentDelay
-
metrics
[
self
].
container
.
starttime
invokeTime
=
(
invokeTime
<
0
)?
0
:
invokeTime
console
.
log
(
self
,
"
invoke time:
"
,
currentDelay
-
metrics
[
self
].
container
.
starttime
);
console
.
log
(
"
current delay
"
,
currentDelay
,
"
start time
"
,
metrics
[
self
].
container
.
starttime
);
setTimeout
(
chainHandler
.
notify
,
invokeTime
,
"
container
"
,
self
)
}
})
}
else
{
/**
* Perform Speculation without JIT
*/
for
(
let
node
of
branchInfo
.
mle_path
)
{
for
(
let
node
of
branchInfo
.
mle_path
)
{
// console.log(functionToResource);
// console.log(functionToResource);
...
@@ -552,6 +612,7 @@ async function speculative_deployment(req, runtime) {
...
@@ -552,6 +612,7 @@ async function speculative_deployment(req, runtime) {
}
}
}
}
}
}
}
}
}
setInterval
(
libSupport
.
metrics
.
broadcastMetrics
,
5000
)
setInterval
(
libSupport
.
metrics
.
broadcastMetrics
,
5000
)
setInterval
(
autoscalar
,
1000
);
setInterval
(
autoscalar
,
1000
);
...
...
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