Git Product home page Git Product logo

go-wrk's Introduction

go-wrk 0.1

this is a small http benchmark utility similar to https://github.com/wg/wrk but written in go. it has a couple of features absent from wrk

  • https support (quite expensive on the client side with disabled keep alives)
  • http POST support
  • more statistics
  • leaner codebase

status

this tool is in early stage development but stable enough to run larger benchmark sets. missing features will be added as needed, pull requests are welcome ;)

building

you need go 1.0+ (1.1 is suggested for performance)

git clone git://github.com/adeven/go-wrk.git
cd go-wrk
go build

usage

basic usage is quite simple:

go-wrk [flags] url

with the flags being

    -H="User-Agent: go-wrk 0.1 bechmark\nContent-Type: text/html;": the http headers sent separated by '\n'
    -c=100: the max numbers of connections used
    -k=true: if keep-alives are disabled
    -i=false: if TLS security checks are disabled
    -m="GET": the http request method
    -n=1000: the total number of calls processed
    -t=1: the numbers of threads used
    -b="" the http request body
    -s="" if specified, it counts how often the searched string s is contained in the responses

for example

go-wrk -c=400 -t=8 -n=100000 http://localhost:8080/index.html

example output

==========================BENCHMARK==========================
URL:				http://localhost:8509/startup?app_id=479516143&mac=123456789

Used Connections:			100
Used Threads:				1
Total number of calls:		100000

============================TIMES============================
Total time passed:			19.47s
Avg time per request:		19.45ms
Requests per second:		5135.02
Median time per request:	11.30ms
99th percentile time:		65.23ms
Slowest time for request:	1698.00ms

==========================RESPONSES==========================
20X responses:		100000	(100%)
30X responses:		0	(0%)
40X responses:		0	(0%)
50X responses:		0	(0%)
matchResponses:     100000  (100.00%)

License

This Software is licensed under the MIT License.

Copyright (c) 2013 adeven GmbH, http://www.adeven.com

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

go-wrk's People

Contributors

chenziliang avatar elmacnifico avatar hojabri avatar katzien avatar kotik avatar macdylan avatar pdaures avatar pedromg avatar remoe avatar roa avatar shibayan avatar tmc avatar xinst avatar yannic 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  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

go-wrk's Issues

Crash - runtime: program exceeds 10000-thread limit

go-wrk -m GET -t 10 -c 50000 -d 5 http://10.4.0.104:8080/httpretry
runtime: program exceeds 10000-thread limit
fatal error: thread exhaustion

runtime stack:
runtime.throw(0x6d1ad6, 0x11)
D:/Go/src/runtime/panic.go:616 +0x88
runtime.checkmcount()
D:/Go/src/runtime/proc.go:542 +0xb3
runtime.mcommoninit(0xc0b8405c00)
D:/Go/src/runtime/proc.go:560 +0x84
runtime.allocm(0xc042105900, 0x0, 0xc0b8405800)
D:/Go/src/runtime/proc.go:1516 +0x16a
runtime.newm(0x0, 0xc042105900)
D:/Go/src/runtime/proc.go:1830 +0x40
runtime.startm(0xc042105900, 0x84c000)
D:/Go/src/runtime/proc.go:2002 +0x13f
runtime.handoffp(0xc042105900)
D:/Go/src/runtime/proc.go:2029 +0x5c
runtime.retake(0x5d35e2941, 0xd00000001)
D:/Go/src/runtime/proc.go:4363 +0x142
runtime.sysmon()
D:/Go/src/runtime/proc.go:4281 +0x293
runtime.mstart1(0x0)
D:/Go/src/runtime/proc.go:1227 +0xf5
runtime.mstart()
D:/Go/src/runtime/proc.go:1193 +0x76

Details about the 'Errors'

Hi, I m trying to use go-wrk to benchmark my Java program. I m getting below stats:

D:\>go-wrk -c=100 -t=100  -n=100000 http://localhost:8080/test/rest/j1/text
==========================BENCHMARK==========================
URL:                            http://localhost:8080/test/rest/j1/text

Used Connections:               100
Used Threads:                   100
Total number of calls:          100000

===========================TIMINGS===========================
Total time passed:              59.95s
Avg time per request:           59.88ms
Requests per second:            1668.06
Median time per request:        59.04ms
99th percentile time:           121.08ms
Slowest time for request:       173.00ms

=============================DATA=============================
Total response body sizes:              71840
Avg response body per request:          0.72ms
Transfer rate per second:               1198.33 Byte/s (0.00 MByte/s)
==========================RESPONSES==========================
20X Responses:          14368   (14.37%)
30X Responses:          0       (0.00%)
40X Responses:          0       (0.00%)
50X Responses:          0       (0.00%)
50X Responses:          0       (0.00%)
Errors:                 85632   (85.63%)

How can I know that does these 85632 errors represent? Connection timeout? Details about this would be very useful. Thanks.

Results do not use the http status code response

On my server, I return the following values :

  • 2014/01/23 09:32:50 200 0 GET /rest/d?sort=a&filter=namedfilter&page=1&per_page=
    20
  • 2014/01/23 09:32:50 200 0 GET /rest/d?sort=a&filter=namedfilter&page=1&per_page=
    20
  • 2014/01/23 09:32:50 200 0 GET /rest/d?sort=a&filter=namedfilter&page=1&per_page=
    20
  • 2014/01/23 09:32:50 304 0 GET /rest/d?sort=a&filter=namedfilter&page=1&per_page=
    20
    (ie I return a 304 one time on 4)

My results are :
...
==========================RESPONSES==========================
20X Responses: 10000 (100%)
30X Responses: 0 (0%)
40X Responses: 0 (0%)
50X Responses: 0 (0%)
50X Responses: 0 (0%)
Errors: 0 (0%)

There is no 30X responses so I think there is a bug on the results.

how to build in go1.15

  1. I try to build in go1.15, but get an error as follows
    go: cannot find main module, but found .git/config in D:\code\go\go-wrk to create a module there, run: go mod init
  2. if try order: go mod init, and get an error as follows
    go: cannot determine module path for source directory D:\code\go\go-wrk (outside GOPATH, module path must be specified) Example usage: 'go mod init example.com/m' to initialize a v0 or v1 module 'go mod init example.com/m/v2' to initialize a v2 module Run 'go help mod init' for more information.

wrk has https support

It seems like the README here is incorrect and wrk has HTTPS support. maybe it didn't back when this project was started, but it sure does now.

add -r option, it will read all from http response body

When the response body is a stream, there will be a big difference. For example, download a file.

In order to avoid OOM, we can use ioutil.Discard. For example:

if *readAll {
  n, err = io.Copy(ioutil.Discard, resp.Body)
  respObj.Size = n
  return
}

How to Post different body in go-wrk ?

All the examples are based on a certain body or params.
But it would be untruthful if we only using one case to test the system/service performance.

So how to Post vary body in the batch requests test?

for example:

# body
{"key": 1}
{"key": 2}

...

Scripting support

The one standout feature of wrk is scripting support. Does this tool support a scripting API that is reasonably similar?

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.