• Stars
    star
    515
  • Rank 85,879 (Top 2 %)
  • Language
    Go
  • License
    MIT License
  • Created almost 7 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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

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--

More Repositories

1

update-golang

update-golang is a script to easily fetch and install new Golang releases with minimum system intrusion
Shell
1,653
star
2

jazigo

Jazigo is a tool written in Go for retrieving configuration for multiple devices, similar to rancid, fetchconfig, oxidized, Sweet.
Go
194
star
3

conbox

conbox is a Go implementation of unix-like utilities as single static executable intended for small container images.
Go
36
star
4

fugo

fugo - fun with Go. gomobile OpenGL game
Go
35
star
5

basgo

basgo compiles BASIC-lang to Golang. Then 'go build' can translate code to native executable binary.
Go
32
star
6

gwob

gwob - Pure Go Golang parser for Wavefront .OBJ 3D geometry file format
Go
32
star
7

equalfile

Go package to compare files
Go
25
star
8

gowebhello

gowebhello is a simple golang replacement for 'python -m SimpleHTTPServer'.
Go
14
star
9

disbalance

disbalance - automagic load balancer
Go
13
star
10

fetchconfig

fetchconfig is a Perl script for retrieving configuration of multiple devices
Perl
13
star
11

golang-concurrency-tricks

Golang concurrency model based on goroutines and channels is not free from sharp edges.
9
star
12

qpimd

PIM Daemon for Quagga - ATTENTION: qpimd has been merged into Official Quagga
C
7
star
13

acigo

Acigo is a Go package for interacting with Cisco ACI using API calls.
Go
6
star
14

obj

OBJ (3d geometry definition format) parser for Dart
Dart
4
star
15

a10-go-rest-client

Go golang API rest client for A10 Networks devices
Go
4
star
16

apishell

Run commands using APIs.
Go
3
star
17

awk_examples

2
star
18

hellolambda

golang aws hello world
Go
2
star
19

modhello

modhello - starter recipe for working with golang modules
Go
2
star
20

gobule

Golang Go parser for the Bule Language
Go
2
star
21

mustago

mustago - simple golang mustache template evaluation in html
JavaScript
2
star
22

kubegroup

kubegroup provides autodiscovery for groupcache peer pods in kubernetes cluster
Go
2
star
23

gateboard

gateboard resolves AWS Private API Gateway ID.
Go
1
star
24

miniapi

miniapi serves a tiny API.
Go
1
star
25

lavalake

lavalake - Manage security groups uniformly across multiple cloud providers.
Go
1
star
26

fapip

fapip stands for fast ping probe, a tool for measuring packet loss against a remote host.
C
1
star
27

sipswitchd

Experimental SIP soft switch
Go
1
star
28

suco

sun colony
Go
1
star
29

ebsnap

Shell
1
star
30

sqs-to-sns

sqs-to-sns is an utility written in Go to forward messages from AWS SQS Queues to AWS SNS Topics.
Go
1
star
31

nexthop

Dynamic Internet Routing Suite in Go
Go
1
star
32

findcidr

Go
1
star
33

gitcheat

1
star
34

jmud

JMud, mud server written in Java in 1990's.
Java
1
star
35

negentropia

Negentropia is a webgl experiment on 3D browser gaming
JavaScript
1
star