Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Stefane Fermigier
neo
Commits
e8e395ae
Commit
e8e395ae
authored
Feb 02, 2018
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
X neotest: Move network benchmarking into separate function + add `neotest bench-net`
parent
bdb1b7bf
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
106 additions
and
82 deletions
+106
-82
go/neo/t/neotest
go/neo/t/neotest
+106
-82
No files found.
go/neo/t/neotest
View file @
e8e395ae
...
@@ -900,6 +900,98 @@ Benchmark$1-avg 1 \\3 \\4/op\
...
@@ -900,6 +900,98 @@ Benchmark$1-avg 1 \\3 \\4/op\
done
done
}
}
# hostof <url> - return hostname part of <url>
hostof
()
{
url
=
$1
python
-c
"import urlparse as p; u=p.urlparse(
\"
scheme://
$url
\"
); print u.hostname"
}
# bench_net <url> - benchmark network
bench_net
()
{
url
=
$1
peer
=
`
hostof
$url
`
echo
-e
"
\n
*** link latency:"
# ping2bench <topic> - converts timings from ping to std benchmark format
ping2bench
()
{
# rtt min/avg/max/mdev = 0.028/0.031/0.064/0.007 ms, ipg/ewma 0.038/0.032 ms
sed
-u
-e
\
"s|^rtt min/avg/max/mdev =
\(
[0-9.]
\+\)
/
\(
[0-9.]
\+\)
/
\(
[0-9.]
\+\)
/
\(
[0-9.]
\+\)
ms.*
\$
|&
\n\
Benchmark
$1
-min 1
\\
1 ms/op
\n\
Benchmark
$1
-avg 1
\\
2 ms/op
\
|"
}
# 16 = minimum ping payload size at which it starts putting struct timeval into payload and print RTT
# 1472 = 1500 (Ethernet MTU) - 20 (IPv4 header !options) - 8 (ICMPv4 header)
# 1452 = 1500 (Ethernet MTU) - 40 (IPv6 header !options) - 8 (ICMPv6 header)
# FIXME somehow IPv6 uses lower MTU than 1500 - recheck
sizev
=
"16 1452"
# max = min(IPv4, IPv6) so that it is always only 1 Ethernet frame on the wire
for
size
in
$sizev
;
do
echo
-e
"
\n
#
`
hostname
`
⇄
$peer
(ping
${
size
}
B)"
{
$profile
sudo
-n
ping
-i0
-w
3
-s
$size
-q
$peer
||
\
echo
"# skipped -> enable ping in sudo for
`
whoami
`
@
`
hostname
`
"
;
}
|
\
ping2bench
`
hostname
`
-
$peer
/pingrtt/
${
size
}
B
echo
-e
"
\n
#
$peer
⇄
`
hostname
`
(ping
${
size
}
B)"
# TODO profile remotely
on
$url
"sudo -n ping -i0 -w3 -s
${
size
}
-q
\$
(echo
\$
{SSH_CONNECTION%% *}) ||
\
echo
\\\"
# skipped -> enable ping in sudo for
\`
whoami
\`
@
\`
hostname
\`\\\"
"
|
\
ping2bench
$peer
-
`
hostname
`
/pingrtt/
${
size
}
B
done
# TODO
# echo 1 > /proc/sys/net/ipv4/tcp_low_latency
# netstat -s
# /sys/class/net/ethX/gro_flush_timeout
# /proc/sys/net/ipv4/tcp_limit_output_bytes
# ( https://lwn.net/Articles/507065/ "The default value of this
# limit is 128KB; it could be set lower on systems where latency is the primary concern" )
# ? tcp pacing
# net.ipv4.tcp_autocorking (f54b3111 "tcp: auto corking")
echo
-e
"
\n
*** TCP latency:"
# lattcp2bench <topic> - convert timings from lat_tcp to std benchmark format
lattcp2bench
()
{
# TCP latency using neo2: 52.3468 microseconds
sed
-u
-e
\
"s|^TCP latency using .*:
\(
[0-9.]
\+\)
microseconds.*
\$
|Benchmark
$1
1
\\
1 µs/op
\t
# &|"
}
# 1 = minimum TCP payload
# 1460 = 1500 (Ethernet MTU) - 20 (IPv4 header !options) - 20 (TCP header !options)
# 1440 = 1500 (Ethernet MTU) - 40 (IPv6 header !options) - 20 (TCP header !options)
# FIXME somehow IPv6 uses lower MTU than 1500 - recheck
sizev
=
"1 1400 1500 4096"
# 1400 = 1440 - ε (1 eth frame); 1500 = 1440 + ε (2 eth frames); 4096 - just big 4K (3 eth frames)
for
size
in
$sizev
;
do
echo
-e
"
\n
#
`
hostname
`
⇄
$peer
(lat_tcp.c
${
size
}
B -> lat_tcp.c -s)"
# TODO profile remotely
on
$url
"nohup lat_tcp -s </dev/null >/dev/null 2>/dev/null &"
nrun lat_tcp
-m
$size
$peer
| lattcp2bench
"
`
hostname
`
-
$peer
/tcprtt(c-c)/
${
size
}
B"
lat_tcp
-S
$peer
echo
-e
"
\n
#
`
hostname
`
⇄
$peer
(lat_tcp.c
${
size
}
B -> lat_tcp.go -s)"
# TODO profile remotely
on
$url
"nohup lat_tcp_go -s </dev/null >/dev/null 2>/dev/null &"
nrun lat_tcp
-m
$size
$peer
| lattcp2bench
"
`
hostname
`
-
$peer
/tcprtt(c-go)/
${
size
}
B"
lat_tcp
-S
$peer
echo
-e
"
\n
#
$peer
⇄
`
hostname
`
(lat_tcp.c
${
size
}
B -> lat_tcp.c -s)"
lat_tcp
-s
# TODO profile remotely
nrun on
$url
"lat_tcp -m
$size
\$
{SSH_CONNECTION%% *}"
| lattcp2bench
"
$peer
-
`
hostname
`
/tcprtt(c-c)/
${
size
}
B"
lat_tcp
-S
localhost
echo
-e
"
\n
#
$peer
⇄
`
hostname
`
(lat_tcp.c
${
size
}
B -> lat_tcp.go -s)"
lat_tcp_go
-s
2>/dev/null &
# TODO profile remotely
nrun on
$url
"lat_tcp -m
$size
\$
{SSH_CONNECTION%% *}"
| lattcp2bench
"
$peer
-
`
hostname
`
/tcprtt(c-go)/
${
size
}
B"
lat_tcp
-S
localhost
done
}
# hash function to compute via zhash in tests/benchmarks
# hash function to compute via zhash in tests/benchmarks
zhashfunc
=
crc32
# sha1, adler32, null, ...
zhashfunc
=
crc32
# sha1, adler32, null, ...
...
@@ -1029,86 +1121,8 @@ cmd_bench-cluster() {
...
@@ -1029,86 +1121,8 @@ cmd_bench-cluster() {
echo
-e
"
\n
*** server disk:"
echo
-e
"
\n
*** server disk:"
bench_disk
bench_disk
echo
-e
"
\n
*** link latency:"
bench_net
$url
# XXX -> bench_link + bench_tcp
peer
=
`
python
-c
"import urlparse as p; u=p.urlparse(
\"
scheme://
$url
\"
); print u.hostname"
`
# ping2bench <topic> - converts timings from ping to std benchmark format
ping2bench
()
{
# rtt min/avg/max/mdev = 0.028/0.031/0.064/0.007 ms, ipg/ewma 0.038/0.032 ms
sed
-u
-e
\
"s|^rtt min/avg/max/mdev =
\(
[0-9.]
\+\)
/
\(
[0-9.]
\+\)
/
\(
[0-9.]
\+\)
/
\(
[0-9.]
\+\)
ms.*
\$
|&
\n\
Benchmark
$1
-min 1
\\
1 ms/op
\n\
Benchmark
$1
-avg 1
\\
2 ms/op
\
|"
}
# 16 = minimum ping payload size at which it starts putting struct timeval into payload and print RTT
# 1472 = 1500 (Ethernet MTU) - 20 (IPv4 header !options) - 8 (ICMPv4 header)
# 1452 = 1500 (Ethernet MTU) - 40 (IPv6 header !options) - 8 (ICMPv6 header)
# FIXME somehow IPv6 uses lower MTU than 1500 - recheck
sizev
=
"16 1452"
# max = min(IPv4, IPv6) so that it is always only 1 Ethernet frame on the wire
for
size
in
$sizev
;
do
echo
-e
"
\n
#
`
hostname
`
⇄
$peer
(ping
${
size
}
B)"
{
$profile
sudo
-n
ping
-i0
-w
3
-s
$size
-q
$peer
||
\
echo
"# skipped -> enable ping in sudo for
`
whoami
`
@
`
hostname
`
"
;
}
|
\
ping2bench
`
hostname
`
-
$peer
/pingrtt/
${
size
}
B
echo
-e
"
\n
#
$peer
⇄
`
hostname
`
(ping
${
size
}
B)"
# TODO profile remotely
on
$url
"sudo -n ping -i0 -w3 -s
${
size
}
-q
\$
(echo
\$
{SSH_CONNECTION%% *}) ||
\
echo
\\\"
# skipped -> enable ping in sudo for
\`
whoami
\`
@
\`
hostname
\`\\\"
"
|
\
ping2bench
$peer
-
`
hostname
`
/pingrtt/
${
size
}
B
done
# TODO
# echo 1 > /proc/sys/net/ipv4/tcp_low_latency
# netstat -s
# /sys/class/net/ethX/gro_flush_timeout
# /proc/sys/net/ipv4/tcp_limit_output_bytes
# ( https://lwn.net/Articles/507065/ "The default value of this
# limit is 128KB; it could be set lower on systems where latency is the primary concern" )
# ? tcp pacing
# net.ipv4.tcp_autocorking (f54b3111 "tcp: auto corking")
echo
-e
"
\n
*** TCP latency:"
# lattcp2bench <topic> - convert timings from lat_tcp to std benchmark format
lattcp2bench
()
{
# TCP latency using neo2: 52.3468 microseconds
sed
-u
-e
\
"s|^TCP latency using .*:
\(
[0-9.]
\+\)
microseconds.*
\$
|Benchmark
$1
1
\\
1 µs/op
\t
# &|"
}
# 1 = minimum TCP payload
# 1460 = 1500 (Ethernet MTU) - 20 (IPv4 header !options) - 20 (TCP header !options)
# 1440 = 1500 (Ethernet MTU) - 40 (IPv6 header !options) - 20 (TCP header !options)
# FIXME somehow IPv6 uses lower MTU than 1500 - recheck
sizev
=
"1 1400 1500 4096"
# 1400 = 1440 - ε (1 eth frame); 1500 = 1440 + ε (2 eth frames); 4096 - just big 4K (3 eth frames)
for
size
in
$sizev
;
do
echo
-e
"
\n
#
`
hostname
`
⇄
$peer
(lat_tcp.c
${
size
}
B -> lat_tcp.c -s)"
# TODO profile remotely
on
$url
"nohup lat_tcp -s </dev/null >/dev/null 2>/dev/null &"
nrun lat_tcp
-m
$size
$peer
| lattcp2bench
"
`
hostname
`
-
$peer
/tcprtt(c-c)/
${
size
}
B"
lat_tcp
-S
$peer
echo
-e
"
\n
#
`
hostname
`
⇄
$peer
(lat_tcp.c
${
size
}
B -> lat_tcp.go -s)"
# TODO profile remotely
on
$url
"nohup lat_tcp_go -s </dev/null >/dev/null 2>/dev/null &"
nrun lat_tcp
-m
$size
$peer
| lattcp2bench
"
`
hostname
`
-
$peer
/tcprtt(c-go)/
${
size
}
B"
lat_tcp
-S
$peer
echo
-e
"
\n
#
$peer
⇄
`
hostname
`
(lat_tcp.c
${
size
}
B -> lat_tcp.c -s)"
lat_tcp
-s
# TODO profile remotely
nrun on
$url
"lat_tcp -m
$size
\$
{SSH_CONNECTION%% *}"
| lattcp2bench
"
$peer
-
`
hostname
`
/tcprtt(c-c)/
${
size
}
B"
lat_tcp
-S
localhost
echo
-e
"
\n
#
$peer
⇄
`
hostname
`
(lat_tcp.c
${
size
}
B -> lat_tcp.go -s)"
lat_tcp_go
-s
2>/dev/null &
# TODO profile remotely
nrun on
$url
"lat_tcp -m
$size
\$
{SSH_CONNECTION%% *}"
| lattcp2bench
"
$peer
-
`
hostname
`
/tcprtt(c-go)/
${
size
}
B"
lat_tcp
-S
localhost
done
# zodb benchmarks
# zodb benchmarks
echo
echo
...
@@ -1204,6 +1218,13 @@ cmd_bench-cpu() {
...
@@ -1204,6 +1218,13 @@ cmd_bench-cpu() {
bench_cpu
bench_cpu
}
}
# command: benchmark network
cmd_bench-net
()
{
url
=
$1
test
-z
"
$url
"
&&
die
"Usage: neotest bench-net [user@]<host>:<path>"
bench_net
$url
}
# command: print information about local node
# command: print information about local node
cmd_info-local
()
{
cmd_info-local
()
{
init_net
init_net
...
@@ -1237,9 +1258,11 @@ The commands are:
...
@@ -1237,9 +1258,11 @@ The commands are:
bench-local run benchmarks when client and server are both on the same localhost
bench-local run benchmarks when client and server are both on the same localhost
bench-cluster run benchmarks when server is local and client is on another node
bench-cluster run benchmarks when server is local and client is on another node
bench-cpu benchmark local cpu (part of bench-{local,cluster})
bench-disk benchmark local disk (part of bench-{local,cluster})
bench-net benchmark network (part of bench-cluster)
run-client run client benchmarks against separate server
run-client run client benchmarks against separate server
bench-disk benchmark local disk (already part of bench-{local,cluster})
bench-cpu benchmark local cpu (already part of bench-{local,cluster})
deploy deploy NEO & needed software for tests to remote host
deploy deploy NEO & needed software for tests to remote host
deploy-local deploy NEO & needed software for tests locally
deploy-local deploy NEO & needed software for tests locally
...
@@ -1258,8 +1281,9 @@ case "$1" in
...
@@ -1258,8 +1281,9 @@ case "$1" in
bench-local
|
\
bench-local
|
\
bench-cluster
|
\
bench-cluster
|
\
run-client
|
\
run-client
|
\
bench-cpu
|
\
bench-disk
|
\
bench-disk
|
\
bench-
cpu
)
bench-
net
)
;;
;;
info
)
info
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment