-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcomputeDTot.py
26 lines (22 loc) · 1.03 KB
/
computeDTot.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import numpy as np
from computeDnTot import computeDnTot
from computeDiTot import computeDiTot
import logging
def computeDTot(S, Nci, Fci, Di, Rs, RTT, Ne, lambd, M, Rsd = np.empty(0)):
# compute average service delay measured at the ingress proxy of the edge data center
# S : binary presence vector
# Nci : average number of calls per user request per microservice
# Fci : call frequency matrix
# Di : internal delay introduced by microservices
# Rs : response size of microservices
# RTT : round trip time
# Ne : network bandwidth
# lambd : average number of requests per second
# M : number of microservices
# Rsd : duration of cloud edge data transfer for Rs
max_delay = 1e5 # max delay used to avoid inf problem during optimization
Dn_tot, rhonce = computeDnTot(S, Nci, Fci, Rs, RTT, Ne, lambd, M, Rsd)
Di_tot = computeDiTot(Nci, Di)
if rhonce == 1:
logging.debug(f"computeDTot: inf network delay")
return min(Dn_tot + Di_tot,max_delay), Di_tot, Dn_tot, rhonce