Skip to content

Commit

Permalink
Add support for HTTP/2, /3, update dependencies and CI (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
vearutop authored Apr 13, 2022
1 parent df5cd93 commit 3bd83c6
Show file tree
Hide file tree
Showing 10 changed files with 423 additions and 44 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ jobs:
name: golangci-lint
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v3
with:
go-version: 1.18.x
- uses: actions/checkout@v2
- name: golangci-lint
uses: golangci/[email protected]
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-assets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
steps:
- name: Install Go stable
if: env.GO_VERSION != 'tip'
uses: actions/setup-go@v2
uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}
- name: Install Go tip
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#GOLANGCI_LINT_VERSION := "v1.45.0" # Optional configuration to pinpoint golangci-lint version.
#GOLANGCI_LINT_VERSION := "v1.45.2" # Optional configuration to pinpoint golangci-lint version.

# The head of Makefile determines location of dev-go to include standard targets.
GO ?= go
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ You can "copy as cURL" in your browser and then prepend that with `plt` to throw
For even better performance you can use `plt curl --fast` that will employ awesome [fasthttp](https://github.com/valyala/fasthttp)
as transport. This mode lacks detailed breakdown of latencies, but can push request rate to the limit.

Use `--http2` or `--http3` for HTTP/2 or HTTP/3.

If the server is wrapped with Envoy proxy, upstream latency distribution will be collected from the values of [`X-Envoy-Upstream-Service-Time`](https://www.envoyproxy.io/docs/envoy/latest/configuration/http/http_filters/router_filter#x-envoy-upstream-service-time) response header.

In `--live-ui` mode you can control concurrency and rate limits with arrow keys.
Expand Down
2 changes: 2 additions & 0 deletions curl/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ func AddCommand(lf *loadgen.Flags) {
captureBool = map[string]*bool{
"compressed": &capture.compressed,
"no-keepalive": &flags.NoKeepalive,
"http2": &flags.HTTP2,
}
ignoredString = map[string]*string{}
ignoredBool = map[string]*bool{}
Expand All @@ -49,6 +50,7 @@ func AddCommand(lf *loadgen.Flags) {
curl := kingpin.Command("curl", "Repetitive HTTP transfer")

curl.Flag("fast", "Use fasthttp to achieve higher request rate").BoolVar(&flags.Fast)
curl.Flag("http3", "Use quic-go http3").BoolVar(&flags.HTTP3)
curl.Flag("2.0", `Workaround of Firefox "Copy as cURL" incompatibility.`).Bool()
curl.Arg("url", "The URL.").StringVar(&flags.URL)

Expand Down
13 changes: 9 additions & 4 deletions fasthttp/job.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,9 @@ func NewJobProducer(f nethttp.Flags) *JobProducer {

// Print reports results.
func (j *JobProducer) Print() {
fmt.Println()

fmt.Println("Responses by status code")
j.mu.Lock()
defer j.mu.Unlock()

codes := ""
resps := ""

Expand All @@ -146,7 +145,13 @@ func (j *JobProducer) Print() {
resps += fmt.Sprintf("[%d]\n%s\n", code, string(j.respBody[code]))
}

j.mu.Unlock()
if codes == "" {
return
}

fmt.Println(codes)

fmt.Println("Responses by status code")
fmt.Println(codes)

fmt.Println("Bytes read", report.ByteSize(atomic.LoadInt64(&j.bytesRead)))
Expand Down
23 changes: 20 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,39 @@ go 1.17

require (
github.com/alecthomas/kingpin v2.2.6+incompatible
github.com/bool64/dev v0.2.9
github.com/bool64/dev v0.2.10
github.com/gizak/termui/v3 v3.1.0
github.com/lucas-clemente/quic-go v0.27.0
github.com/nsf/termbox-go v1.1.1
github.com/valyala/fasthttp v1.34.0
github.com/valyala/fasthttp v1.35.0
github.com/vearutop/dynhist-go v1.0.0
golang.org/x/net v0.0.0-20220412020605-290c469a71a5
golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e
)

require (
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 // indirect
github.com/alecthomas/units v0.0.0-20210208195552-ff826a37aa15 // indirect
github.com/andybalholm/brotli v1.0.4 // indirect
github.com/cheekybits/genny v1.0.0 // indirect
github.com/fsnotify/fsnotify v1.5.1 // indirect
github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0 // indirect
github.com/klauspost/compress v1.15.1 // indirect
github.com/marten-seemann/qpack v0.2.1 // indirect
github.com/marten-seemann/qtls-go1-16 v0.1.5 // indirect
github.com/marten-seemann/qtls-go1-17 v0.1.1 // indirect
github.com/marten-seemann/qtls-go1-18 v0.1.1 // indirect
github.com/mattn/go-runewidth v0.0.13 // indirect
github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7 // indirect
github.com/nxadm/tail v1.4.8 // indirect
github.com/onsi/ginkgo v1.16.5 // indirect
github.com/rivo/uniseg v0.2.0 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4 // indirect
golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3 // indirect
golang.org/x/sys v0.0.0-20220412211240-33da011f77ad // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/tools v0.1.10 // indirect
golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f // indirect
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
)
Loading

0 comments on commit 3bd83c6

Please sign in to comment.