TCPCopy(1) online request replication tool, sending client




TCPCopy is an online request replication tool using netlink and raw sockets. It can copy TCP flows from production environment to testing environment in real-time with very small impact on normal operation, so that it is a very handful tool for distributed stress testing, hot backup, online testing and benchmarking.


Use TRANSFER to specify the IPs and ports of the source and target servers. Only IP address is supported, this means domain names cannot be used here.
Suppose sourceIP and sourcePort are the IP and port number of the source host you want to copy from, targetIP and targetPort are the IP and port number of the target host you want to send requests to, the format of TRANSFER could be as following: [sourceIP:]sourcePort-targetIP:targetPort,...
The IP address and the port number are segmented by ':' (colon), the sourcePort and targetIP are segmented by '-', and two TRANSFER are segmented by ',' (comma).
For example, tcpcopy -x 80- would copy requests from TCP port 80 of localhost to port 18080 of the host at
-c <IP>
Change localhost client IP address to this IP address when sending to the target host. This option is usually required when copying requests initiated from localhost.
For example, tcpcopy -x 8080- -c would copy requests from port 8080 of localhost to port 8080 of target host at, while at the same time replace the client IP with when it is localhost.
Run as a daemon.
-f <NUM>
Use this parameter to control the port number modification process and reduce port conflications when multiple TCPCopy instances are running in parallel. The value of NUM should be different for different TCPCopy instances. The maximum value allowed is 1023.
Print help text and exit.
Set the pcap file name used to save to. Only valid for offline use of the program when it is configured to run at enable-offline mode.
Save logs in LOG_FILE
-m <MEM>
Set the maximum memory allowed to be used by TCPCopy process in megabytes, to avoid TCPCopy occupying too much memory and cause impact on the online system. When the memory exceeds this limit, TCPCopy would quit automatically.
This parameter is effective only when the Linux kernel version is 2.6.32 or above. Default value is 512.
-M <MTU>
MTU value sent to backend (default 1500).
-n <NUM>
Use NUM to set the replication times when you want to get a copied data stream that is as NUM times large as the original.
The maximum allowd value of NUM is 1023. As multiple copying is done by modifying port numbers, the ports may conflict with each other, especially for intranet applications where there are few source IPs and most connections are short. Thus, TCPCopy would perform better when less copies are specified.
-p <PORT>
Set the target server listening port. Default value is 36524.
Save PID in PIDFILE , only use in conjunction with -d option. -r <PERCENT> Set the percentage of sessions to transfer (integer, 1~100).
Print version info and exit.


TCPCopy relies on packet capturing functions, which is not reliable when under heavy pressure, hence packet (request) loss rate can be much higher then. Also it is recommended to have the sending client and receiving server in the same intranet to reduce the packet (request) loss.


This manual page was written by Aron Xu <[email protected]> for the Debian GNU/Linux system (but may be used by others).