Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
netstack-exp
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
Peter Cai
netstack-exp
Commits
9fa78138
Commit
9fa78138
authored
2 years ago
by
Peter Cai
Browse files
Options
Downloads
Patches
Plain Diff
Add analyzation script for conn_scan
parent
58b6c7c6
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
analyze/memcached_conn_scan.py
+108
-0
108 additions, 0 deletions
analyze/memcached_conn_scan.py
with
108 additions
and
0 deletions
analyze/memcached_conn_scan.py
0 → 100644
+
108
−
0
View file @
9fa78138
import
os
import
matplotlib.pyplot
as
plt
experiments
=
[
f
for
f
in
os
.
listdir
(
'
../data
'
)
if
f
.
startswith
(
'
memcached_conn_scan
'
)
and
len
(
os
.
listdir
(
os
.
path
.
join
(
'
../data
'
,
f
)))
>
0
]
def
parse_memcached_output
(
s
):
lines
=
s
.
split
(
'
\n
'
)
qps
=
int
(
float
(
lines
[
6
].
split
(
'
'
)[
3
]))
return
qps
def
parse_perf_stat
(
s
):
lines
=
s
.
split
(
'
\n
'
)
llc_misses_u
=
int
(
list
(
filter
(
None
,
lines
[
5
].
split
(
'
'
)))[
0
].
replace
(
'
,
'
,
''
))
llc_misses_k
=
int
(
list
(
filter
(
None
,
lines
[
5
].
split
(
'
'
)))[
0
].
replace
(
'
,
'
,
''
))
return
llc_misses_u
+
llc_misses_k
def
extract_conn_qps_exp
(
exp
):
ret
=
([
10
,
20
,
40
,
80
,
160
,
240
,
320
],
[],
[])
for
f
in
ret
[
0
]:
with
open
(
os
.
path
.
join
(
'
../data/
'
,
exp
,
'
c%d.txt
'
%
(
f
,)),
'
r
'
)
as
fi
:
qps
=
parse_memcached_output
(
fi
.
read
())
ret
[
1
].
append
(
qps
)
with
open
(
os
.
path
.
join
(
'
../data/
'
,
exp
,
'
stat_c%d.txt
'
%
(
f
,)),
'
r
'
)
as
fi
:
misses
=
parse_perf_stat
(
fi
.
read
())
ret
[
2
].
append
(
misses
)
return
ret
def
extract_conn_qps
(
threads
,
include_caladan
=
False
):
ret
=
dict
()
for
exp
in
experiments
:
split
=
exp
.
split
(
'
.
'
)
if
split
[
-
1
]
!=
(
'
t
'
+
str
(
threads
)):
continue
if
split
[
-
2
]
==
'
caladan
'
and
not
include_caladan
:
continue
name
=
split
[
-
2
]
if
name
[
0
].
isdigit
():
name
=
'
default
'
ret
[
name
]
=
extract_conn_qps_exp
(
exp
)
return
ret
def
show_plot
(
threads
,
include_caladan
=
False
):
plt
.
cla
()
if
include_caladan
:
plt
.
title
(
'
Memcached connections vs QPS, %d threads, with Caladan
'
%
(
threads
,))
else
:
plt
.
title
(
'
Memcached connections vs QPS, %d threads
'
%
(
threads
,))
data
=
extract_conn_qps
(
threads
,
include_caladan
)
if
include_caladan
and
threads
==
1
:
# Because we cannot run caladan on 1 threads, we use the t2 data
# but we half the QPS
name
=
'
caladan (per-thread)
'
data
[
name
]
=
extract_conn_qps_exp
(
'
memcached_conn_scan.5.4.0-136-generic.caladan.t2
'
)
data
[
name
]
=
(
data
[
name
][
0
],
[
qps
/
2
for
qps
in
data
[
name
][
1
]],
[
misses
/
2
for
misses
in
data
[
name
][
2
]])
for
k
in
data
:
plt
.
plot
(
data
[
k
][
0
],
data
[
k
][
1
],
label
=
k
)
plt
.
xlabel
(
'
Connections (per client w/ 7 * 8 clients)
'
)
plt
.
ylabel
(
'
QPS
'
)
plt
.
legend
()
if
os
.
getenv
(
'
SAVE_FIGURE
'
)
!=
'
true
'
:
plt
.
rcParams
.
update
({
'
font.size
'
:
16
})
plt
.
show
()
else
:
if
include_caladan
:
plt
.
savefig
(
'
../data/figs/memcached_conn_scan.t%d.caladan.png
'
%
(
threads
,),
dpi
=
192
)
else
:
plt
.
savefig
(
'
../data/figs/memcached_conn_scan.t%d.png
'
%
(
threads
,),
dpi
=
192
)
plt
.
cla
()
if
include_caladan
:
plt
.
title
(
'
Memcached connections vs LLC misses, %d threads, with Caladan
'
%
(
threads
,),
y
=
1.08
)
else
:
plt
.
title
(
'
Memcached connections vs LLC misses, %d threads
'
%
(
threads
,),
y
=
1.08
)
for
k
in
data
:
plt
.
plot
(
data
[
k
][
0
],
data
[
k
][
2
],
label
=
k
)
plt
.
xlabel
(
'
Connections (per client w/ 7 * 8 clients)
'
)
plt
.
ylabel
(
'
LLC misses
'
)
plt
.
legend
()
if
os
.
getenv
(
'
SAVE_FIGURE
'
)
!=
'
true
'
:
plt
.
rcParams
.
update
({
'
font.size
'
:
16
})
plt
.
show
()
else
:
if
include_caladan
:
plt
.
savefig
(
'
../data/figs/memcached_conn_scan.llc_misses.t%d.caladan.png
'
%
(
threads
,),
dpi
=
192
)
else
:
plt
.
savefig
(
'
../data/figs/memcached_conn_scan.llc_misses.t%d.png
'
%
(
threads
,),
dpi
=
192
)
show_plot
(
1
)
show_plot
(
1
,
True
)
show_plot
(
8
)
show_plot
(
8
,
True
)
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