Coder Social home page Coder Social logo

udhos / goben Goto Github PK

View Code? Open in Web Editor NEW
553.0 13.0 54.0 94 KB

goben is a golang tool to measure TCP/UDP transport layer throughput between hosts.

License: MIT License

Shell 1.56% Go 98.44%
golang go networking benchmarking tool tcp performance-testing udp bandwidth measure-tcp-throughput

goben's Introduction

license Go Report Card Go Reference GolangCI

goben

goben is a golang tool to measure TCP/UDP transport layer throughput between hosts.

Created by gh-md-toc

Features

  • Support for TCP, UDP, TLS.
  • Can limit maximum bandwidth.
  • Written in Go. Single executable file. No runtime dependency.
  • Simple usage: start the server then launch the client pointing to server's address.
  • Spawns multiple concurrent lightweight goroutines to handle multiple parallel traffic streams.
  • Can save test results as PNG chart.
  • Can export test results as YAML or CSV.

History

  • Years ago out of frustration with iperf2 limitations, I wrote the nepim tool. One can find some known iperf problems here: iperf caveats. Nepim was more customizable, easier to use, reported simpler to understand results, was lighter on CPU.
  • Later I found another amazing tool called nuttcp. One can read about nepim and nuttcp here: nepim and nuttcp.
  • goben is intended to fix shortcomings of nepim: (1) Take advantage of multiple CPUs while not wasting processing power. Nepim was single-threaded. (2) Be easily portable to multiple platforms. Nepim was heavily tied to UNIX-like world. (3) Use a simpler synchronous code flow. Nepim used hard-to-follow asynchronous architecture.

Requirements

Install

With Go Modules (since Go 1.11)

git clone https://github.com/udhos/goben ;# clone outside GOPATH
cd goben
go test ./goben
CGO_ENABLED=0 go install ./goben

Without Go Modules (before Go 1.11)

go get github.com/wcharczuk/go-chart
go get gopkg.in/yaml.v2
go get github.com/udhos/goben
go install github.com/udhos/goben/goben

Usage

Make sure ~/go/bin is in your shell PATH.

Start server:

server$ goben

Start client:

client$ goben -hosts 1.1.1.1 ;# 1.1.1.1 is server's address

Command-line Options

Find several supported command-line switches by running 'goben -h':

$ goben -h
2021/02/28 00:43:28 goben version 0.6 runtime go1.16 GOMAXPROCS=12 OS=linux arch=amd64
Usage of goben:
  -ascii
        plot ascii chart (default true)
  -cert string
        TLS cert file (default "cert.pem")
  -chart string
        output filename for rendering chart on client
        '%d' is parallel connection index to host
        '%s' is hostname:port
        example: -chart chart-%d-%s.png
  -connections int
        number of parallel connections (default 1)
  -csv string
        output filename for CSV exporting test results on client
        '%d' is parallel connection index to host
        '%s' is hostname:port
        example: -csv export-%d-%s.csv
  -defaultPort string
        default port (default ":8080")
  -export string
        output filename for YAML exporting test results on client
        '%d' is parallel connection index to host
        '%s' is hostname:port
        example: -export export-%d-%s.yaml
  -hosts value
        comma-separated list of hosts
        you may append an optional port to every host: host[:port]
  -key string
        TLS key file (default "key.pem")
  -listeners value
        comma-separated list of listen addresses
        you may prepend an optional host to every port: [host]:port
  -localAddr string
        bind specific local address:port
        example: -localAddr 127.0.0.1:2000
  -maxSpeed float
        bandwidth limit in mbps (0 means unlimited)
  -passiveClient
        suppress client writes
  -passiveServer
        suppress server writes
  -reportInterval string
        periodic report interval
        unspecified time unit defaults to second (default "2s")
  -tcpReadSize int
        TCP read buffer size in bytes (default 1000000)
  -tcpWriteSize int
        TCP write buffer size in bytes (default 1000000)
  -tls
        set to false to disable TLS (default true)
  -totalDuration string
        test total duration
        unspecified time unit defaults to second (default "10s")
  -udp
        run client in UDP mode
  -udpReadSize int
        UDP read buffer size in bytes (default 64000)
  -udpWriteSize int
        UDP write buffer size in bytes (default 64000)

