Skip to content

Cross platform HTTP/S benchmark tool - Cassowary

homepage-banner

Cassowary is a new cross-platform HTTP/S load testing tool inspired by many classic open source projects such as k6, ab, and httptestat.


Features

  • Two testing modes: standard and custom. URL paths can be selected in custom mode.
  • CI friendly
  • Flexible algorithms: can directly send algorithms to Prometheus PushGateway, or send algorithms in the form of JSON files.
  • Flexible adjustments: can freely choose which HTTP header fields to use.
  • Cross-platform: one binary file can support Linux, Mac OSX, and Windows at the same time.

Installation

Download the binary file from the GitHub Releases page. You can choose to put the Cassowary binary file in PATH so that you can run Cassowary on any page.

Cassowary can be installed on Nix OS.

Usage

Example: 10 users simultaneously send 100 visits to www.example.com.

$ ./cassowary run -u http://www.example.com -c 10 -n 100

Starting Load Test with 100 requests using 10 concurrent users

 100% |████████████████████████████████████████| [1s:0s]            1.256773616s


 TCP Connect.....................: Avg/mean=101.90ms  Median=102.00ms p(95)=105ms
 Server Processing...............: Avg/mean=100.18ms  Median=100.50ms p(95)=103ms
 Content Transfer................: Avg/mean=0.01ms  Median=0.00ms p(95)=0ms

Summary:
 Total Req.......................: 100
 Failed Req......................: 0
 DNS Lookup......................: 115.00ms
 Req/s...........................: 79.57

Example: Access the URL path specified in an external file (which can also be an HTTP path).

$ ./cassowary run -u http://localhost:8000 -c 10 -f urlpath.txt

Starting Load Test with 3925 requests using 10 concurrent users

 100% |████████████████████████████████████████| [0s:0s]            599.467161ms


 TCP Connect.....................: Avg/mean=1.80ms  Median=2.00ms p(95)=3ms
 Server Processing...............: Avg/mean=0.90ms  Median=0.00ms p(95)=3ms
 Content Transfer................: Avg/mean=0.00ms  Median=0.00ms p(95)=0ms

Summary:
 Total Req.......................: 3925
 Failed Req......................: 0
 DNS Lookup......................: 2.00ms
 Req/s...........................: 6547.48

Example: Exporting Cassowary’s Json algorithm

$ ./cassowary run --json-metrics --json-metrics-file=metrics.json -u http://localhost:8000 -c 125 -n 100000

Starting Load Test with 100000 requests using 125 concurrent users

If no export filename is specified for the Json algorithm, the system will use the default filename ‘out.json’.

Example: Specify a Prometheus Pushgateway URL and export Cassowary’s Json algorithm to Prometheus.

$ ./cassowary run -u http://localhost:8000 -c 125 -n 100000 -p http://pushgatway:9091

Starting Load Test with 100000 requests using 125 concurrent users

Example: Adding HTTP Header Fields

$ ./cassowary run -u http://localhost:8000 -c 10 -n 1000 -H 'Host: www.example.com'

Starting Load Test with 1000 requests using 10 concurrent users

Example: Disable http-keep-alive (http-keep-alive is enabled by default)

$ ./cassowary run -u http://localhost:8000 -c 10 -n 1000 --disable-keep-alive

Starting Load Test with 1000 requests using 10 concurrent users

Example: Specifying a Custom CA Certificate

$ ./cassowary run -u http://localhost:8000 -c 10 -n 1000 --ca /path/to/ca.pem

Starting Load Test with 1000 requests using 10 concurrent users

Example: Specify client certificate information

$ ./cassowary run -u http://localhost:8000 -c 10 -n 1000 --cert /path/to/client.pem --key /path/to/client-key.pem

Starting Load Test with 1000 requests using 10 concurrent users

Importing as a module or library

Cassowary can be imported and used in your Go program as a module. We begin by downloading the dependency using go mod:

go mod init test && go get github.com/rogerwelin/cassowary/pkg/client

Here is a simple example of how to run a load test and display the results.

package main

import (
        "encoding/json"
        "fmt"

        "github.com/rogerwelin/cassowary/pkg/client"
)

func main() {
    cass := &client.Cassowary{
        BaseURL:               "http://www.example.com",
        ConcurrencyLevel:      1,
        Requests:              10,
        DisableTerminalOutput: true,
    }
    metrics, err := cass.Coordinate()
    if err != nil {
        panic(err)
    }

        // print results
 fmt.Printf("%+v\n", metrics)

        // or print as json
 jsonMetrics, err := json.Marshal(metrics)
 if err != nil {
  panic(err)
 }

 fmt.Println(string(jsonMetrics))
}

Reference: https://github.com/rogerwelin/cassowary

Leave a message