Tcpkali
From Christoph's Personal Wiki
tcpkali is a high performance TCP and WebSocket load generator and sink.
Test concurrent TCP connections between two machines
- Host + Client VM setup
NOTE: Run the following commands on both the Host and the Client VMs/instances.
- Install
tcpkali:
$ sudo yum update -y $ sudo yum install -y autoconf automake libtool bison flex gcc-c++ ncurses-devel git $ git clone https://github.com/satori-com/tcpkali.git $ cd tcpkali/ $ test -f configure || autoreconf -iv $ ./configure $ make $ sudo make install
- Install
socat:
$ sudo yum install -y socat
- Change kernel settings:
$ sudo echo 1 >/proc/sys/net/ipv4/tcp_tw_reuse
- Add the following lines to the
/etc/security/limits.conffile:
@wheel soft nofile 6000 @wheel hard nofile 65335 <pre> Then, <pre> $ sudo sysctl -p $ ulimit -a $ ulimit -Sn # [soft] maximum number of open file descriptors $ ulimit -Hn # [hard] maximum number of open file descriptors
- Host VM setup
NOTE: Run the following commands only on the Host VM/instance.
- Start up
socat(in the background):
$ sudo socat -v tcp-l:443,fork exec:'/bin/cat' &
- Watch for "ESTABLISHED" connections on the host:
$ export TCP_LOGFILE=tcp.log
while true; do
netstat -an | grep "ESTABLISHED" | grep -v :22 | \
echo -e "$(date +%s)\t$(wc -l)" | tee -a ${TCP_LOGFILE}; sleep 1;
done
- Client VM setup
NOTE: Run the following commands only on the Client VM/instance.
- Run
tcpkalion Client VM:
$ export HOST_IP=x.x.x.x
$ export HOST_PORT=443
$ export CONNECTIONS=1000 # Connections to keep open to the destination(s)
$ export WORKERS=2 # Number of parallel threads to use
$ export DURATION=1000 # Exit after the specified amount of time (in seconds)
# --latency-connect Measure TCP connection establishment latency
# --latency-first-byte Measure time to first byte latency
# --latency-marker <string> Measure latency using a per-message marker
# --latency-marker-skip <N> Ignore the first N occurrences of a marker
# --latency-percentiles <list> Report latency at specified percentiles
$ export LATENCY_OPTION=--latency-connect
$ tcpkali ${HOST_IP}:${HOST_PORT} \
--connections=${CONNECTIONS} \
--workers=${WORKERS} \
--duration=${DURATION} \
${LATENCY_OPTION} \
--verbose=3 # [0..3]