Example

Server side:

$ goben
2018/06/28 15:04:26 goben version 0.3 runtime go1.11beta1 GOMAXPROCS=1
2018/06/28 15:04:26 connections=1 defaultPort=:8080 listeners=[":8080"] hosts=[]
2018/06/28 15:04:26 reportInterval=2s totalDuration=10s
2018/06/28 15:04:26 server mode (use -hosts to switch to client mode)
2018/06/28 15:04:26 serve: spawning TCP listener: :8080
2018/06/28 15:04:26 serve: spawning UDP listener: :8080

Client side:

$ goben -hosts localhost
2018/06/28 15:04:28 goben version 0.3 runtime go1.11beta1 GOMAXPROCS=1
2018/06/28 15:04:28 connections=1 defaultPort=:8080 listeners=[":8080"] hosts=["localhost"]
2018/06/28 15:04:28 reportInterval=2s totalDuration=10s
2018/06/28 15:04:28 client mode, tcp protocol
2018/06/28 15:04:28 open: opening tcp 0/1: localhost:8080
2018/06/28 15:04:28 handleConnectionClient: starting 0/1 [::1]:8080
2018/06/28 15:04:28 handleConnectionClient: options sent: {2s 10s 50000 50000 false 0}
2018/06/28 15:04:28 clientReader: starting: 0/1 [::1]:8080
2018/06/28 15:04:28 clientWriter: starting: 0/1 [::1]:8080
2018/06/28 15:04:30 0/1  report   clientReader rate:  13917 Mbps  34793 rcv/s
2018/06/28 15:04:30 0/1  report   clientWriter rate:  13468 Mbps  33670 snd/s
2018/06/28 15:04:32 0/1  report   clientReader rate:  14044 Mbps  35111 rcv/s
2018/06/28 15:04:32 0/1  report   clientWriter rate:  13591 Mbps  33978 snd/s
2018/06/28 15:04:34 0/1  report   clientReader rate:  12934 Mbps  32337 rcv/s
2018/06/28 15:04:34 0/1  report   clientWriter rate:  12517 Mbps  31294 snd/s
2018/06/28 15:04:36 0/1  report   clientReader rate:  13307 Mbps  33269 rcv/s
2018/06/28 15:04:36 0/1  report   clientWriter rate:  12878 Mbps  32196 snd/s
2018/06/28 15:04:38 0/1  report   clientWriter rate:  13330 Mbps  33325 snd/s
2018/06/28 15:04:38 0/1  report   clientReader rate:  13774 Mbps  34436 rcv/s
2018/06/28 15:04:38 handleConnectionClient: 10s timer
2018/06/28 15:04:38 workLoop: 0/1 clientWriter: write tcp [::1]:42130->[::1]:8080: use of closed network connection
2018/06/28 15:04:38 0/1 average   clientWriter rate:  13157 Mbps  32892 snd/s
2018/06/28 15:04:38 clientWriter: exiting: 0/1 [::1]:8080
2018/06/28 15:04:38 workLoop: 0/1 clientReader: read tcp [::1]:42130->[::1]:8080: use of closed network connection
2018/06/28 15:04:38 0/1 average   clientReader rate:  13595 Mbps  33989 rcv/s
2018/06/28 15:04:38 clientReader: exiting: 0/1 [::1]:8080
2018/06/28 15:04:38 input:
 14038 ┤          ╭────╮
 13939 ┤──────────╯    ╰╮
 13840 ┼                ╰─╮
 13741 ┤                  ╰╮                                    ╭──
 13641 ┤                   ╰╮                               ╭───╯
 13542 ┤                    ╰─╮                          ╭──╯
 13443 ┤                      ╰╮                     ╭───╯
 13344 ┤                       ╰─╮               ╭───╯
 13245 ┤                         ╰╮          ╭───╯
 13146 ┤                          ╰─╮    ╭───╯
 13047 ┤                            ╰────╯
 12948 ┤
