p0d

package module
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2023 License: Apache-2.0 Imports: 34 Imported by: 0

README

Circleci Builds Github Issues Github Activity
Go Report Codeclimate Maintainability Codeclimate Test Coverage Go Version License Version

What is p0d?

p0d is a cli based HTTP performance testing tool for Linux and Darwin operating systems. Features include support for HTTP/1.1, HTTP/2, file attachments as multipart/form-data, and TLS. p0d provides realtime updates on stdout, including errors within test runs. p0d is beta grade software under active development, v0.4.0 was released 12/04/23.

Up and running

Homebrew

brew tap simonmittag/cli && 
  brew install p0d

Golang

git clone https://github.com/simonmittag/p0d && cd p0d &&
  go install github.com/simonmittag/p0d/cmd/p0d

Usage Samples

Run for 30 seconds with 10 concurrent connections against local server

λ p0d -d 30 -c 10 http://localhost:8080/path

Run in http/2 mode against local server and save output to log.json

λ p0d -H 2 -O log.json http://localhost:8080/path

Run with config file

λ p0d -C config_get.yml

Cli args

λ p0d v0.3.9
 usage: p0d [-f flag] [URL]

 flags:
  -C string
        load configuration from yml file
  -H string
        http version to use. Values are 1.1 and 2 (which works only with TLS URLs). Defaults to 1.1 (default "1.1")
  -O string
        save detailed JSON output to file
  -c int
        maximum amount of concurrent TCP connections used (default 1)
  -d int
        time in seconds to run p0d (default 10)
  -h    
        print usage instructions
  -s 
        skip internet speed test, i.e. for local targets
  -v    
        print version

Config file reference

---
exec:
  mode: binary
  durationSeconds: 10
  concurrency: 1
  logsampling: 1
  spacingMillis: 10
  skipInetTest: true
req:
  method: POST
  url: http://localhost:8080/path
  headers:
    - Accept-Encoding: "identity"
  body: '
   { "your": "body" }
  '
res:
  code: 200
exec.mode

binary or decimal for MiB or MB units in reporting

exec.durationsSeconds

run pod for n seconds. Defaults to 10

exec.dialTimeoutSeconds

give up connecting to upstream resource after n seconds. Defaults to 3

exec.concurrency

use a pool of maximum n concurrent TCP connections. Defaults to 1. Make sure your OS supports sufficient open file descriptors before settings this to a very high value.

exec.spacingMillis

artificial spacing in milliseconds, introduced before sending each request. Defaults to 0

exec.httpVersion

preferred http version. Allowable values are 1.1. and 2. Defaults to 1.1. Please note that HTTP/2 is only supported using TLS. Http version is negotiated, not absolute and HTTP/2 may fall back to HTTP/1.1

exec.logsampling

ratio between 0.0 and 1.0 of requests to keep when saving results to disk with -O Defaults to 0

exec.skipInetTest

skips the general internet speed test. Note this is not targetting your URL but the speedtest.net network.

req.method

http request method, usually one of GET, PUT, POST, or DELETE

req.url

upstream resource url. Must be supplied.

req.headers

list of headers to include in the request. use this to inject i.e. authentication

res.code

the expected http resonse code. if not matched, request counts as failed in test summary. Defaults to 200

Contributions

The p0d team welcomes all contributors. Everyone interacting with the project's codebase, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct

Documentation

Index

Constants

View Source
const AT = "@"
View Source
const CLOSE = "]"
View Source
const CURRENT = ">"
View Source
const EMPTY = " "
View Source
const FULL = "="
View Source
const N = ""
View Source
const OPEN = "["
View Source
const RAMP = "-"
View Source
const UNLIMITED int = -1
View Source
const Version string = "v0.4.0"

Variables

This section is empty.

Functions

func ByteCountIEC

func ByteCountIEC(b int64) string

func ByteCountSI

func ByteCountSI(b int64) string

func FGroup

func FGroup(n int64) string
func PrintLogo() (int, error)

func PrintVersion

func PrintVersion()

Types

type ChunkProps added in v0.2.9

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

type Config

type Config struct {
	Req  Req
	Res  Res
	Exec Exec
	File string
}

type Exec

type Exec struct {
	Mode               string
	DurationSeconds    int
	RampSeconds        int
	Concurrency        int
	DialTimeoutSeconds int64
	LogSampling        float64
	SpacingMillis      int64
	HttpVersion        float32
	SkipInetTest       bool
}

type OS added in v0.3.1

type OS struct {
	PID              int
	OpenConns        []OSOpenConns
	MaxOpenConns     int
	LimitOpenFiles   int64
	LimitRAMBytes    uint64
	InetLatencyNs    time.Duration
	InetUlSpeedMBits float64
	InetDlSpeedMBits float64
	InetTestAborted  bool
	// contains filtered or unexported fields
}

type OSNet added in v0.3.1

type OSNet struct {
	Target *speedtest.Server
	// contains filtered or unexported fields
}

