perf

package module
Version: v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 12, 2014 License: MIT Imports: 3 Imported by: 0

README

goperf

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.

Install

# 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

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.

API Documentation

import "github.com/jmervine/goperf"
Example:
// 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)
Variables
var Testing = false

Testing is a flag for disabling certain messaging during test.

var Version = "v0.0.3"

Version is package version.

Types
Configurator
type Configurator struct {
    Rate     int
    NumConns int
    Path     string
    Verbose  bool
}
Connect
func Connect(path string, verbose bool) *results.Result

Connect makes a singled connection, returning a simplified result struct.

Example:
go stubServer()

results := Connect("http://localhost:9876", false)
fmt.Printf("Status Code: %v\n", results.Code)

// Output:
// Status Code: 200
Display
func Display(r *results.Results)

Display formatted results.

Parallel
func Parallel(config *Configurator) *results.Results

Parallel forces a parallel run using a Configurator.

Example:
config := &Configurator{
    Path:     "http://localhost",
    NumConns: 100,
    Rate:     10,
    Verbose:  true,
}

results := Parallel(config)
Display(results)
QuickRun
func QuickRun(path string, numconns, rate int) *results.Results

QuickRun limited options.

Series
func Series(config *Configurator) *results.Results

Series forces a run using a Configurator, running request in series.

Example:
config := &Configurator{
    Path:     "http://localhost",
    NumConns: 100,
    Rate:     10,
    Verbose:  true,
}

results := Parallel(config)
Display(results)
Siege
func Siege(path string, numconns int) *results.Results

Siege forces Parallel run, with limited options.

Example:
results := Siege("http://localhost", 100)
Display(results)
Start
func Start(config *Configurator) *results.Results

Start a new run using a Configurator

Documentation

Overview

Example
// 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)
Output:

Index

Examples

Constants

This section is empty.

Variables

View Source
var Testing = false

Testing is a flag for disabling certain messaging during test.

View Source
var Version = "v0.0.3"

Version is package version.

Functions

func Connect

func Connect(path string, verbose bool) *results.Result

Connect makes a singled connection, returning a simplified result struct.

Example
go stubServer()

results := Connect("http://localhost:9876", false)
fmt.Printf("Status Code: %v\n", results.Code)
Output:

Status Code: 200

func Display

func Display(r *results.Results)

Display formatted results.

func Parallel

func Parallel(config *Configurator) *results.Results

Parallel forces a parallel run using a Configurator.

Example
config := &Configurator{
	Path:     "http://localhost",
	NumConns: 100,
	Rate:     10,
	Verbose:  true,
}

results := Parallel(config)
Display(results)
Output:

func QuickRun

func QuickRun(path string, numconns, rate int) *results.Results

QuickRun limited options.

func Series

func Series(config *Configurator) *results.Results

Series forces a run using a Configurator, running request in series.

Example
config := &Configurator{
	Path:     "http://localhost",
	NumConns: 100,
	Rate:     10,
	Verbose:  true,
}

results := Parallel(config)
Display(results)
Output:

func Siege

func Siege(path string, numconns int) *results.Results

Siege forces Parallel run, with limited options.

Example
results := Siege("http://localhost", 100)
Display(results)
Output:

func Start

func Start(config *Configurator) *results.Results

Start a new run using a Configurator

Types

type Configurator

type Configurator struct {
	Rate     int
	NumConns int
	Path     string
	Verbose  bool
}

Configurator is a basic data struct for configuring runs.

Source Files

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL