-
Notifications
You must be signed in to change notification settings - Fork 3
sender and replier need couples therapy #4
Description
Both the README and code comments would have you believe that only the sender requires options. That you can simply start the replier and it will base its behavior (per connection) on the sender's options as passed to -o. This would lead one to believe that the sender and replier negotiate the benchmark terms before starting the benchmark. However, while trying to diagnose something else, I noticed some unexpected behavior from the replier process. For each message from the sender it used two recv(2) calls. This DTrace snippet below makes the behavior clear:
# dtrace -n 'syscall::recv:entry /cpu == 19/ { @["ask"] = quantize(arg2); @s[ustack()] = count(); }' -c 'psrset -e 5 /zones/826df1b9-e66f-493e-8bd2-8125a3b04bf3/root/root/seqtest-master/seqtest -S -o ssize=200,rsize=200,threads=1,count=100000 192.168.241.75,192.168.241.74:6667'
dtrace: description 'syscall::recv:entry ' matched 1 probe
ssz_max 200
Address 0: Host 192.168.241.74 Port 6667
t->ssz_max 200
Received 100000 replies
Time: 5121763.8 us
ROUND TRIP LATENCY:
Average: 49.5 us
Stddev: 0.8 us
Median: 49.5 us
90.0%ile: 49.9 us
99.0%ile: 50.3 us
99.9%ile: 52.7 us
Minimum: 42.7 us
Maximum: 127.9 us
dtrace: pid 23264 has exited
ask
value ------------- Distribution ------------- count
16 | 0
32 |@@@@@@@@@@@@@@@@@@@@ 100001
64 | 0
128 |@@@@@@@@@@@@@@@@@@@@ 100000
256 | 0
libc.so.1`__so_recv+0xa
libsocket.so.1`recv+0x22
seqtest`replier+0xfb
libc.so.1`_thrp_setup+0x8a
libc.so.1`_lwp_start
200001
Notice there are 200K calls to recv(2) on the replier alone. That's 100K more than expected.
If I pass options to the replier, so that it is aware of the proper size, things work as expected.
# psrset -e 6 /zones/826df1b9-e66f-493e-8bd2-8125a3b04bf3/root/root/seqtest-master/seqtest -o ssize=200,rsize=200 -r 192.168.241.74:6667
Address 0: Host 192.168.241.74 Port 6667
# dtrace -n 'syscall::recv:entry /cpu == 19/ { @["ask"] = quantize(arg2); @s[ustack()] = count(); }' -c 'psrset -e 5 /zones/826df1b9-e66f-493e-8bd2-8125a3b04bf3/root/root/seqtest-master/seqtest -S -o ssize=200,rsize=200,threads=1,count=100000 192.168.241.75,192.168.241.74:6667'
dtrace: description 'syscall::recv:entry ' matched 1 probe
Address 0: Host 192.168.241.74 Port 6667
Received 100000 replies
Time: 5121178.0 us
ROUND TRIP LATENCY:
Average: 49.5 us
Stddev: 0.7 us
Median: 49.5 us
90.0%ile: 49.9 us
99.0%ile: 50.4 us
99.9%ile: 52.0 us
Minimum: 38.3 us
Maximum: 126.6 us
dtrace: pid 23203 has exited
ask
value ------------- Distribution ------------- count
64 | 0
128 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 100001
256 | 0
libc.so.1`__so_recv+0xa
libsocket.so.1`recv+0x22
seqtest`replier+0xfb
libc.so.1`_thrp_setup+0x8a
libc.so.1`_lwp_start
100001
My preferred fix:
- Implement the sender/replier negotiation.
- For each benchmark connection have the replier print a one line summary describing negotiated parameters.
- If someone passes
-oto replier print usage and exit.