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
0357774b
Commit
0357774b
authored
Sep 15, 2021
by
Mahendra Patel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
commit_message
parent
3a6cef8c
Changes
67
Hide whitespace changes
Inline
Side-by-side
Showing
67 changed files
with
983 additions
and
161 deletions
+983
-161
dispatch_system/benchmark_dispatcher.py
dispatch_system/benchmark_dispatcher.py
+75
-55
dispatch_system/benchmark_dispatcher2.py
dispatch_system/benchmark_dispatcher2.py
+149
-0
dispatch_system/benchmark_dispatcher_receive.py
dispatch_system/benchmark_dispatcher_receive.py
+78
-0
dispatch_system/constants.json
dispatch_system/constants.json
+3
-3
dispatch_system/constants_local.json
dispatch_system/constants_local.json
+4
-3
dispatch_system/dispatch_daemon/execute.js
dispatch_system/dispatch_daemon/execute.js
+15
-9
dispatch_system/dispatch_daemon/index.js
dispatch_system/dispatch_daemon/index.js
+2
-1
dispatch_system/dispatch_daemon/lib.js
dispatch_system/dispatch_daemon/lib.js
+2
-1
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
+23
-7
dispatch_system/dispatch_manager/lib.js
dispatch_system/dispatch_manager/lib.js
+27
-22
dispatch_system/dispatch_manager/metrics.js
dispatch_system/dispatch_manager/metrics.js
+2
-2
dispatch_system/dispatch_manager/nic.tgz
dispatch_system/dispatch_manager/nic.tgz
+0
-0
dispatch_system/dispatch_manager/nic/Makefile-nfp4build
dispatch_system/dispatch_manager/nic/Makefile-nfp4build
+1
-3
dispatch_system/dispatch_manager/nic/assign_ip.sh
dispatch_system/dispatch_manager/nic/assign_ip.sh
+32
-4
dispatch_system/dispatch_manager/nic/build_offload.sh
dispatch_system/dispatch_manager/nic/build_offload.sh
+1
-1
dispatch_system/dispatch_manager/nic/p4src/Makefile-nfp4build
...atch_system/dispatch_manager/nic/p4src/Makefile-nfp4build
+0
-0
dispatch_system/dispatch_manager/nic/p4src/bin
dispatch_system/dispatch_manager/nic/p4src/bin
+0
-0
dispatch_system/dispatch_manager/nic/p4src/command_to_offload
...atch_system/dispatch_manager/nic/p4src/command_to_offload
+0
-0
dispatch_system/dispatch_manager/nic/p4src/echo.bmv2.json
dispatch_system/dispatch_manager/nic/p4src/echo.bmv2.json
+0
-0
dispatch_system/dispatch_manager/nic/p4src/echo.p4cfg
dispatch_system/dispatch_manager/nic/p4src/echo.p4cfg
+3
-3
dispatch_system/dispatch_manager/nic/p4src/echo.p4info.json
dispatch_system/dispatch_manager/nic/p4src/echo.p4info.json
+0
-0
dispatch_system/dispatch_manager/nic/p4src/echo.yml
dispatch_system/dispatch_manager/nic/p4src/echo.yml
+0
-0
dispatch_system/dispatch_manager/nic/p4src/ethernet.p4
dispatch_system/dispatch_manager/nic/p4src/ethernet.p4
+0
-0
dispatch_system/dispatch_manager/nic/p4src/includes/defines.p4
...tch_system/dispatch_manager/nic/p4src/includes/defines.p4
+1
-0
dispatch_system/dispatch_manager/nic/p4src/includes/headers.p4
...tch_system/dispatch_manager/nic/p4src/includes/headers.p4
+19
-1
dispatch_system/dispatch_manager/nic/p4src/includes/parsers.p4
...tch_system/dispatch_manager/nic/p4src/includes/parsers.p4
+14
-0
dispatch_system/dispatch_manager/nic/p4src/ipv4.p4
dispatch_system/dispatch_manager/nic/p4src/ipv4.p4
+0
-0
dispatch_system/dispatch_manager/nic/p4src/mds.p4
dispatch_system/dispatch_manager/nic/p4src/mds.p4
+0
-0
dispatch_system/dispatch_manager/nic/p4src/memory.c
dispatch_system/dispatch_manager/nic/p4src/memory.c
+0
-0
dispatch_system/dispatch_manager/nic/p4src/offload.bmv2.json
dispatch_system/dispatch_manager/nic/p4src/offload.bmv2.json
+0
-0
dispatch_system/dispatch_manager/nic/p4src/offload.p4info.json
...tch_system/dispatch_manager/nic/p4src/offload.p4info.json
+0
-0
dispatch_system/dispatch_manager/nic/p4src/offload.txt
dispatch_system/dispatch_manager/nic/p4src/offload.txt
+0
-0
dispatch_system/dispatch_manager/nic/p4src/orchestrator.bmv2.json
..._system/dispatch_manager/nic/p4src/orchestrator.bmv2.json
+56
-4
dispatch_system/dispatch_manager/nic/p4src/orchestrator.p4info.json
...ystem/dispatch_manager/nic/p4src/orchestrator.p4info.json
+1
-1
dispatch_system/dispatch_manager/nic/p4src/orchestrator.yml
dispatch_system/dispatch_manager/nic/p4src/orchestrator.yml
+22
-7
dispatch_system/dispatch_manager/nic/p4src/orchestrator2.p4
dispatch_system/dispatch_manager/nic/p4src/orchestrator2.p4
+161
-0
dispatch_system/dispatch_manager/nic/p4src/prime.c
dispatch_system/dispatch_manager/nic/p4src/prime.c
+0
-0
dispatch_system/dispatch_manager/nic/p4src/routing_benchmark.bmv2.json
...em/dispatch_manager/nic/p4src/routing_benchmark.bmv2.json
+0
-0
dispatch_system/dispatch_manager/nic/p4src/routing_benchmark.p4
...ch_system/dispatch_manager/nic/p4src/routing_benchmark.p4
+0
-0
dispatch_system/dispatch_manager/nic/p4src/routing_benchmark.p4info.json
.../dispatch_manager/nic/p4src/routing_benchmark.p4info.json
+0
-0
dispatch_system/dispatch_manager/nic/p4src/routing_benchmark.yml
...h_system/dispatch_manager/nic/p4src/routing_benchmark.yml
+0
-0
dispatch_system/dispatch_manager/nic/p4src/sched.p4
dispatch_system/dispatch_manager/nic/p4src/sched.p4
+0
-0
dispatch_system/dispatch_manager/nic/p4src/sched.txt
dispatch_system/dispatch_manager/nic/p4src/sched.txt
+0
-0
dispatch_system/dispatch_manager/nic/p4src/sched16.p4
dispatch_system/dispatch_manager/nic/p4src/sched16.p4
+0
-0
dispatch_system/dispatch_manager/nic/p4src/test.bmv2.json
dispatch_system/dispatch_manager/nic/p4src/test.bmv2.json
+3
-3
dispatch_system/dispatch_manager/nic/p4src/test.p4
dispatch_system/dispatch_manager/nic/p4src/test.p4
+0
-0
dispatch_system/dispatch_manager/nic/p4src/test.p4cfg
dispatch_system/dispatch_manager/nic/p4src/test.p4cfg
+0
-0
dispatch_system/dispatch_manager/nic/p4src/test.p4info.json
dispatch_system/dispatch_manager/nic/p4src/test.p4info.json
+0
-0
dispatch_system/dispatch_manager/nic/p4src/test.yml
dispatch_system/dispatch_manager/nic/p4src/test.yml
+4
-4
dispatch_system/dispatch_manager/nic/receive_reply.py
dispatch_system/dispatch_manager/nic/receive_reply.py
+1
-1
dispatch_system/dispatch_manager/nic/send.py
dispatch_system/dispatch_manager/nic/send.py
+13
-7
dispatch_system/dispatch_manager/nic/send.sh
dispatch_system/dispatch_manager/nic/send.sh
+2
-1
dispatch_system/dispatch_manager/nic/send2.py
dispatch_system/dispatch_manager/nic/send2.py
+182
-0
dispatch_system/dispatch_manager/nic/send_docker.sh
dispatch_system/dispatch_manager/nic/send_docker.sh
+2
-1
dispatch_system/dispatch_manager/nic/smartnic_dispatch_monitor.py
..._system/dispatch_manager/nic/smartnic_dispatch_monitor.py
+3
-1
dispatch_system/dispatch_manager/repository/worker_env/env_udp.js
..._system/dispatch_manager/repository/worker_env/env_udp.js
+15
-8
dispatch_system/dispatch_manager/rm.js
dispatch_system/dispatch_manager/rm.js
+12
-1
dispatch_system/dispatch_manager/shared_meta.js
dispatch_system/dispatch_manager/shared_meta.js
+4
-2
dispatch_system/log_listener.js
dispatch_system/log_listener.js
+2
-2
dispatch_system/setup_topics.js
dispatch_system/setup_topics.js
+2
-2
docker-compose.yml
docker-compose.yml
+1
-0
docker-compose2.txt
docker-compose2.txt
+41
-0
test.js
test.js
+1
-0
test1.js
test1.js
+1
-0
test3.js
test3.js
+1
-0
test4.js
test4.js
+1
-0
No files found.
dispatch_system/benchmark_dispatcher.py
View file @
0357774b
...
@@ -4,7 +4,7 @@ import time
...
@@ -4,7 +4,7 @@ import time
import
threading
import
threading
import
random
import
random
import
time
import
time
import
numpy
as
np
import
argparse
import
argparse
parser
=
argparse
.
ArgumentParser
(
description
=
'Mininet demo'
)
parser
=
argparse
.
ArgumentParser
(
description
=
'Mininet demo'
)
...
@@ -13,6 +13,8 @@ parser.add_argument('--fid', help='Funtion id',
...
@@ -13,6 +13,8 @@ parser.add_argument('--fid', help='Funtion id',
type
=
int
,
action
=
"store"
,
required
=
False
)
type
=
int
,
action
=
"store"
,
required
=
False
)
parser
.
add_argument
(
'--c'
,
help
=
'Concurrency'
,
parser
.
add_argument
(
'--c'
,
help
=
'Concurrency'
,
type
=
int
,
action
=
"store"
,
required
=
True
)
type
=
int
,
action
=
"store"
,
required
=
True
)
parser
.
add_argument
(
'--t'
,
help
=
'Runtime'
,
type
=
int
,
action
=
"store"
,
required
=
True
)
group
=
parser
.
add_mutually_exclusive_group
(
required
=
True
)
group
=
parser
.
add_mutually_exclusive_group
(
required
=
True
)
group
.
add_argument
(
'--rps'
,
help
=
'Requests per second'
,
group
.
add_argument
(
'--rps'
,
help
=
'Requests per second'
,
type
=
int
,
action
=
"store"
)
type
=
int
,
action
=
"store"
)
...
@@ -25,106 +27,100 @@ args = parser.parse_args()
...
@@ -25,106 +27,100 @@ args = parser.parse_args()
PORT
=
8000
PORT
=
8000
dataInt
=
0
dataInt
=
0
fid
=
args
.
fid
fid
=
args
.
fid
runtime
=
args
.
t
concurrency
=
args
.
c
SERVER_IP
=
"192.168.2.3"
SERVER_IP
=
"192.168.2.3"
egress_time
=
[]
packet_holder
=
[
None
]
*
11
ingress_time
=
[]
ingress_time
=
{}
stop_thread
=
False
stop_thread
=
False
def
receive
():
def
receive
(
i
):
global
egress_time
,
stop_thread
global
stop_thread
,
packet_holder
CLIENT_IP
=
"0.0.0.0"
CLIENT_IP
=
"0.0.0.0"
port
=
10000
+
i
print
i
s
=
socket
.
socket
(
socket
.
AF_INET
,
socket
.
SOCK_DGRAM
)
s
=
socket
.
socket
(
socket
.
AF_INET
,
socket
.
SOCK_DGRAM
)
s
.
bind
((
CLIENT_IP
,
8080
))
s
.
bind
((
CLIENT_IP
,
port
))
print
"listening to {} at port {}"
.
format
(
CLIENT_IP
,
8080
)
print
(
"listening to {} at port {}"
.
format
(
CLIENT_IP
,
port
)
)
run_status
=
{}
run_status
=
{}
packet_holder
[
i
]
=
[]
while
True
:
while
True
:
if
stop_thread
:
if
stop_thread
:
break
break
packet
,
addr
=
s
.
recvfrom
(
1024
)
packet
,
addr
=
s
.
recvfrom
(
1024
)
# print packet
packet_holder
[
i
]
.
append
((
packet
,
time
.
time
()
))
base
=
0
# print "r", "{0:f}".format((time.time() * 1000)), "{0:f}".format(ingress_time[exec_id])
chain_id
=
struct
.
unpack
(
">I"
,
packet
[
base
:
base
+
4
])[
0
]
base
+=
4
exec_id
=
struct
.
unpack
(
">I"
,
packet
[
base
:
base
+
4
])[
0
]
base
+=
4
function_id
=
struct
.
unpack
(
">I"
,
packet
[
base
:
base
+
4
])[
0
]
base
+=
4
data
=
struct
.
unpack
(
">I"
,
packet
[
base
:
base
+
4
])[
0
]
base
+=
4
function_count
=
struct
.
unpack
(
"B"
,
packet
[
base
])[
0
]
t
=
int
(
time
.
time
()
*
1000
)
%
1000000000
data
=
int
(
data
)
-
t
print
"rec"
,
chain_id
,
exec_id
,
data
,
function_id
,
function_count
,
def
genPacket
():
def
genPacket
():
global
fid
global
fid
packet
=
None
packet
=
None
exec_id
=
random
.
randint
(
0
,
2
**
30
)
exec_id
=
random
.
randint
(
0
,
2
**
30
)
print
exec_id
chain_id
=
1
chain_id
=
1
function_count
=
5
function_count
=
5
function_id
=
fid
if
(
fid
)
else
1
function_id
=
fid
if
(
fid
)
else
1
f0
=
0
;
f1
=
1
;
f2
=
2
;
f3
=
0
;
f4
=
0
f0
=
0
;
f1
=
1
;
f2
=
2
;
f3
=
0
;
f4
=
0
print
chain_id
,
exec_id
,
"function_id"
,
function_id
,
function_count
,
\
#
print chain_id, exec_id, "function_id", function_id, function_count, \
f0
,
f1
,
f2
,
f3
,
f4
# f0, f1, f2, f3, f4,
chain_id
=
struct
.
pack
(
">I"
,
chain_id
)
# chain id
chain_id
=
struct
.
pack
(
">I"
,
chain_id
)
# chain id
exec_id
=
struct
.
pack
(
">I"
,
exec_id
)
# execution id
exec_id
_packed
=
struct
.
pack
(
">I"
,
exec_id
)
# execution id
dataInt
=
int
(
time
.
time
()
*
1000
)
%
1000000000
dataInt
=
0
# print " dataInt", dataInt
data
=
struct
.
pack
(
">I"
,
dataInt
)
# data
data
=
struct
.
pack
(
">I"
,
dataInt
)
# data
function_count
=
struct
.
pack
(
"B"
,
function_count
)
# function count
function_count
=
struct
.
pack
(
"B"
,
function_count
)
# function count
function_id
_packed
=
struct
.
pack
(
">I"
,
function_id
)
function_id
=
struct
.
pack
(
">I"
,
function_id
)
f0
=
struct
.
pack
(
"B"
,
f0
)
# f0
f0
=
struct
.
pack
(
"B"
,
f0
)
# f0
f1
=
struct
.
pack
(
"B"
,
f1
)
# f1
f1
=
struct
.
pack
(
"B"
,
f1
)
# f1
f2
=
struct
.
pack
(
"B"
,
f2
)
# f2 -> f0
f2
=
struct
.
pack
(
"B"
,
f2
)
# f2 -> f0
f3
=
struct
.
pack
(
"B"
,
f3
)
# f3 -> f1 f2
f3
=
struct
.
pack
(
"B"
,
f3
)
# f3 -> f1 f2
f4
=
struct
.
pack
(
"B"
,
f4
)
# f4 -> f3
f4
=
struct
.
pack
(
"B"
,
f4
)
# f4 -> f3
packet
=
chain_id
+
exec_id
+
function_id_packe
d
+
data
+
function_count
+
f0
+
f1
+
f2
+
f3
+
f4
packet
=
chain_id
+
exec_id
_packed
+
function_i
d
+
data
+
function_count
+
f0
+
f1
+
f2
+
f3
+
f4
# print dataInt, offload_status
# print dataInt, offload_status
return
packet
,
function
_id
return
packet
,
exec
_id
def
sendThread
(
start_time
,
runtime
,
sleep_time
):
def
sendThread
(
start_time
,
runtime
,
sleep_time
):
global
ingress_time
global
ingress_time
s
=
socket
.
socket
(
socket
.
AF_INET
,
socket
.
SOCK_DGRAM
)
s
=
socket
.
socket
(
socket
.
AF_INET
,
socket
.
SOCK_DGRAM
)
while
True
:
while
True
:
packet
,
function_id
=
genPacket
()
if
time
.
time
()
-
start_time
>
runtime
:
if
time
.
time
()
-
start_time
>
runtime
:
break
break
packet
,
exec_id
=
genPacket
()
s
.
sendto
(
packet
,
(
SERVER_IP
,
PORT
))
if
exec_id
in
ingress_time
:
ingress_time
.
append
(
time
.
time
())
continue
time
.
sleep
(
sleep_time
)
s
.
sendto
(
packet
,
(
SERVER_IP
,
PORT
))
ingress_time
[
exec_id
]
=
time
.
time
()
time
.
sleep
(
sleep_time
)
def
send
():
def
send
():
global
egress_time
,
ingress_time
global
egress_time
,
ingress_time
,
concurrency
,
runtime
,
stop_thread
s
=
socket
.
socket
(
socket
.
AF_INET
,
socket
.
SOCK_DGRAM
)
s
=
socket
.
socket
(
socket
.
AF_INET
,
socket
.
SOCK_DGRAM
)
print
"Sending packet to
%
s at port
%
s"
%
(
SERVER_IP
,
PORT
)
print
(
"Sending packet to
%
s at port
%
s"
%
(
SERVER_IP
,
PORT
))
print
"chain id, exec id, data, function count, functions dependencies..."
print
(
"Runtime:
%
d Concurrency
%
d"
%
(
runtime
,
concurrency
))
print
(
"chain id, exec id, data, function count, functions dependencies..."
)
# op = struct.unpack("B", packet[0])
# op = struct.unpack("B", packet[0])
packet
,
_
=
genPacket
()
if
args
.
n
is
not
None
:
if
args
.
n
is
not
None
:
for
i
in
range
(
args
.
req_count
):
for
i
in
range
(
args
.
n
):
packet
,
exec_id
=
genPacket
()
s
.
sendto
(
packet
,
(
SERVER_IP
,
PORT
))
s
.
sendto
(
packet
,
(
SERVER_IP
,
PORT
))
ingress_time
.
append
(
time
.
time
())
ingress_time
[
exec_id
]
=
time
.
time
()
*
1000
print
(
"s"
,
"{0:f}"
.
format
(
ingress_time
[
exec_id
]))
elif
args
.
rps
is
not
None
:
elif
args
.
rps
is
not
None
:
runtime
=
10
thread_count
=
args
.
c
start_time
=
time
.
time
()
start_time
=
time
.
time
()
sleep_time
=
thread_count
/
float
(
args
.
rps
)
sleep_time
=
concurrency
/
float
(
args
.
rps
)
print
"calculated inter-arrival time, offload mode"
,
sleep_time
print
(
"calculated inter-arrival time, offload mode"
,
sleep_time
)
for
i
in
range
(
thread_count
):
for
i
in
range
(
concurrency
):
t
=
threading
.
Thread
(
target
=
sendThread
,
args
=
[
t
=
threading
.
Thread
(
target
=
sendThread
,
args
=
[
start_time
,
runtime
,
sleep_time
])
start_time
,
runtime
,
sleep_time
])
t
.
daemon
=
True
t
.
daemon
=
True
...
@@ -135,13 +131,37 @@ def send():
...
@@ -135,13 +131,37 @@ def send():
# s.sendto(packet, (SERVER_IP, PORT))
# s.sendto(packet, (SERVER_IP, PORT))
# r.join()
# r.join()
def
printStatistics
():
global
runtime
e2e_time
=
[]
r
=
threading
.
Thread
(
name
=
"receive"
,
target
=
receive
)
for
packetThread
in
packet_holder
:
r
.
daemon
=
True
for
packetTuple
in
packetThread
:
r
.
start
()
packet
=
packetTuple
[
0
]
base
=
0
chain_id
=
struct
.
unpack
(
">I"
,
packet
[
base
:
base
+
4
])[
0
]
base
+=
4
exec_id
=
struct
.
unpack
(
">I"
,
packet
[
base
:
base
+
4
])[
0
]
e2e_time
.
append
((
packetTuple
[
1
]
-
ingress_time
[
exec_id
])
*
1000
)
print
e2e_time
data
=
np
.
array
(
e2e_time
,
dtype
=
float
)
p50
=
np
.
percentile
(
data
,
50
)
p95
=
np
.
percentile
(
data
,
95
)
p99
=
np
.
percentile
(
data
,
99
)
mean
=
np
.
mean
(
data
)
print
(
"mean
\t
p50
\t
p95
\t
p99"
)
print
(
mean
,
p50
,
p95
,
p99
)
print
(
"rps"
,
len
(
e2e_time
)
/
runtime
,
len
(
ingress_time
))
return
0
for
i
in
range
(
0
,
11
):
r
=
threading
.
Thread
(
name
=
"receive"
,
target
=
receive
,
args
=
[
i
])
r
.
daemon
=
True
r
.
start
()
time
.
sleep
(
1
)
time
.
sleep
(
1
)
send
()
send
()
r
.
join
()
time
.
sleep
(
2
)
# r.join()
printStatistics
()
dispatch_system/benchmark_dispatcher2.py
0 → 100644
View file @
0357774b
import
socket
import
struct
import
time
import
threading
import
random
import
time
import
argparse
parser
=
argparse
.
ArgumentParser
(
description
=
'Mininet demo'
)
parser
.
add_argument
(
'--fid'
,
help
=
'Funtion id'
,
type
=
int
,
action
=
"store"
,
required
=
False
)
parser
.
add_argument
(
'--c'
,
help
=
'Concurrency'
,
type
=
int
,
action
=
"store"
,
required
=
True
)
parser
.
add_argument
(
'--req_count'
,
help
=
'request count'
,
type
=
int
,
action
=
"store"
,
required
=
True
)
group
=
parser
.
add_mutually_exclusive_group
(
required
=
True
)
group
.
add_argument
(
'--rps'
,
help
=
'Requests per second'
,
type
=
int
,
action
=
"store"
)
group
.
add_argument
(
'--n'
,
help
=
'Number of requests to send'
,
type
=
int
,
action
=
"store"
)
args
=
parser
.
parse_args
()
PORT
=
8000
dataInt
=
0
fid
=
args
.
fid
SERVER_IP
=
"192.168.2.3"
egress_time
=
[]
ingress_time
=
[]
stop_thread
=
False
def
receive
():
global
egress_time
,
stop_thread
CLIENT_IP
=
"0.0.0.0"
s
=
socket
.
socket
(
socket
.
AF_INET
,
socket
.
SOCK_DGRAM
)
s
.
bind
((
CLIENT_IP
,
8080
))
print
"listening to {} at port {}"
.
format
(
CLIENT_IP
,
8080
)
run_status
=
{}
while
True
:
if
stop_thread
:
break
packet
,
addr
=
s
.
recvfrom
(
1024
)
# print packet
base
=
0
chain_id
=
struct
.
unpack
(
">I"
,
packet
[
base
:
base
+
4
])[
0
]
base
+=
4
exec_id
=
struct
.
unpack
(
">I"
,
packet
[
base
:
base
+
4
])[
0
]
base
+=
4
function_id
=
struct
.
unpack
(
">I"
,
packet
[
base
:
base
+
4
])[
0
]
base
+=
4
data
=
struct
.
unpack
(
">I"
,
packet
[
base
:
base
+
4
])[
0
]
base
+=
4
function_count
=
struct
.
unpack
(
"B"
,
packet
[
base
])[
0
]
t
=
int
(
time
.
time
()
*
1000
)
%
1000000000
data
=
int
(
data
)
-
t
print
"rec"
,
chain_id
,
exec_id
,
data
,
function_id
,
function_count
,
def
genPacket
():
global
fid
packet
=
None
exec_id
=
random
.
randint
(
0
,
2
**
30
)
print
exec_id
chain_id
=
1
function_count
=
5
function_id
=
fid
if
(
fid
)
else
1
f0
=
0
;
f1
=
1
;
f2
=
2
;
f3
=
0
;
f4
=
0
print
chain_id
,
exec_id
,
"function_id"
,
function_id
,
function_count
,
\
f0
,
f1
,
f2
,
f3
,
f4
chain_id
=
struct
.
pack
(
">I"
,
chain_id
)
# chain id
exec_id
=
struct
.
pack
(
">I"
,
exec_id
)
# execution id
dataInt
=
int
(
time
.
time
()
*
1000
)
%
1000000000
data
=
struct
.
pack
(
">I"
,
dataInt
)
# data
function_count
=
struct
.
pack
(
"B"
,
function_count
)
# function count
function_id_packed
=
struct
.
pack
(
">I"
,
function_id
)
f0
=
struct
.
pack
(
"B"
,
f0
)
# f0
f1
=
struct
.
pack
(
"B"
,
f1
)
# f1
f2
=
struct
.
pack
(
"B"
,
f2
)
# f2 -> f0
f3
=
struct
.
pack
(
"B"
,
f3
)
# f3 -> f1 f2
f4
=
struct
.
pack
(
"B"
,
f4
)
# f4 -> f3
packet
=
chain_id
+
exec_id
+
function_id_packed
+
data
+
function_count
+
f0
+
f1
+
f2
+
f3
+
f4
# print dataInt, offload_status
return
packet
,
function_id
def
sendThread
(
start_time
,
runtime
,
sleep_time
):
global
ingress_time
s
=
socket
.
socket
(
socket
.
AF_INET
,
socket
.
SOCK_DGRAM
)
while
True
:
packet
,
function_id
=
genPacket
()
if
time
.
time
()
-
start_time
>
runtime
:
break
s
.
sendto
(
packet
,
(
SERVER_IP
,
PORT
))
ingress_time
.
append
(
time
.
time
())
time
.
sleep
(
sleep_time
)
def
send
():
global
egress_time
,
ingress_time
s
=
socket
.
socket
(
socket
.
AF_INET
,
socket
.
SOCK_DGRAM
)
print
"Sending packet to
%
s at port
%
s"
%
(
SERVER_IP
,
PORT
)
print
"chain id, exec id, data, function count, functions dependencies..."
# op = struct.unpack("B", packet[0])
packet
,
_
=
genPacket
()
if
args
.
n
is
not
None
:
for
i
in
range
(
args
.
req_count
):
s
.
sendto
(
packet
,
(
SERVER_IP
,
PORT
))
ingress_time
.
append
(
time
.
time
())
elif
args
.
rps
is
not
None
:
runtime
=
10
thread_count
=
args
.
c
start_time
=
time
.
time
()
sleep_time
=
thread_count
/
float
(
args
.
rps
)
print
"calculated inter-arrival time, offload mode"
,
sleep_time
for
i
in
range
(
thread_count
):
t
=
threading
.
Thread
(
target
=
sendThread
,
args
=
[
start_time
,
runtime
,
sleep_time
])
t
.
daemon
=
True
t
.
start
()
time
.
sleep
(
runtime
)
stop_thread
=
True
# s.sendto(packet, (SERVER_IP, PORT))
# r.join()
r
=
threading
.
Thread
(
name
=
"receive"
,
target
=
receive
)
r
.
daemon
=
True
r
.
start
()
time
.
sleep
(
1
)
send
()
r
.
join
()
dispatch_system/benchmark_dispatcher_receive.py
0 → 100644
View file @
0357774b
import
socket
import
struct
import
time
import
threading
import
random
import
time
import
numpy
as
np
import
argparse
import
signal
parser
=
argparse
.
ArgumentParser
(
description
=
'Mininet demo'
)
packet_holder
=
[
None
]
*
11
ingress_time
=
{}
stop_thread
=
False
runtime
=
10
def
receive
(
i
):
global
stop_thread
,
packet_holder
CLIENT_IP
=
"0.0.0.0"
port
=
10000
+
i
print
i
s
=
socket
.
socket
(
socket
.
AF_INET
,
socket
.
SOCK_DGRAM
)
s
.
bind
((
CLIENT_IP
,
port
))
print
(
"listening to {} at port {}"
.
format
(
CLIENT_IP
,
port
))
run_status
=
{}
packet_holder
[
i
]
=
[]
while
True
:
if
stop_thread
:
break
packet
,
addr
=
s
.
recvfrom
(
1024
)
packet_holder
[
i
]
.
append
((
packet
,
time
.
time
()
))
# print "r", "{0:f}".format((time.time() * 1000)), "{0:f}".format(ingress_time[exec_id])
def
printStatistics
():
global
runtime
e2e_time
=
[]
for
packetThread
in
packet_holder
:
for
packetTuple
in
packetThread
:
packet
=
packetTuple
[
0
]
base
=
0
chain_id
=
struct
.
unpack
(
">I"
,
packet
[
base
:
base
+
4
])[
0
]
base
+=
4
exec_id
=
struct
.
unpack
(
">I"
,
packet
[
base
:
base
+
4
])[
0
]
# e2e_time.append((packetTuple[1] - ingress_time[exec_id])* 1000)
# data = np.array(e2e_time, dtype=float)
# p50 = np.percentile(data, 50)
# p95 = np.percentile(data, 95)
# p99 = np.percentile(data, 99)
# mean = np.mean(data)
# print("mean \t p50 \t p95 \t p99")
# print(mean, p50, p95, p99)
print
(
"rps"
,
len
(
e2e_time
)
/
runtime
,
len
(
ingress_time
))
return
0
ri
=
[]
for
i
in
range
(
0
,
11
):
r
=
threading
.
Thread
(
name
=
"receive"
,
target
=
receive
,
args
=
[
i
])
r
.
daemon
=
True
r
.
start
()
ri
.
append
(
r
)
def
signal_handler
(
sig
,
frame
):
global
stop_thread
print
"sigint"
stop_thread
=
True
print
"here"
time
.
sleep
(
15
)
printStatistics
()
dispatch_system/constants.json
View file @
0357774b
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
"master_address"
:
"localhost"
,
"master_address"
:
"localhost"
,
"grunt_host"
:
"https://www.namandixit.net/lovecraftian_nightmares/grunt"
,
"grunt_host"
:
"https://www.namandixit.net/lovecraftian_nightmares/grunt"
,
"couchdb_host"
:
"10.129.6.5:5984"
,
"couchdb_host"
:
"10.129.6.5:5984"
,
"env"
:
"env_
ud
p.js"
,
"env"
:
"env_
cp
p.js"
,
"db"
:
{
"db"
:
{
"function_meta"
:
"serverless"
,
"function_meta"
:
"serverless"
,
"metrics"
:
"metrics"
,
"metrics"
:
"metrics"
,
...
@@ -15,10 +15,10 @@
...
@@ -15,10 +15,10 @@
"network_bridge"
:
"hybrid_kafka-serverless"
,
"network_bridge"
:
"hybrid_kafka-serverless"
,
"use_bridge"
:
false
,
"use_bridge"
:
false
,
"internal"
:
{
"internal"
:
{
"kafka_host"
:
"1
0.129.6.5
:9092"
"kafka_host"
:
"1
27.0.0.1
:9092"
},
},
"external"
:
{
"external"
:
{
"kafka_host"
:
"1
0.129.6.5:
9092"
"kafka_host"
:
"1
27.0.0.1:2
9092"
}
}
},
},
"topics"
:
{
"topics"
:
{
...
...
dispatch_system/constants_local.json
View file @
0357774b
...
@@ -4,6 +4,7 @@
...
@@ -4,6 +4,7 @@
"master_address"
:
"localhost"
,
"master_address"
:
"localhost"
,
"grunt_host"
:
"https://www.namandixit.net/lovecraftian_nightmares/grunt"
,
"grunt_host"
:
"https://www.namandixit.net/lovecraftian_nightmares/grunt"
,
"couchdb_host"
:
"localhost:5984"
,
"couchdb_host"
:
"localhost:5984"
,
"env"
:
"env_udp.js"
,
"db"
:
{
"db"
:
{
"function_meta"
:
"serverless"
,
"function_meta"
:
"serverless"
,
"metrics"
:
"metrics"
,
"metrics"
:
"metrics"
,
...
@@ -11,13 +12,13 @@
...
@@ -11,13 +12,13 @@
"explicit_chain_meta"
:
"explicit_chain"
"explicit_chain_meta"
:
"explicit_chain"
},
},
"network"
:
{
"network"
:
{
"network_bridge"
:
"
hybrid
_kafka-serverless"
,
"network_bridge"
:
"
xanadu
_kafka-serverless"
,
"use_bridge"
:
true
,
"use_bridge"
:
true
,
"internal"
:
{
"internal"
:
{
"kafka_host"
:
"kafka:9092"
"kafka_host"
:
"kafka:9092"
},
},
"external"
:
{
"external"
:
{
"kafka_host"
:
"
localhost:2
9092"
"kafka_host"
:
"
10.129.2.201:
9092"
}
}
},
},
"topics"
:
{
"topics"
:
{
...
@@ -38,4 +39,4 @@
...
@@ -38,4 +39,4 @@
"speculative_deployment"
:
true
,
"speculative_deployment"
:
true
,
"JIT_deployment"
:
true
,
"JIT_deployment"
:
true
,
"id_size"
:
20
"id_size"
:
20
}
}
\ No newline at end of file
dispatch_system/dispatch_daemon/execute.js
View file @
0357774b
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
// const isolateBackend = require('./isolate')
// const isolateBackend = require('./isolate')
const
fs
=
require
(
'
fs
'
)
const
fs
=
require
(
'
fs
'
)
const
{
spawn
}
=
require
(
'
child_process
'
);
const
{
spawn
}
=
require
(
'
child_process
'
);
const
constants
=
require
(
"
../constants.json
"
)
const
constants
=
require
(
"
../constants
_local
.json
"
)
const
libSupport
=
require
(
'
./lib
'
)
const
libSupport
=
require
(
'
./lib
'
)
const
{
Worker
,
isMainThread
,
workerData
}
=
require
(
'
worker_threads
'
);
const
{
Worker
,
isMainThread
,
workerData
}
=
require
(
'
worker_threads
'
);
const
registry_url
=
constants
.
registry_url
const
registry_url
=
constants
.
registry_url
...
@@ -38,7 +38,8 @@ function runIsolate(local_repository, metadata) {
...
@@ -38,7 +38,8 @@ function runIsolate(local_repository, metadata) {
}
}
function
runProcess
(
local_repository
,
metadata
)
{
function
runProcess
(
local_repository
,
metadata
)
{
let
port
=
metadata
.
port
,
console
.
log
(
"
inside run process :
"
,
metadata
,
local_repository
)
let
port
=
metadata
.
port
,
functionHash
=
metadata
.
functionHash
,
functionHash
=
metadata
.
functionHash
,
resource_id
=
metadata
.
resource_id
,
resource_id
=
metadata
.
resource_id
,
memory
=
metadata
.
resources
.
memory
memory
=
metadata
.
resources
.
memory
...
@@ -76,7 +77,7 @@ function runContainer(metadata) {
...
@@ -76,7 +77,7 @@ function runContainer(metadata) {
memory
=
metadata
.
resources
.
memory
memory
=
metadata
.
resources
.
memory
logger
.
info
(
imageName
);
logger
.
info
(
imageName
);
console
.
log
(
'
run contianer function :
'
,
metadata
,
imageName
,
port
,
resource_id
,
memory
)
return
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
let
timeStart
=
Date
.
now
()
let
timeStart
=
Date
.
now
()
...
@@ -111,8 +112,10 @@ function runContainer(metadata) {
...
@@ -111,8 +112,10 @@ function runContainer(metadata) {
logger
.
info
(
`stdout:
${
data
}
`
);
logger
.
info
(
`stdout:
${
data
}
`
);
let
timeDifference
=
Math
.
ceil
((
Date
.
now
()
-
timeStart
))
let
timeDifference
=
Math
.
ceil
((
Date
.
now
()
-
timeStart
))
logger
.
info
(
"
container run time taken:
"
,
timeDifference
);
logger
.
info
(
"
container run time taken:
"
,
timeDifference
);
let
add_network
=
spawn
(
'
docker
'
,
[
'
network
'
,
'
connect
'
,
'
pub_net
'
,
resource_id
])
// let add_network = spawn('docker', ['network', 'connect', 'pub_net', resource_id])
let
_
=
spawn
(
'
docker
'
,
[
'
start
'
,
resource_id
])
let
add_network
=
spawn
(
'
docker
'
,
[
'
network
'
,
'
connect
'
,
'
macvlantest
'
,
resource_id
])
let
_
=
spawn
(
'
docker
'
,
[
'
start
'
,
resource_id
])
_
.
on
(
'
data
'
,
(
data
)
=>
{
_
.
on
(
'
data
'
,
(
data
)
=>
{
console
.
log
(
"
container started
"
,
data
);
console
.
log
(
"
container started
"
,
data
);
...
@@ -140,7 +143,8 @@ function runContainer(metadata) {
...
@@ -140,7 +143,8 @@ function runContainer(metadata) {
})
})
}
else
{
}
else
{
logger
.
info
(
"
container starting at port
"
,
port
);
logger
.
info
(
"
container starting at port
"
,
port
,
"
to check
"
);
console
.
log
(
port
,
"
no to check!!
"
)
let
process
=
null
;
let
process
=
null
;
/**
/**
* create docker on the default bridge
* create docker on the default bridge
...
@@ -162,8 +166,10 @@ function runContainer(metadata) {
...
@@ -162,8 +166,10 @@ function runContainer(metadata) {
/**
/**
* attach smartnic interface
* attach smartnic interface
*/
*/
let
add_network
=
spawn
(
'
docker
'
,
[
'
network
'
,
'
connect
'
,
'
pub_net
'
,
resource_id
])
// let add_network = spawn('docker', ['network', 'connect', 'pub_net', resource_id])
let
_
=
spawn
(
'
docker
'
,
[
'
start
'
,
resource_id
])
let
add_network
=
spawn
(
'
docker
'
,
[
'
network
'
,
'
connect
'
,
'
pub_net
'
,
resource_id
])
let
_
=
spawn
(
'
docker
'
,
[
'
start
'
,
resource_id
])
_
.
stdout
.
on
(
'
data
'
,
(
data
)
=>
{
_
.
stdout
.
on
(
'
data
'
,
(
data
)
=>
{
logger
.
info
(
data
.
toString
())
logger
.
info
(
data
.
toString
())
...
@@ -201,4 +207,4 @@ function runContainer(metadata) {
...
@@ -201,4 +207,4 @@ function runContainer(metadata) {
module
.
exports
.
runContainer
=
runContainer
;
module
.
exports
.
runContainer
=
runContainer
;
module
.
exports
.
runProcess
=
runProcess
;
module
.
exports
.
runProcess
=
runProcess
;
module
.
exports
.
runIsolate
=
runIsolate
;
module
.
exports
.
runIsolate
=
runIsolate
;
\ No newline at end of file
dispatch_system/dispatch_daemon/index.js
View file @
0357774b
'
use strict
'
;
'
use strict
'
;
const
constants
=
require
(
"
.././constants.json
"
)
const
constants
=
require
(
"
.././constants
_local
.json
"
)
const
secrets
=
require
(
'
./secrets.json
'
)
const
secrets
=
require
(
'
./secrets.json
'
)
const
config
=
require
(
'
./config.json
'
)
const
config
=
require
(
'
./config.json
'
)
const
libSupport
=
require
(
'
./lib
'
)
const