func NewOSNet added in v0.3.1

func NewOSNet() (*OSNet, error)

type OSOpenConns added in v0.3.1

type OSOpenConns struct {
	Time      time.Time
	OpenConns int
	PID       int
}

func NewOSOpenConns added in v0.3.1

func NewOSOpenConns(pid int) *OSOpenConns

type P0d

type P0d struct {
	ID          string
	Time        Time
	Config      Config
	OS          OS
	ReqStats    *ReqStats
	Output      string
	Interrupted bool
	// contains filtered or unexported fields
}

func NewP0d added in v0.3.1

func NewP0d(cfg Config, ulimit int64, outputFile string, durationSecs int, interrupt chan os.Signal) *P0d

func NewP0dFromFile

func NewP0dFromFile(f string, o string) *P0d

func NewP0dWithValues

func NewP0dWithValues(c int, d int, u string, h string, o string, s bool) *P0d

func (*P0d) Race

func (p *P0d) Race()

func (*P0d) StartTimeNow added in v0.3.1

func (p *P0d) StartTimeNow()

type ProgressBar

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

type Quantile added in v0.3.2

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

func NewQuantile added in v0.3.2

func NewQuantile() *Quantile

func NewQuantileWithCompression added in v0.3.2

func NewQuantileWithCompression(compression float64) *Quantile

func (*Quantile) Add added in v0.3.2

func (q *Quantile) Add(val float64, weight int) *Quantile

func (*Quantile) MarshalJSON added in v0.3.2

func (q *Quantile) MarshalJSON() ([]byte, error)

func (*Quantile) Quantile added in v0.3.2

func (q *Quantile) Quantile(v float64) float64

type Req

type Req struct {
	Method        string
	Url           string
	Headers       []map[string]string
	ContentType   string
	Body          string
	FormData      []map[string]string
	FormDataFiles map[string][]byte
	Ips           []net.IP
}

type ReqAtmpt

type ReqAtmpt struct {
	Start    time.Time
	Stop     time.Time
	ElpsdNs  time.Duration
	ReqBytes int64
	ResCode  int
	ResBytes int64
	ResErr   string
}

type ReqStats added in v0.2.6

type ReqStats struct {
	Start                        time.Time
	ElpsdNs                      time.Duration
	ReqAtmpts                    int64
	CurReqAtmptsPSec             int64
	MeanReqAtmptsPSec            int64
	MaxReqAtmptsPSec             int64
	CurBytesReadPSec             int64
	SumBytesRead                 int64
	MeanBytesReadPSec            int64
	MaxBytesReadPSec             int64
	CurBytesWrittenPSec          int64
	SumBytesWritten              int64
	MeanBytesWrittenPSec         int64
	MaxBytesWrittenPSec          int64
	ElpsdAtmptLatencyNsQuantiles *Quantile
	ElpsdAtmptLatencyNs          *Welford
	SumMatchingResponseCodes     int
	PctMatchingResponseCodes     float32
	Sample                       Sample
	SumErrors                    int
	PctErrors                    float32
	ErrorTypes                   map[string]int
}

type Res

type Res struct {
	Code int
}

type Sample added in v0.3.1

type Sample struct {
	Server      string
	HTTPVersion string
	TLSVersion  string
	IPVersion   string
	RemoteAddr  string
}

func NewSample added in v0.3.1

func NewSample() Sample

type SpinnerAnim added in v0.3.1

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

func NewSpinnerAnim added in v0.3.1

func NewSpinnerAnim() *SpinnerAnim

func (*SpinnerAnim) Next added in v0.3.1

func (b *SpinnerAnim) Next() string

type Time added in v0.3.1

type Time struct {
	Start time.Time
	Stop  time.Time
	Phase TimerPhase
}

type TimerPhase added in v0.2.8

type TimerPhase int
const (
	Bootstrap TimerPhase = 1 << iota
	RampUp
	Main
	RampDown
	Draining
	Drained
	Done
)

type Welford added in v0.3.5

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

func NewWelford added in v0.3.5

func NewWelford() *Welford

func (*Welford) Add added in v0.3.5

func (w *Welford) Add(val float64)

func (*Welford) Cv added in v0.3.6

func (w *Welford) Cv() float64

func (*Welford) MarshalJSON added in v0.3.5

func (w *Welford) MarshalJSON() ([]byte, error)

func (*Welford) Mean added in v0.3.5

func (w *Welford) Mean() float64

func (*Welford) Stddev added in v0.3.5

func (w *Welford) Stddev() float64

func (*Welford) StddevPop added in v0.3.5

func (w *Welford) StddevPop() float64

func (*Welford) Stderr added in v0.3.5

func (w *Welford) Stderr() float64

func (*Welford) Var added in v0.3.5

func (w *Welford) Var() float64

func (*Welford) VarPop added in v0.3.5

func (w *Welford) VarPop() float64

Directories

Path Synopsis
cmd
p0d

Jump to

Keyboard shortcuts

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