Home

Awesome

Introduction

I wrote that code because: (the obvious reason::I love to write code in Go)

We are working so hard to optimize our servers - why shouldn't we do it for our clients testers?!

I noticed that the existing tools for benchmarking/load HTTP/HTTPS servers has some issues:

If you already familiar with the model of Go for high performance I/O with goroutines, we can achieve that mission easily.

The funny part - I did some benchmark to the client tester tool and not to the server:

##Siege vs GoBench:

###Siege:

$>siege -b -t10S -c500 http://localhost:80/

** SIEGE 2.70
** Preparing 500 concurrent users for battle.
The server is now under siege...
Lifting the server siege...      done.
Transactions:		       74247 hits
Availability:		      100.00 %
Elapsed time:		        9.62 secs
Data transferred:	       96.58 MB
Response time:		        0.06 secs
Transaction rate:	     7717.98 trans/sec
Throughput:		       10.04 MB/sec
Concurrency:		      490.19
Successful transactions:       74247
Failed transactions:	           0
Longest transaction:	        1.02
Shortest transaction:	        0.00

###GoBench:

$>gobench -k=true -u http://localhost:80 -c 500 -t 10
Dispatching 500 clients
Waiting for results...

Requests:                           343669 hits
Successful requests:                343669 hits
Network failed:                          0 hits
Bad requests failed (!2xx):              0 hits
Successfull requests rate:           34366 hits/sec
Read throughput:                  54700061 bytes/sec
Write throughput:                  4128684 bytes/sec
Test time:                              10 sec

Usage

  1. install Go env follow: https://golang.org/dl/

  2. download gobench

    GOPATH=/tmp/ go get github.com/valyala/fasthttp
    GOPATH=/tmp/ go get github.com/cmpxchg16/gobench
    
  3. run some http server on port 80

  4. run gobench for HTTP GET

    $>gobench -u http://localhost:80 -k=true -c 500 -t 10

  5. run gobench for HTTP POST

    $>gobench -u http://localhost:80 -k=true -c 500 -t 10 -d /tmp/post

Notes

  1. Because it's a test tool, in HTTPS the ceritificate verification is insecure
  2. use Go >= 1.5 (fasthttp require it)

Help

gobench --help

License

Licensed under the New BSD License.

Author

Uri Shamay (shamayuri@gmail.com)