Home

Awesome

About

tcpkali is a high performance TCP and WebSocket load generator and sink.

tcpkali mascot

Features

Quick example: testing a web server

tcpkali -em "GET / HTTP/1.1\r\nHost: google.com\r\n\r\n" -r 10 \
        --latency-marker "HTTP/1.1" google.com:80

Install

From packages

OSPackage managerCommand
Mac OS XHomebrewbrew install tcpkali
Mac OS XMacPortsport install tcpkali
FreeBSDpkgngpkg install tcpkali
Linuxnixnix-env -i tcpkali

From sources

Install the following packages first:

Build and install:

test -f configure || autoreconf -iv
./configure
make
sudo make install

Build Status

Usage (Short version)

Usage: tcpkali [OPTIONS] [-l <port>] [<host:port>...]
Where some OPTIONS are:
  -h                   Print this help screen, then exit
  --help               Print long help screen, then exit
  -d                   Dump i/o data for a single connection

  -c <N>               Connections to keep open to the destinations
  -l <port>            Listen on the specified port
  --ws, --websocket    Use RFC6455 WebSocket transport
  -T <Time=10s>        Exit after the specified amount of time

  -e                   Unescape backslash-escaping in a message string
  -1 <string>          Message to send to the remote host once
  -m <string>          Message to repeatedly send to the remote
  -r <Rate>            Messages per second to send in a connection

Variable units and recognized multipliers:
  <N>, <Rate>:  k (1000, as in "5k" is 5000), m (1000000)
  <Time>:       ms, s, m, h, d (milliseconds, seconds, minutes, hours, days)
  <Rate> and <Time> can be fractional values, such as 0.25.

You can get the full list of options using tcpkali --help, from man tcpkali, and by consulting the tcpkali man page source.

Usage Examples

<details> <summary>A few command line examples</summary>

TCP Examples

Connect to a local web server and do nothing:

tcpkali 127.0.0.1:80

Connect to a local echo server and hammer it with stream of dollars:

tcpkali --message '$' localhost:echo
tcpkali -m '$' localhost:echo

Open 10000 connections to two remote servers:

tcpkali --connections 10000 yahoo.com:80 google.com:80
tcpkali -c 10k yahoo.com:80 google.com:80

Open 100 connections to itself and do nothing:

tcpkali --connections 100 --listen-port 12345 127.0.0.1:12345
tcpkali -c100 -l12345 127.1:12345

Open a connection to itself and send lots of cookies:

tcpkali --listen-port 12345 --message "cookies" 127.0.0.1:12345
tcpkali -l 12345 -m "cookies" 127.1:12345

Listen for incoming connections and throw away data for 3 hours:

tcpkali --listen-port 12345 --duration 3h
tcpkali -l12345 -T3h

WebSocket examples

Open connection to the local WebSocket server, send hello, and wait:

tcpkali --websocket --first-message "hello" 127.0.0.1:80

Open connection to the local server and send tons of empty JSON frames:

tcpkali --websocket --message "\{ws.text}" 127.1:80

Send a binary frame with a picture every second (angle brackets are literal):

tcpkali --ws -m "\{ws.binary <image.png>}" -r1 127.1:80
</details>