carrot

package module
v0.0.0-...-450e834 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2018 License: MIT Imports: 10 Imported by: 1

README

Carrot

Distributed WebSocket and HTTP Load Testing Framework in Go

Moved to New Open Source Organization: https://github.com/gophercarrot/carrot

Highly Concurrent Load Testing Framework

Setup

Properly setup $GOPATH

Fetch Dependencies

go get github.com/gorilla/websocket
go get github.com/wcharczuk/go-chart

Fetch Carrot

go get -v github.com/interviewstreet/carrot

Running

Go to $GOPATH/go/src/github.com/interviewstreet/carrot and run

go run cmd/main.go

Config at Run time

go run main.go -host=example.com -protocol=wss -htime=40 -request=5000 -wtime=1 -htime=30 -path=/somepath

wtime -> number of seconds to wait before writing to websockets
htime -> number of milliseconds to wait before creating new websocket connection

Parameters in main.go

currentTest := &carrot.Base{"example.com", "wss", 1000, msg, 2, 30}

wss -> protocol use 'ws' for localhost
1000 -> number of requests
msg -> payload to send
2 -> number of seconds to wait before writing to websockets
30 -> number of milliseconds to wait before creating new websocket connection
After stats you should see screenshot which can be looked at http://localhost:8900/latency

ScreenShot

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateSocket

func CreateSocket(addr string, urlProto string, path string, counter *Counter) (*websocket.Conn, error)

CreateSocket returns a socket instance

func DrawChart

func DrawChart(res http.ResponseWriter, req *http.Request, latency []float64, timeSeries []time.Time)

func LoadTest

func LoadTest(base *Base, latencyCh chan []float64, timeCh chan []time.Time, payload_file string)

func StartHTTPServer

func StartHTTPServer(port string, latency []float64, timeSeries []time.Time)

Types

type Base

type Base struct {
	URL, Proto string
	Count      int
	Delay      int
	TickDelay  int
	Path       string
}

type Counter

type Counter struct {
	// contains filtered or unexported fields
}

Counter struct for global increment

func (*Counter) Failure

func (counter *Counter) Failure() int

func (*Counter) Increment

func (counter *Counter) Increment() int

Increment function can be called globally

func (*Counter) Success

func (counter *Counter) Success() int

type Routine

type Routine struct {
	SendTime    time.Time
	ReceiveTime time.Time
	Diff        time.Duration // milliseconds
	ReceivedMsg string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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