TCPCopy(1) online request replication tool, sending client

SYNOPSIS

tcpcopy -OPTIONS [OPTION_PARAM]

DESCRIPTION

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.

OPTIONS

-x <TRANSFER,>
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-192.168.0.2:18080 would copy requests from TCP port 80 of localhost to port 18080 of the host at 192.168.0.2
-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-192.168.0.2:8080 -c 192.168.0.1 would copy requests from port 8080 of localhost to port 8080 of target host at 192.168.0.2, while at the same time replace the client IP with 192.168.0.1 when it is localhost.
-d
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.
-h
Print help text and exit.
-i <PCAP_FILE>
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.
-l <LOG_FILE>
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.
-P <PIDFILE>
Save PID in PIDFILE , only use in conjunction with -d option. -r <PERCENT> Set the percentage of sessions to transfer (integer, 1~100).
-v
Print version info and exit.

NOTES

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.

AUTHOR

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