2018/06/28 15:04:38 output:
 13585 ┤          ╭────╮
 13489 ┤──────────╯    ╰╮
 13393 ┼                ╰─╮
 13297 ┤                  ╰╮                                    ╭──
 13201 ┤                   ╰╮                               ╭───╯
 13105 ┤                    ╰─╮                          ╭──╯
 13009 ┤                      ╰╮                     ╭───╯
 12914 ┤                       ╰─╮               ╭───╯
 12818 ┤                         ╰╮          ╭───╯
 12722 ┤                          ╰─╮    ╭───╯
 12626 ┤                            ╰────╯
 12530 ┤
2018/06/28 15:04:38 handleConnectionClient: closing: 0/1 [::1]:8080

TLS

For TLS, a server-side certificate is required:

$ openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout key.pem -out cert.pem

If the certificate is available, goben server listens on TLS socket. Otherwise, it falls back to plain TCP.

--x--

goben's People

Contributors

apostov avatar j3hempsey avatar ke9 avatar udhos avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

goben's Issues

Additional binary releases

Awesome tool. This is the first thing I've found that will run on unifi devices natively.

I'd suggest adding two builds:

  • aarch64 (go's arm64)
  • mips softfloat (build with GOMIPS=softfloat)

Can I see Lost/Jitter?

I previously used iperf3.1.3 to measure my WiFi quality (for Moolight Streaming). With iperf and UDP testing I got jitter (ms) and Lost (%). Is there a chance to get this informations? Or how I can measure my network quality for streaming?

does this tool support concurrent connections from multiple devices?

Hello,

this tool looks very interesting, but I am curious, and my apologies if this seems a dumb question -- does it support concurrent connections from multiple clients? i.e. if I have client A in an office and client B in another office, and they both try to hit the server at the same time, will it service both simultaneously?

My use case is around having a powerful server say in central DC and client in various locations around enterprise that can use it as test point for simple bandwidth testing of the site, but its possible I would have many clients connecting at once.

Thanks.

Report summary statistics with parallel connections

Hi,

It'd be nice to have a summary output like iperf3

[SUM] 0.00-10.00 sec 5.97 GBytes 5.12 Gbits/sec 11749 sender
[SUM] 0.00-10.03 sec 5.96 GBytes 5.11 Gbits/sec receiver

because

2019/02/12 13:00:19 0/10 report clientWriter rate: 1538 Mbps 3846 snd/s
2019/02/12 13:00:19 1/10 report clientWriter rate: 1388 Mbps 3471 snd/s
2019/02/12 13:00:19 2/10 report clientWriter rate: 1713 Mbps 4283 snd/s
2019/02/12 13:00:19 3/10 report clientWriter rate: 1370 Mbps 3425 snd/s
2019/02/12 13:00:19 5/10 report clientWriter rate: 1350 Mbps 3375 snd/s
2019/02/12 13:00:19 4/10 report clientWriter rate: 1416 Mbps 3540 snd/s
2019/02/12 13:00:19 6/10 report clientWriter rate: 1480 Mbps 3702 snd/s
2019/02/12 13:00:19 7/10 report clientWriter rate: 1161 Mbps 2903 snd/s
2019/02/12 13:00:19 8/10 report clientWriter rate: 1199 Mbps 2999 snd/s
2019/02/12 13:00:19 9/10 report clientWriter rate: 1475 Mbps 3689 snd/s

is not very helpful.
We have a network that requires multiple connections to reach max throughput.

Bonded network

Hi - One question to you.

I tested this tool on a bonded network (2 ports x 25 Gbps and two such cards) and this gives a combined throughput of 100 Gbps using 4 pots.

But, I do not go beyond these values.

2021/04/02 13:27:30 aggregate reading: 19106 Mbps 47789 recv/s
2021/04/02 13:27:30 aggregate writing: 6797 Mbps 16994 send/s

The above seems to use only one port.

This is the same case with iperf where it does not do load balancing across ports.

I am using this tool for the first time and it looks very impressive.

Do you know if missed anything obvious?

Thanks

How to test between two IPv6 addresses?

Hi,
is IPv6 supported? Tried with "goben --hosts 2001:db8::beef" but have the following error:

dial tcp: 2001db8::beef: dial tcp: address 2001db8::beef: too many colons in address

Anyway, thanks for this useful tool.

how to calculate the bandwidth(speed) from report result,i hope the result is kile 5Gbps

i use goben test vm1 to vm2 bandwidth,got result like this

[root@upd-1 ~]# ./goben -udp -hosts 10.0.55.245
2024/01/31 14:00:54 goben version 0.6 runtime go1.18beta1 GOMAXPROCS=8 OS=linux arch=amd64
2024/01/31 14:00:54 connections=1 defaultPort=:8080 listeners=[":8080"] hosts=["10.0.55.245"]
2024/01/31 14:00:54 reportInterval=2s totalDuration=10s
2024/01/31 14:00:54 client mode, udp protocol
2024/01/31 14:00:54 open: opening TLS=true udp 0/1: 10.0.55.245:8080
2024/01/31 14:00:54 handleConnectionClient: starting TCP 0/1 10.0.55.245:8080
2024/01/31 14:00:54 handleConnectionClient: options sent: {2s 10s 1000000 1000000 64000 64000 false 0 map[]}
2024/01/31 14:00:54 clientWriter: starting: 0/1 10.0.55.245:8080
2024/01/31 14:00:54 clientReader: starting: 0/1 10.0.55.245:8080
2024/01/31 14:00:56 0/1 report clientWriter rate: 23672 Mbps 46235 snd/s
2024/01/31 14:00:56 0/1 report clientReader rate: 35 Mbps 68 rcv/s
2024/01/31 14:00:58 0/1 report clientWriter rate: 19150 Mbps 37403 snd/s
2024/01/31 14:00:58 0/1 report clientReader rate: 3887 Mbps 7592 rcv/s
2024/01/31 14:01:00 0/1 report clientWriter rate: 18989 Mbps 37088 snd/s
2024/01/31 14:01:00 0/1 report clientReader rate: 3106 Mbps 6068 rcv/s
2024/01/31 14:01:02 0/1 report clientWriter rate: 16185 Mbps 31613 snd/s
2024/01/31 14:01:02 0/1 report clientReader rate: 1480 Mbps 2891 rcv/s
2024/01/31 14:01:04 handleConnectionClient: 10s timer
2024/01/31 14:01:04 workLoop: 0/1 clientReader: read udp 10.0.55.58:43576->10.0.55.245:8080: use of closed network connection
2024/01/31 14:01:04 0/1 average clientReader rate: 1827 Mbps 3570 rcv/s
2024/01/31 14:01:04 clientReader: exiting: 0/1 10.0.55.245:8080
2024/01/31 14:01:04 workLoop: 0/1 clientWriter: write udp 10.0.55.58:43576->10.0.55.245:8080: use of closed network connection
2024/01/31 14:01:04 0/1 average clientWriter rate: 19026 Mbps 37161 snd/s
2024/01/31 14:01:04 clientWriter: exiting: 0/1 10.0.55.245:8080
2024/01/31 14:01:04 10.0.55.245:8080 input:
3888 ┼ ╭───────╮
3502 ┤ ╭─╯ ╰───────────╮
3117 ┤ ╭─╯ ╰───────╮
2732 ┤ ╭──╯ ╰────╮
2347 ┤ ╭─╯ ╰────╮
1961 ┤ ╭─╯ ╰─────╮
1576 ┤ ╭──╯ ╰───
1191 ┤ ╭─╯
806 ┤ ╭─╯
420 ┤╭──╯
35 ┼╯
Input Mbps: 10.0.55.245:8080 Connection 0
2024/01/31 14:01:04 10.0.55.245:8080 output:
23673 ┼╮
22924 ┤╰───╮
22175 ┤ ╰───╮
21427 ┤ ╰──╮
20678 ┤ ╰───╮
19929 ┤ ╰───╮
19181 ┤ ╰───────────╮
18432 ┤ ╰───────────────────╮
17683 ┤ ╰─────╮
16935 ┤ ╰─────╮
16186 ┤ ╰─────
Output Mbps: 10.0.55.245:8080 Connection 0
2024/01/31 14:01:04 handleConnectionClient: closing: 0/1 10.0.55.245:8080
2024/01/31 14:01:04 aggregate reading: 1827 Mbps 3570 recv/s
2024/01/31 14:01:04 aggregate writing: 19026 Mbps 37161 send/s

can u help me to calculate the udp bandwidth with like Gbps/s or Mbps/s

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.