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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
flame
flame-clmc
Commits
2460412b
Commit
2460412b
authored
7 years ago
by
Simon Crowle
Browse files
Options
Downloads
Patches
Plain Diff
Normalises all reporting time periods for media component configuration state to 1 second
parent
ae767fde
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
clmctest/monitoring/StreamingSim.py
+65
-63
65 additions, 63 deletions
clmctest/monitoring/StreamingSim.py
clmctest/monitoring/test_simresults.py
+6
-8
6 additions, 8 deletions
clmctest/monitoring/test_simresults.py
with
71 additions
and
71 deletions
clmctest/monitoring/StreamingSim.py
+
65
−
63
View file @
2460412b
...
...
@@ -77,10 +77,6 @@ class Sim(object):
# endpoint state->mu, sigma, secs normal distribution
config_delay_dist
=
{
"
placing
"
:
[
10
,
0.68
],
"
booting
"
:
[
10
,
0.68
],
"
connecting
"
:
[
10
,
0.68
]}
# Simulation configuration of the media component (MC) state changes
# "MC state", [average (sec), stddev]
mc_config_delay_dist
=
{
"
stopped
"
:[
1
,
0.68
],
"
starting
"
:
[
5
,
0.68
],
"
running
"
:[
1
,
0.68
],
"
stopping
"
:
[
2
,
0.68
]}
print
(
"
\n
Simulation started. Generating data...
"
)
# Place endpoints
...
...
@@ -105,31 +101,27 @@ class Sim(object):
max_delay
=
max
(
delay_time
,
max_delay
)
sim_time
+=
max_delay
# move mpegdash_service media component state from 'stopped' to 'starting'
max_delay
=
0
# move mpegdash_service media component state from 'stopped' to 'starting'
# Total reports = 1, (0.2 seconds in 'stopped', 0.8 seconds in 'starting')
for
ip_endpoint
in
ip_endpoints
:
agent_url
=
urllib
.
parse
.
urlparse
(
ip_endpoint
[
"
agent_url
"
])
agent_db_client
=
InfluxDBClient
(
host
=
agent_url
.
hostname
,
port
=
agent_url
.
port
,
database
=
self
.
influx_db_name
,
timeout
=
10
)
delay_avg
=
mc_config_delay_dist
[
'
stopped
'
][
0
]
delay_std
=
delay_avg
*
mc_config_delay_dist
[
'
stopped
'
][
1
]
delay_time
=
self
.
_changeMCState
(
agent_db_client
,
sim_time
,
"
mpegdash_service_config
"
,
delay_avg
,
delay_std
,
0.7
,
'
stopped
'
,
'
starting
'
)
max_delay
=
max
(
delay_time
,
max_delay
)
sim_time
+=
max_delay
agent_url
=
urllib
.
parse
.
urlparse
(
ip_endpoint
[
"
agent_url
"
])
influxClient
=
InfluxDBClient
(
host
=
agent_url
.
hostname
,
port
=
agent_url
.
port
,
database
=
self
.
influx_db_name
,
timeout
=
10
)
self
.
_changeMCState
(
influxClient
,
sim_time
,
'
mpegdash_service_config
'
,
10
,
2
,
'
stopped
'
,
'
starting
'
)
sim_time
+=
TICK_TIME
# move mpegdash_service media component state from 'starting' to 'running'
max_delay
=
0
# Total reports = 5, (4.7 seconds in 'starting', 0.3 seconds in 'running')
for
ip_endpoint
in
ip_endpoints
:
agent_url
=
urllib
.
parse
.
urlparse
(
ip_endpoint
[
"
agent_url
"
])
agent_db_client
=
InfluxDBClient
(
host
=
agent_url
.
hostname
,
port
=
agent_url
.
port
,
database
=
self
.
influx_db_name
,
timeout
=
10
)
delay_avg
=
mc_config_delay_dist
[
'
starting
'
][
0
]
delay_std
=
delay_avg
*
mc_config_delay_dist
[
'
starting
'
][
1
]
delay_time
=
self
.
_changeMCState
(
agent_db_client
,
sim_time
,
"
mpegdash_service_config
"
,
delay_avg
,
delay_std
,
0.7
,
'
starting
'
,
'
running
'
)
max_delay
=
max
(
delay_time
,
max_delay
)
agent_url
=
urllib
.
parse
.
urlparse
(
ip_endpoint
[
"
agent_url
"
])
influxClient
=
InfluxDBClient
(
host
=
agent_url
.
hostname
,
port
=
agent_url
.
port
,
database
=
self
.
influx_db_name
,
timeout
=
10
)
sim_time
+=
max_delay
for
i
in
range
(
0
,
4
):
self
.
_writeMCSingleState
(
influxClient
,
'
mpegdash_service_config
'
,
'
starting
'
,
sim_time
+
(
i
*
TICK_TIME
)
)
self
.
_changeMCState
(
influxClient
,
sim_time
+
(
4
*
TICK_TIME
),
'
mpegdash_service_config
'
,
10
,
7
,
'
starting
'
,
'
running
'
)
sim_time
+=
5
*
TICK_TIME
# Connect endpoints
max_delay
=
0
...
...
@@ -207,39 +199,30 @@ class Sim(object):
ip_endpoint
[
'
request_queue
'
]
-=
int
(
requests_processed
)
# update mpegdash_service media component state (continuously 'running')
state_stats
=
{}
state_stats
[
'
running
'
]
=
float
(
TICK_TIME
)
state_stats
[
'
avg_running
'
]
=
float
(
TICK_TIME
)
agent_db_client
.
write_points
(
lp
.
generate_mc_service_config
(
"
mpegdash_service_config
"
,
state_stats
,
sim_time
))
self
.
_writeMCSingleState
(
agent_db_client
,
'
mpegdash_service_config
'
,
'
running
'
,
sim_time
)
sim_time
+=
TICK_TIME
# Simulate tear-down of media components
# move mpegdash_service media component state from 'running' to 'stopping'
max_delay
=
0
# Total reports = 2, (1.8 seconds in 'running', 0.2 seconds in 'stopping')
for
ip_endpoint
in
ip_endpoints
:
agent_url
=
urllib
.
parse
.
urlparse
(
ip_endpoint
[
"
agent_url
"
])
agent_db_client
=
InfluxDBClient
(
host
=
agent_url
.
hostname
,
port
=
agent_url
.
port
,
database
=
self
.
influx_db_name
,
timeout
=
10
)
delay_avg
=
mc_config_delay_dist
[
'
running
'
][
0
]
delay_std
=
delay_avg
*
mc_config_delay_dist
[
'
running
'
][
1
]
agent_url
=
urllib
.
parse
.
urlparse
(
ip_endpoint
[
"
agent_url
"
])
influxClient
=
InfluxDBClient
(
host
=
agent_url
.
hostname
,
port
=
agent_url
.
port
,
database
=
self
.
influx_db_name
,
timeout
=
10
)
delay_time
=
self
.
_changeMCState
(
agent_db_client
,
sim_time
,
"
mpegdash_service_config
"
,
delay_avg
,
delay_std
,
0.7
,
'
running
'
,
'
stopping
'
)
max_delay
=
max
(
delay_time
,
max_delay
)
sim_time
+=
max_delay
self
.
_writeMCSingleState
(
influxClient
,
'
mpegdash_service_config
'
,
'
running
'
,
sim_time
)
self
.
_changeMCState
(
influxClient
,
sim_time
+
TICK_TIME
,
'
mpegdash_service_config
'
,
10
,
8
,
'
running
'
,
'
stopping
'
)
sim_time
+=
2
*
TICK_TIME
# move mpegdash_service media component state from 'stopping' to 'stopped'
max_delay
=
0
# Total reports = 1, (0.9 seconds in 'stopping', 0.1 seconds in 'stopped')
for
ip_endpoint
in
ip_endpoints
:
agent_url
=
urllib
.
parse
.
urlparse
(
ip_endpoint
[
"
agent_url
"
])
agent_db_client
=
InfluxDBClient
(
host
=
agent_url
.
hostname
,
port
=
agent_url
.
port
,
database
=
self
.
influx_db_name
,
timeout
=
10
)
delay_avg
=
mc_config_delay_dist
[
'
stopping
'
][
0
]
delay_std
=
delay_avg
*
mc_config_delay_dist
[
'
stopping
'
][
1
]
delay_time
=
self
.
_changeMCState
(
agent_db_client
,
sim_time
,
"
mpegdash_service_config
"
,
delay_avg
,
delay_std
,
0.7
,
'
stopping
'
,
'
stopped
'
)
max_delay
=
max
(
delay_time
,
max_delay
)
sim_time
+=
max_delay
agent_url
=
urllib
.
parse
.
urlparse
(
ip_endpoint
[
"
agent_url
"
])
influxClient
=
InfluxDBClient
(
host
=
agent_url
.
hostname
,
port
=
agent_url
.
port
,
database
=
self
.
influx_db_name
,
timeout
=
10
)
self
.
_changeMCState
(
influxClient
,
sim_time
,
'
mpegdash_service_config
'
,
10
,
9
,
'
stopping
'
,
'
stopped
'
)
sim_time
+=
TICK_TIME
# End simulation
end_time
=
sim_time
...
...
@@ -291,31 +274,50 @@ class Sim(object):
return
delay_time
@staticmethod
def
_
changeMCState
(
agent_db_client
,
sim_time
,
mc_measurement
,
mu
,
sigma
,
trans_ratio
,
transition_state
,
next_stat
e
):
def
_
writeMCSingleState
(
influxClient
,
measurement
,
state
,
sim_tim
e
):
"""
Send INFLUX data indicating the time taken to transition to a new state
Write a single state as a sample over TICK_TIME
: influxClient - agent used to send metric data to CLMC
: measurement - name of influx measurement set
: state - state to be declared
: sim_time - time stamp for this measurement
Returns the total time delay for the state change
"""
# Calculate a randomized total time for the transition (and calculate relative ratios of time in transition and next state)
total_delay_time
=
max
(
random
.
normalvariate
(
mu
,
sigma
),
1
)
# minimum total delay is 1 second
transition_time
=
total_delay_time
*
trans_ratio
next_state_time
=
total_delay_time
-
transition_time
state_stats
=
{}
state_stats
[
state
]
=
float
(
TICK_TIME
)
state_stats
[
'
avg_
'
+
state
]
=
float
(
TICK_TIME
)
influxClient
.
write_points
(
lp
.
generate_mc_service_config
(
measurement
,
state_stats
,
sim_time
)
)
@staticmethod
def
_changeMCState
(
influxClient
,
sim_time
,
mc_measurement
,
sample_count
,
trans_sample_count
,
transition_state
,
next_state
):
"""
Send INFLUX data indicating the time taken to transition to a new state
: influxClient - agent used to send metric data to CLMC
: sim_time - simulation time at start of state changing period
: mc_measurement - measurement name
: sample_count - the total number of samples in the reporting period (TICK_TIME)
: trans_sample_count - the number of samples in the transition state
: transition_state - the state being exited
: next_state - the state being entered
"""
mc_states
=
{}
# Report time in transition (and add the same as average)
mc_states
[
transition_state
]
=
transition_time
mc_states
[
"
avg_
"
+
transition_state
]
=
transition_time
# Report time remaining in the next state (adding the same as the average)
mc_states
[
next_state
]
=
next_state_time
mc_states
[
"
avg_
"
+
next_state
]
=
next_state_time
# Report total time in transition and its average of the reporting period
mc_states
[
transition_state
]
=
(
float
(
TICK_TIME
)
/
sample_count
)
*
trans_sample_count
mc_states
[
"
avg_
"
+
transition_state
]
=
mc_states
[
transition_state
]
/
float
(
TICK_TIME
)
agent_db_client
.
write_points
(
lp
.
generate_mc_service_config
(
mc_measurement
,
mc_states
,
sim_time
))
# Use the time remaining as the length for the time in the next state
mc_states
[
next_state
]
=
float
(
TICK_TIME
)
-
mc_states
[
transition_state
]
mc_states
[
"
avg_
"
+
next_state
]
=
mc_states
[
next_state
]
/
float
(
TICK_TIME
)
return
total_delay
_time
influxClient
.
write_points
(
lp
.
generate_mc_service_config
(
mc_measurement
,
mc_states
,
sim
_time
))
def
run_simulation
(
generate
=
True
,
sTime
=
3600
):
...
...
This diff is collapsed.
Click to expand it.
clmctest/monitoring/test_simresults.py
+
6
−
8
View file @
2460412b
...
...
@@ -36,20 +36,18 @@ class TestSimulation(object):
# Media component state tests
(
'
SELECT count(*) FROM
"
CLMCMetrics
"
.
"
autogen
"
.
"
mpegdash_service_config
"
WHERE ipendpoint=
\'
adaptive_streaming_I1_apache1
\'
'
,
{
"
time
"
:
"
1970-01-01T00:00:00Z
"
,
"
count_avg_running
"
:
360
4
,
"
count_avg_starting
"
:
360
4
,
"
count_avg_stopped
"
:
360
4
,
"
count_avg_stopping
"
:
360
4
,
"
count_running
"
:
360
4
,
"
count_starting
"
:
360
4
,
"
count_stopped
"
:
360
4
,
"
count_stopping
"
:
360
4
}),
{
"
time
"
:
"
1970-01-01T00:00:00Z
"
,
"
count_avg_running
"
:
360
9
,
"
count_avg_starting
"
:
360
9
,
"
count_avg_stopped
"
:
360
9
,
"
count_avg_stopping
"
:
360
9
,
"
count_running
"
:
360
9
,
"
count_starting
"
:
360
9
,
"
count_stopped
"
:
360
9
,
"
count_stopping
"
:
360
9
}),
(
'
SELECT count(*) FROM
"
CLMCMetrics
"
.
"
autogen
"
.
"
mpegdash_service_config
"
WHERE ipendpoint=
\'
adaptive_streaming_I1_apache2
\'
'
,
{
"
time
"
:
"
1970-01-01T00:00:00Z
"
,
"
count_avg_running
"
:
360
4
,
"
count_avg_starting
"
:
360
4
,
"
count_avg_stopped
"
:
360
4
,
"
count_avg_stopping
"
:
360
4
,
"
count_running
"
:
360
4
,
"
count_starting
"
:
360
4
,
"
count_stopped
"
:
360
4
,
"
count_stopping
"
:
360
4
}),
{
"
time
"
:
"
1970-01-01T00:00:00Z
"
,
"
count_avg_running
"
:
360
9
,
"
count_avg_starting
"
:
360
9
,
"
count_avg_stopped
"
:
360
9
,
"
count_avg_stopping
"
:
360
9
,
"
count_running
"
:
360
9
,
"
count_starting
"
:
360
9
,
"
count_stopped
"
:
360
9
,
"
count_stopping
"
:
360
9
}),
(
'
SELECT mean(avg_stopped) as
"
avg_stopped
"
FROM
"
CLMCMetrics
"
.
"
autogen
"
.
"
mpegdash_service_config
"
WHERE avg_stopped <>0
'
,
{
"
time
"
:
"
1970-01-01T00:00:00Z
"
,
"
avg_stopped
"
:
0.
931138697040887
5
}),
{
"
time
"
:
"
1970-01-01T00:00:00Z
"
,
"
avg_stopped
"
:
0.
1
5
}),
(
'
SELECT mean(avg_starting) as
"
avg_starting
"
FROM
"
CLMCMetrics
"
.
"
autogen
"
.
"
mpegdash_service_config
"
WHERE avg_starting <>0
'
,
{
"
time
"
:
"
1970-01-01T00:00:00Z
"
,
"
avg_starting
"
:
1.43329620390492
66
}),
{
"
time
"
:
"
1970-01-01T00:00:00Z
"
,
"
avg_starting
"
:
0.91666666666666
66
}),
(
'
SELECT mean(avg_running) as
"
avg_running
"
FROM
"
CLMCMetrics
"
.
"
autogen
"
.
"
mpegdash_service_config
"
WHERE avg_running <>0
'
,
{
"
time
"
:
"
1970-01-01T00:00:00Z
"
,
"
avg_running
"
:
0.999
9273119631822
}),
{
"
time
"
:
"
1970-01-01T00:00:00Z
"
,
"
avg_running
"
:
0.999
7502081598669
}),
(
'
SELECT mean(avg_stopping) as
"
avg_stopping
"
FROM
"
CLMCMetrics
"
.
"
autogen
"
.
"
mpegdash_service_config
"
WHERE avg_stopping <>0
'
,
{
"
time
"
:
"
1970-01-01T00:00:00Z
"
,
"
avg_stopping
"
:
1.1135062967253757
}),
(
'
SELECT mean(avg_stopped) as
"
avg_stopped
"
FROM
"
CLMCMetrics
"
.
"
autogen
"
.
"
mpegdash_service_config
"
WHERE avg_stopped <>0
'
,
{
"
time
"
:
"
1970-01-01T00:00:00Z
"
,
"
avg_stopped
"
:
0.9311386970408875
})
{
"
time
"
:
"
1970-01-01T00:00:00Z
"
,
"
avg_stopping
"
:
0.55
})
])
def
test_simulation
(
self
,
run_simulator
,
influx_db
,
query
,
expected_result
):
...
...
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