Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
flame-clmc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
flame
flame-clmc
Commits
c9110cf2
Commit
c9110cf2
authored
Jan 5, 2018
by
Rowan Powell
Browse files
Options
Downloads
Patches
Plain Diff
Added more metrics to simulation
parent
81e97a81
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
scripts/influx/telegraf.conf
+10
-0
10 additions, 0 deletions
scripts/influx/telegraf.conf
src/mediaServiceSim/serviceSim.py
+115
-9
115 additions, 9 deletions
src/mediaServiceSim/serviceSim.py
with
125 additions
and
9 deletions
scripts/influx/telegraf.conf
+
10
−
0
View file @
c9110cf2
...
@@ -13,6 +13,7 @@
...
@@ -13,6 +13,7 @@
[
global_tags
]
[
global_tags
]
# dc = "us-east-1" # will tag all metrics with dc=us-east-1
# dc = "us-east-1" # will tag all metrics with dc=us-east-1
# rack = "1a"
# rack = "1a"
auth
=
"IT-Inn"
# Configuration for telegraf agent
# Configuration for telegraf agent
[
agent
]
[
agent
]
...
@@ -80,6 +81,15 @@
...
@@ -80,6 +81,15 @@
# user_agent = "telegraf"
# user_agent = "telegraf"
# Set UDP payload size, defaults to InfluxDB UDP Client default (512 bytes)
# Set UDP payload size, defaults to InfluxDB UDP Client default (512 bytes)
# udp_payload = 512
# udp_payload = 512
[[
outputs
.
file
]]
## Files to write to, "stdout" is a specially handled file.
files
= [
"stdout"
,
"/tmp/metrics.out"
]
## Data format to output.
## Each data format has its own unique set of configuration options, read
## more about them here:
## https://github.com/influxdata/telegraf/blob/master/docs/DATA_FORMATS_OUTPUT.md
data_format
=
"influx"
###############################################################################
###############################################################################
...
...
This diff is collapsed.
Click to expand it.
src/mediaServiceSim/serviceSim.py
+
115
−
9
View file @
c9110cf2
...
@@ -128,6 +128,33 @@ class DemoServer(object):
...
@@ -128,6 +128,33 @@ class DemoServer(object):
def
reportStatus
(
self
):
def
reportStatus
(
self
):
print
(
'
Number of clients:
'
+
str
(
len
(
self
.
clients
))
)
print
(
'
Number of clients:
'
+
str
(
len
(
self
.
clients
))
)
def
configure_servers
(
self
):
print
(
"
Configuring Servers
"
)
server_conf_block
=
[]
ids
=
[
'
A
'
,
'
B
'
,
'
C
'
]
locations
=
[
'
locA
'
,
'
locB
'
,
'
locC
'
]
for
i
,
id
in
enumerate
(
ids
):
server_conf_block
.
append
(
self
.
_generateServerConfig
(
id
,
locations
[
i
],
8
,
'
100G
'
,
'
1T
'
,
self
.
_selectDelay
(
len
(
ids
))))
self
.
_sendInfluxDataBlock
(
server_conf_block
)
def
configure_VMs
(
self
):
print
(
"
Configuring VM nodes
"
)
VM_conf_block
=
[]
self
.
_generateVMS
(
'
starting
'
,
10
,
VM_conf_block
)
self
.
_generateVMS
(
'
running
'
,
10
,
VM_conf_block
)
self
.
_sendInfluxDataBlock
(
VM_conf_block
)
def
shutdown_VMs
(
self
):
print
(
"
Shutting down VM nodes
"
)
VM_conf_block
=
[]
self
.
_generateVMS
(
'
stopping
'
,
10
,
VM_conf_block
)
self
.
_sendInfluxDataBlock
(
VM_conf_block
)
def
_generateVMS
(
self
,
state
,
amount
,
datablock
):
for
i
in
range
(
0
,
amount
):
datablock
.
append
(
self
.
_generateVMConfig
(
state
,
1
,
'
100G
'
,
'
1T
'
,
self
.
_selectDelay
(
amount
)))
def
iterateService
(
self
):
def
iterateService
(
self
):
# The simulation will run through 'X' iterations of the simulation
# The simulation will run through 'X' iterations of the simulation
# each time this method is called. This allows request/response messages to be
# each time this method is called. This allows request/response messages to be
...
@@ -139,6 +166,8 @@ class DemoServer(object):
...
@@ -139,6 +166,8 @@ class DemoServer(object):
requestBlock
=
[]
requestBlock
=
[]
responseBlock
=
[]
responseBlock
=
[]
networkBlock
=
[]
SFBlock
=
[]
totalDifference
=
sumOfclientQuality
=
percentageDifference
=
0
totalDifference
=
sumOfclientQuality
=
percentageDifference
=
0
# Keep going until this stride (count) completes
# Keep going until this stride (count) completes
...
@@ -183,8 +212,10 @@ class DemoServer(object):
...
@@ -183,8 +212,10 @@ class DemoServer(object):
# print('percentageOfQualityDifference = ' + str(percentageDifference) + '%')
# print('percentageOfQualityDifference = ' + str(percentageDifference) + '%')
responseBlock
.
append
(
self
.
_generateServerResponse
(
client
.
getLastRequestID
(),
qualitySelect
,
delaySelect
,
cpuUsagePercentage
,
percentageDifference
)
)
responseBlock
.
append
(
self
.
_generateServerResponse
(
client
.
getLastRequestID
(),
qualitySelect
,
delaySelect
,
cpuUsagePercentage
,
percentageDifference
)
)
SFBlock
.
append
(
self
.
_generateMpegDashReport
(
'
https://netflix.com/scream
'
,
qualitySelect
,
delaySelect
))
networkBlock
.
append
(
self
.
_generateNetworkReport
(
sumOfclientQuality
,
delaySelect
))
# Iterate the service simulation
# Iterate the service simulation
self
.
simIterations
-=
1
self
.
simIterations
-=
1
self
.
currentTime
+=
1000
# advance 1 second
self
.
currentTime
+=
1000
# advance 1 second
...
@@ -193,6 +224,9 @@ class DemoServer(object):
...
@@ -193,6 +224,9 @@ class DemoServer(object):
if
(
len
(
requestBlock
)
>
0
and
len
(
responseBlock
)
>
0
):
if
(
len
(
requestBlock
)
>
0
and
len
(
responseBlock
)
>
0
):
self
.
_sendInfluxDataBlock
(
requestBlock
)
self
.
_sendInfluxDataBlock
(
requestBlock
)
self
.
_sendInfluxDataBlock
(
responseBlock
)
self
.
_sendInfluxDataBlock
(
responseBlock
)
self
.
_sendInfluxDataBlock
(
networkBlock
)
self
.
_sendInfluxDataBlock
(
SFBlock
)
#print("Sending influx data blocks")
return
self
.
simIterations
return
self
.
simIterations
...
@@ -285,10 +319,10 @@ class DemoServer(object):
...
@@ -285,10 +319,10 @@ class DemoServer(object):
def
_generateServerResponse
(
self
,
reqID
,
quality
,
delay
,
cpuUsage
,
qualityDifference
):
def
_generateServerResponse
(
self
,
reqID
,
quality
,
delay
,
cpuUsage
,
qualityDifference
):
# Tags first
# Tags first
# None here yet
result
=
'
'
# Fields
# Fields
result
=
'
quality=
'
+
str
(
quality
)
+
'
,
'
result
+
=
'
quality=
'
+
str
(
quality
)
+
'
,
'
result
+=
'
cpuUsage=
'
+
str
(
cpuUsage
)
+
'
,
'
result
+=
'
cpuUsage=
'
+
str
(
cpuUsage
)
+
'
,
'
result
+=
'
qualityDifference=
'
+
str
(
qualityDifference
)
+
'
,
'
result
+=
'
qualityDifference=
'
+
str
(
qualityDifference
)
+
'
,
'
result
+=
'
requestID=
"'
+
str
(
reqID
)
+
'"
,
'
result
+=
'
requestID=
"'
+
str
(
reqID
)
+
'"
,
'
...
@@ -298,9 +332,78 @@ class DemoServer(object):
...
@@ -298,9 +332,78 @@ class DemoServer(object):
result
+=
'
'
+
str
(
self
.
_getNSTime
(
delay
)
)
result
+=
'
'
+
str
(
self
.
_getNSTime
(
delay
)
)
# Measurement
# Measurement
#print('response'+result)
return
'
response
'
+
result
return
'
response
'
+
result
def
_generateNetworkReport
(
self
,
sum_of_client_quality
,
delay
):
# Tags
result
=
'
,port_id=enps03
'
# Fields
result
+=
'
RX_BYTES_PORT_M=
'
+
str
(
sum_of_client_quality
*
32
)
+
"
,
"
result
+=
'
TX_BYTES_PORT_M=
'
+
str
(
sum_of_client_quality
*
1024
)
# Timestamp
result
+=
'
'
+
str
(
self
.
_getNSTime
(
delay
)
)
# Measurement
#print('network'+result)
return
'
net_port_io
'
+
result
def
_generateMpegDashReport
(
self
,
resource
,
quality
,
delay
):
# Tags
result
=
'
'
# Fields
requests
=
randint
(
10
,
30
)
avg_response_time
=
50
+
randint
(
0
,
100
)
+
randint
(
0
,
10
*
quality
)
peak_response_time
=
avg_response_time
+
randint
(
30
,
60
)
+
randint
(
5
,
10
)
*
quality
result
+=
'
cont_nav=
\"
'
+
str
(
resource
)
+
"
\"
,
"
result
+=
'
cont_rep=
'
+
str
(
quality
)
+
'
,
'
result
+=
'
requests=
'
+
str
(
requests
)
+
'
,
'
result
+=
'
avg_response_time=
'
+
str
(
avg_response_time
)
+
'
,
'
result
+=
'
peak_response_time=
'
+
str
(
peak_response_time
)
# Timestamp
result
+=
'
'
+
str
(
self
.
_getNSTime
(
delay
)
)
# Measurement
#print('mpegdash_service'+result)
return
'
mpegdash_service
'
+
result
def
_generateServerConfig
(
self
,
ID
,
location
,
cpu
,
mem
,
storage
,
delay
):
# metric
result
=
'
host_resource
'
# Tags
result
+=
'
,slide_id=
'
+
self
.
quote_wrap
(
ID
)
result
+=
'
,location=
'
+
self
.
quote_wrap
(
location
)
result
+=
'
'
# Fields
result
+=
'
cpu=
'
+
str
(
cpu
)
result
+=
'
,memory=
'
+
self
.
quote_wrap
(
mem
)
result
+=
'
,storage=
'
+
self
.
quote_wrap
(
storage
)
#Time
result
+=
'
'
+
str
(
self
.
_getNSTime
(
delay
)
)
print
(
result
)
return
result
def
_generateVMConfig
(
self
,
state
,
cpu
,
mem
,
storage
,
delay
):
# metric
result
=
'
vm_res_alloc
'
# Tags
result
+=
'
,vm_state=
'
+
self
.
quote_wrap
(
state
)
result
+=
'
'
# Fields
result
+=
'
cpu=
'
+
str
(
cpu
)
result
+=
'
,memory=
'
+
self
.
quote_wrap
(
mem
)
result
+=
'
,storage=
'
+
self
.
quote_wrap
(
storage
)
#Time
result
+=
'
'
+
str
(
self
.
_getNSTime
(
delay
)
)
print
(
result
)
return
result
def
quote_wrap
(
self
,
str
):
return
"
\"
"
+
str
+
"
\"
"
# InfluxDB likes to have time-stamps in nanoseconds
# InfluxDB likes to have time-stamps in nanoseconds
def
_getNSTime
(
self
,
offset
=
0
):
def
_getNSTime
(
self
,
offset
=
0
):
# Convert to nano-seconds
# Convert to nano-seconds
...
@@ -346,6 +449,8 @@ class DemoServer(object):
...
@@ -346,6 +449,8 @@ class DemoServer(object):
print
(
"
Preparing simulation
"
)
print
(
"
Preparing simulation
"
)
clients
=
10
clients
=
10
iterations
=
3000
iterations
=
3000
# port 8086: Direct to DB specified
# port 8186: To telegraf, telegraf specifies DB
demoServer
=
DemoServer
(
clients
,
iterations
,
'
http://localhost:8186
'
,
'
testDB
'
)
demoServer
=
DemoServer
(
clients
,
iterations
,
'
http://localhost:8186
'
,
'
testDB
'
)
# Set up InfluxDB (need to wait a little while)
# Set up InfluxDB (need to wait a little while)
...
@@ -354,7 +459,8 @@ time.sleep(2)
...
@@ -354,7 +459,8 @@ time.sleep(2)
demoServer
.
prepareDatabase
()
demoServer
.
prepareDatabase
()
time
.
sleep
(
2
)
time
.
sleep
(
2
)
demoServer
.
reportStatus
()
demoServer
.
reportStatus
()
demoServer
.
configure_servers
()
demoServer
.
configure_VMs
()
# Start simulation
# Start simulation
print
(
"
Starting simulation
"
)
print
(
"
Starting simulation
"
)
while
(
True
):
while
(
True
):
...
@@ -364,6 +470,6 @@ while ( True ):
...
@@ -364,6 +470,6 @@ while ( True ):
print
(
"
Simulation remaining (%):
"
+
str
(
pcDone
)
+
"
\r
"
,
end
=
''
)
print
(
"
Simulation remaining (%):
"
+
str
(
pcDone
)
+
"
\r
"
,
end
=
''
)
if
(
itCount
==
0
):
if
(
itCount
==
0
):
break
;
break
demoServer
.
shutdown_VMs
()
print
(
"
\n
Finished
"
)
print
(
"
\n
Finished
"
)
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment