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
407c256c
Commit
407c256c
authored
Feb 20, 2020
by
nilanjandaw
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://git.cse.iitb.ac.in/synerg/xanadu
parents
cc255a08
e8fdecac
Changes
13
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
70 additions
and
32 deletions
+70
-32
.gitignore
.gitignore
+3
-3
.gitmodules
.gitmodules
+2
-2
readme.md
readme.md
+39
-16
resource_manager/README
resource_manager/README
+0
-3
resource_system/build.linux
resource_system/build.linux
+0
-0
resource_system/src/arbiter/arbiter.c
resource_system/src/arbiter/arbiter.c
+5
-4
resource_system/src/arbiter/time.c
resource_system/src/arbiter/time.c
+0
-0
resource_system/src/common/cJSON
resource_system/src/common/cJSON
+0
-0
resource_system/src/common/kafka.h
resource_system/src/common/kafka.h
+0
-0
resource_system/src/common/nlib
resource_system/src/common/nlib
+0
-0
resource_system/src/grunt/grunt.c
resource_system/src/grunt/grunt.c
+0
-0
resource_system/src/grunt/time.c
resource_system/src/grunt/time.c
+0
-0
resource_system/src/test/test.c
resource_system/src/test/test.c
+21
-4
No files found.
.gitignore
View file @
407c256c
...
...
@@ -4,6 +4,6 @@ node_modules
package-lock.json
firecracker*
secrets.json
resource_
manager
/bin/**
resource_
manager
/version.linux
resource_
system
/bin/**
resource_
system
/version.linux
grunt
.gitmodules
View file @
407c256c
[submodule "resource_manager/src/common/cJSON"]
path = resource_
manager
/src/common/cJSON
path = resource_
system
/src/common/cJSON
url = https://github.com/DaveGamble/cJSON
[submodule "resource_manager/src/common/nlib"]
path = resource_
manager
/src/common/nlib
path = resource_
system
/src/common/nlib
url = https://github.com/namandixit/nlib
readme.md
View file @
407c256c
...
...
@@ -23,6 +23,7 @@ The Dispatch Manager (DM) sends a request to the Resource Manager (RM), detailin
```
javascript
{
"
resource_id
"
:
"
unique-transaction-id
"
,
"
timestamp
"
:
"
iso-8601-timestamp
"
,
"
memory
"
:
1024
,
// in MiB
...
// Any other resources
}
...
...
@@ -33,6 +34,7 @@ Format:
```
javascript
{
"
resource_id
"
:
"
unique-transaction-id
"
,
"
timestamp
"
:
"
iso-8601-timestamp
"
,
// "port": 2343 --- NOT IMPLEMENTED YET
"
grunts
"
:
[
"
a
"
,
"
b
"
,
...]
// List of machine IDs
}
...
...
@@ -41,9 +43,10 @@ Format:
Once the runtime entity has been launched (or the launch has failed), the Executor sends back a status message on the
`LOG_COMMON`
topic.
```
javascript
{
"
node_id
"
"
resource_id
"
"
function_id
"
"
node_id
"
:
"
uique-machine-id
"
,
"
resource_id
"
:
"
logical-entity-id
"
,
"
function_id
"
:
"
unique-function-id
"
,
"
timestamp
"
:
"
iso-8601-timestamp
"
,
"
reason
"
:
"
deployment
"
/
"
termination
"
"
status
"
:
true
/
false
// Only valid if reason==deployment
}
...
...
@@ -53,25 +56,28 @@ Instrumentation data is also sent on the `LOG_COMMON` topic. This data is sent f
and whoever needs the data is allowed to read it. Each message is required to have atleast three fields:
`node_id`
,
`resource_id`
and
`function_id`
.
```
javascript
{
// Example message from Executor
"
node_id
"
"
resource_id
"
"
function_id
"
"
cpu
"
"
memory
"
"
network
"
"
node_id
"
:
"
uique-machine-id
"
,
"
resource_id
"
:
"
logical-entity-id
"
,
"
function_id
"
:
"
unique-function-id
"
,
"
timestamp
"
:
"
iso-8601-timestamp
"
,
"
cpu
"
:
343
,
// in MHz
"
memory
"
:
534
,
// in MiB
"
network
"
:
234
// in KBps
}
{
// Example message from reverse proxy
"
node_id
"
"
resource_id
"
"
function_id
"
"
average_fn_time
"
"
node_id
"
:
"
uique-machine-id
"
,
"
resource_id
"
:
"
logical-entity-id
"
,
"
function_id
"
:
"
unique-function-id
"
,
"
timestamp
"
:
"
iso-8601-timestamp
"
,
"
average_fn_time
"
:
23
// in ms
}
{
// Example message from dispatch manager
"
node_id
"
"
resource_id
"
"
function_id
"
"
node_id
"
:
"
uique-machine-id
"
,
"
resource_id
"
:
"
logical-entity-id
"
,
"
function_id
"
:
"
unique-function-id
"
,
"
timestamp
"
:
"
iso-8601-timestamp
"
,
"
coldstart_time
"
}
```
...
...
@@ -206,6 +212,7 @@ Upon being launched, each Resource Daemon (RD) sends a JOIN message to the RM on
```
javascript
{
"node_id": "unique-machine-id",
"timestamp" : "iso-8601-timestamp"
}
```
...
...
@@ -215,16 +222,30 @@ resources being tracked by RDs on each machine. This data is cached by the RM.
```
javascript
{
"node_id": "unique-machine-id",
"timestamp" : "iso-8601-timestamp",
"memory": 1024, // in MiB
... // Any other resources
}
```
If the RM recieves a heartbeat from an RD which has not joined before (due to either the RM dying and some older messages being stuck in Kafka),
it sends a rejoin command to the RD on topic `REJOIN_RM_2_RD`.
```
javascript
{
"node_id": "unique-machine-id",
"timestamp" : "iso-8601-timestamp"
}
```
Also, if the RM doesn't recieve heartbeats from some RD for some amount of time, it assumes that the RD is dead and frees its resources.
If the RD sends a beat after this, the rejoin message is sent.
The RM, upon recieving the request from the DM, checks its local cache to find a suitable machine. If it finds some, it sends a message back to the
DM on topic `RESPONSE_RM_2_DM`.
```
javascript
{
"resource_id": "unique-transaction-id",
"timestamp" : "iso-8601-timestamp",
// "port": 2343 --- NOT IMPLEMENTED YET
"nodes": ["a", "b", ...] // List of unique machine IDs
}
...
...
@@ -236,6 +257,7 @@ Format:
```
javascript
{
"resource_id": "unique-transaction-id",
"timestamp" : "iso-8601-timestamp",
"memory": 1024, // in MiB
... // Any other resources
}
...
...
@@ -246,6 +268,7 @@ The RDs recieve this message and send back whether on not they satisfy the const
{
"node_id": "unique-machine-id",
"resource_id": "unique-transaction-id",
"timestamp" : "iso-8601-timestamp",
"success" : 0/1 // 0 = fail, 1 = success
}
```
...
...
resource_manager/README
deleted
100644 → 0
View file @
cc255a08
Dependency: Clang compiler
Run "build.linux" script to compile the project.
resource_
manager
/build.linux
→
resource_
system
/build.linux
View file @
407c256c
File moved
resource_
manager
/src/arbiter/arbiter.c
→
resource_
system
/src/arbiter/arbiter.c
View file @
407c256c
...
...
@@ -250,7 +250,7 @@ Sint main (Sint argc, Char *argv[])
Char
*
node_id
=
cJSON_GetObjectItem
(
root
,
"node_id"
)
->
valuestring
;
Char
*
resource_id
=
cJSON_GetObjectItem
(
root
,
"resource_id"
)
->
valuestring
;
Char
*
function_id
=
cJSON_GetObjectItem
(
root
,
"function_id"
)
->
valuestring
;
printf
(
"%s
\n
"
,
cJSON_Print
(
cJSON_Parse
((
char
*
)
kafka_message_read
->
payload
)));
unused_variable
(
node_id
);
unused_variable
(
resource_id
);
unused_variable
(
function_id
);
...
...
@@ -295,15 +295,15 @@ Sint main (Sint argc, Char *argv[])
Char
*
topic
=
NULL
;
if
(
c
.
kind
==
Command_REQUEST_ARBITER_2_GRUNT
)
{
topic
=
"REQUEST_
ARBITER_2_GRUNT
"
;
topic
=
"REQUEST_
RM_2_RD
"
;
sbufPrint
(
output
,
"{
\n\"
resource_id
\"
:
\"
%s
\"
"
,
c
.
resource_id
);
sbufPrint
(
output
,
",
\n\"
memory
\"
: %d
\n
"
,
c
.
req_a2g
.
memory
);
sbufPrint
(
output
,
"
\n
}
\n
"
);
}
else
if
(
c
.
kind
==
Command_RESPONSE_ARBITER_2_DM
)
{
topic
=
"RESPONSE_
ARBITER_2_DISPATCHER
"
;
topic
=
"RESPONSE_
RM_2_DM
"
;
sbufPrint
(
output
,
"{
\n\"
id
\"
:
\"
%s
\"
"
,
c
.
resource_id
);
sbufPrint
(
output
,
"{
\n\"
resource_
id
\"
:
\"
%s
\"
"
,
c
.
resource_id
);
sbufPrint
(
output
,
",
\n\"
nodes
\"
: ["
);
for
(
Size
k
=
0
;
k
<
sbufElemin
(
c
.
res_a2d
.
grunt_ids
);
k
++
)
{
sbufPrint
(
output
,
"
\"
%s
\"
"
,
c
.
res_a2d
.
grunt_ids
[
k
]);
...
...
@@ -321,6 +321,7 @@ Sint main (Sint argc, Char *argv[])
return
-
1
;
}
}
sbufDelete
(
output
);
free
(
c
.
resource_id
);
sbufUnsortedRemove
(
commands
,
j
);
...
...
resource_
manager
/src/arbiter/time.c
→
resource_
system
/src/arbiter/time.c
View file @
407c256c
File moved
cJSON
@
f790e17b
File moved
resource_
manager
/src/common/kafka.h
→
resource_
system
/src/common/kafka.h
View file @
407c256c
File moved
nlib
@
75bc1a11
File moved
resource_
manager
/src/grunt/grunt.c
→
resource_
system
/src/grunt/grunt.c
View file @
407c256c
File moved
resource_
manager
/src/grunt/time.c
→
resource_
system
/src/grunt/time.c
View file @
407c256c
File moved
resource_
manager
/src/test/test.c
→
resource_
system
/src/test/test.c
View file @
407c256c
...
...
@@ -48,11 +48,28 @@ int main(int argc, char** argv)
Kafka
kafka
=
{
0
};
kafka
.
writer
=
kafkaCreateWriter
(
&
kafka
,
"10.129.6.5:9092"
);
#define CREATE_TOPIC(s) \
do { \
if (kafkaCreateTopic(&kafka, s, 1, 1) == -1) { \
rd_kafka_destroy(kafka.writer); \
return -1; \
} \
} while (0)
CREATE_TOPIC
(
"REQUEST_DM_2_RM"
);
//
CREATE_TOPIC
(
"RESPONSE_RM_2_DM"
);
CREATE_TOPIC
(
"REQUEST_RM_2_RD"
);
CREATE_TOPIC
(
"RESPONSE_RD_2_RM"
);
//
CREATE_TOPIC
(
"JOIN_RD_2_RM"
);
//
CREATE_TOPIC
(
"HEARTBEAT_RD_2_RM"
);
//
CREATE_TOPIC
(
"LOG_COMMON"
);
//
kafka
.
reader
=
kafkaCreateReader
(
&
kafka
,
"10.129.6.5:9092"
);
rd_kafka_topic_partition_list_t
*
kafka_reader_topics
=
rd_kafka_topic_partition_list_new
(
1
);
kafkaSubscribe
(
&
kafka
,
kafka_reader_topics
,
"RESPONSE_
ARBITER_2_DISPATCHER
"
);
kafkaSubscribe
(
&
kafka
,
kafka_reader_topics
,
"RESPONSE_
RM_2_DM
"
);
rd_kafka_resp_err_t
kafka_reader_topics_err
=
rd_kafka_subscribe
(
kafka
.
reader
,
kafka_reader_topics
);
rd_kafka_topic_partition_list_destroy
(
kafka_reader_topics
);
...
...
@@ -67,14 +84,14 @@ int main(int argc, char** argv)
Char
*
output
=
NULL
;
Sint
id
=
(
Sint
)
time
(
NULL
);
sbufPrint
(
output
,
"{
\n\"
id
\"
:
\"
%d
\"
"
,
id
);
sbufPrint
(
output
,
"{
\n\"
resource_
id
\"
:
\"
%d
\"
"
,
id
);
sbufPrint
(
output
,
",
\n\"
memory
\"
: %d"
,
memory_required
);
sbufPrint
(
output
,
"
\n
}
\n
"
);
printf
(
"Sending to Arbiter:
\n
%s
\n
"
,
cJSON_Print
(
cJSON_Parse
(
output
)));
if
(
output
!=
NULL
)
{
if
(
!
kafkaWrite
(
kafka
.
writer
,
"REQUEST_D
ISPATCHER_2_ARBITER
"
,
"rm_test"
,
output
))
{
if
(
!
kafkaWrite
(
kafka
.
writer
,
"REQUEST_D
M_2_RM
"
,
"rm_test"
,
output
))
{
return
-
1
;
}
}
...
...
@@ -116,7 +133,7 @@ int main(int argc, char** argv)
if
(
root
==
NULL
)
{
// TODO(naman): Error
}
else
{
cJSON
*
array
=
cJSON_GetObjectItem
(
root
,
"id"
);
cJSON
*
array
=
cJSON_GetObjectItem
(
root
,
"
resource_
id"
);
cJSON
*
elem
=
NULL
;
cJSON_ArrayForEach
(
elem
,
array
)
{
printf
(
"%s
\n
"
,
elem
->
valuestring
);
...
...
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