Simple HTTPerf clone for performance testing web applications written in Go.
NOTE: This is the inital commit and shouldn't be considered ready for anyone. That said, it should work as outlined below, at least on Linux based systems.
# manual
$ git clone https://github.com/jmervine/goperf.git $GOPATH/src/github.com/jmervine/goperf
$ cd $GOPATH/src/github.com/jmervine/goperf
$ make build/exe
$ cp pkg/goperf-VERSION $BIN/goperf
# $BIN is a directory of your choosing in your $PATH
$ ./goperf-v0.0.1 -help
Usage of ./goperf-v0.0.1:
-n=0: Total number of connections.
-r=0: Connection rate (per second).
-u="": Target URL.
-v=false: Print verbose messaging.
-version=false: Show version infomration.
import "github.com/jmervine/goperf"
Package perf is a simple HTTPerf clone for performance testing web applications written in Go.
This is designed to be run as a command line too, however, can be hooked in to as an API as well.
CLI Usage:
$ ./goperf-v0.0.1 -help
Usage of ./goperf-v0.0.1:
-n=0: Total number of connections.
-r=0: Connection rate (per second).
-u="": Target URL.
-v=false: Print verbose messaging.
-version=false: Show version infomration.
// Start()
config := &Configurator{
Path: "http://localhost",
NumConns: 100,
Rate: 10,
Verbose: true,
}
results := Start(config)
Display(results)
// QuickRun()
quick := QuickRun("http://localhost", 100, 10)
Display(quick)
var Testing = false
Testing is a flag for disabling certain messaging during test.
var Version = "v0.0.4"
Version is package version.
type Configurator struct {
Rate float64
NumConns int
Path string
Verbose bool
}
func Connect(path string, verbose bool) *results.Result
Connect makes a singled connection, returning a simplified result struct.
go stubServer()
results := Connect("http://localhost:9876", false)
fmt.Printf("Status Code: %v\n", results.Code)
// Output:
// Status Code: 200
func Display(r *results.Results)
Display formatted results.
func Parallel(config *Configurator) *results.Results
Parallel forces a parallel run using a Configurator.
config := &Configurator{
Path: "http://localhost",
NumConns: 100,
Rate: 10,
Verbose: true,
}
results := Parallel(config)
Display(results)
func QuickRun(path string, numconns int, rate float64) *results.Results
QuickRun limited options.
func Series(config *Configurator) *results.Results
Series forces a run using a Configurator, running request in series.
config := &Configurator{
Path: "http://localhost",
NumConns: 100,
Rate: 10,
Verbose: true,
}
results := Parallel(config)
Display(results)
func Siege(path string, numconns int) *results.Results
Siege forces Parallel run, with limited options.
results := Siege("http://localhost", 100)
Display(results)
func Start(config *Configurator) *results.Results
Start a new run using a Configurator