freebsd-dev/tools/tools/netrate
Luigi Rizzo ed8c4b44e6 Support the specification of a range of destination ports e.g.
netsend 127.0.0.1 6666-7777 [payloadsize] [packet_rate] [duration]

This is useful to test the behaviour of systems that do some kind
of flow classifications and so exhibit different behaviour depending
on the number of flows that hit them.
I plan to add a similar extension to sweep on a range of IP addresses,
so we can issue a single command to flood (obviously, for testing
purposes!) a number of different destinations.

When there is only one destination, we do a preliminary connect()
of the socket so we can use send() instead of sendto().
When we have multiple ports, the socket is not connect()'ed and we
do a sendto() instead. There is a performance hit in this case,
as the throughput on the loopback interface (with a firewall rule
that blocks the transmission) goes down from 900kpps to 490kpps on
my test machine.

If the number of different destinations is limited, one option to
explore is to have multiple connect()ed sockets.

MFC after:	1 month
2009-10-15 15:30:41 +00:00
..
http Enforce the compile-time threads limit at run-time, so that a high thread 2006-09-02 08:25:40 +00:00
httpd Add multi-process support to simple httpd micro-benchmark, which is now 2006-02-22 02:54:04 +00:00
juggle Style: NO_MAN doesn't need any value. 2006-03-15 10:46:38 +00:00
netblast Fix compiling on platforms with 64bit time_t. 2005-12-16 06:02:44 +00:00
netreceive
netsend Support the specification of a range of destination ports e.g. 2009-10-15 15:30:41 +00:00
tcpconnect Add simple TCP connect and TCP receive benchmark components, intended to 2005-10-05 12:10:35 +00:00
tcpp Add tcpp -- TCP parallelism microbenchmark. 2009-03-10 14:52:17 +00:00
tcpreceive Add simple TCP connect and TCP receive benchmark components, intended to 2005-10-05 12:10:35 +00:00
Makefile
Makefile.inc
README

Netsend and Netreceive
----------------------

This pair of binaries is used to fixed rate UDP performance testing.

The netreceive tool consists solely of a UDP packet sink bound to a
specified UDP port.  Packets received on its port are copied to user space
and discarded.

The netsend tool acts as a packet source, generating packets of the
specified size at the specified rate to a target IP address and port
number:

   netsend [ip] [port] [payloadsize] [rate] [duration]

The payloadsize field specifies the size of the UDP payload, not the total 
packet size, which will also include a variety of headers (typically, 
ethernet, IP, and UDP).

The rate indicates the number of packets/second to attempt to deliver.

The duration is the duration of the run in seconds.

The netsend tool will wait for around two seconds to synchronize with the
wall clock for timing purposes.  It will then busy-wait between packet
transmits.

The netsend/netreceive tools are under the following copyright and
license:

/*-
 * Copyright (c) 2004 Robert N. M. Watson
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 */

$FreeBSD$