concurrency

command
v1.17.0 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: BSD-3-Clause Imports: 19 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package main shows one tls-client shared by many goroutines. A tls-client is safe for concurrent use, and sharing a single one is the point: it keeps one connection pool and one TLS session cache, which is both faster and a closer match to what a browser does than a client per goroutine.

Each worker decodes the response and then waits a couple of seconds, so the target sees a trickle of traffic rather than a load test.

For the same setup with a client per worker instead, see ./example/client_per_worker.

Run: go run ./example/concurrency

go run ./example/concurrency -goroutines 8 -requests 10
go run ./example/concurrency -memprofile heap.out

Inspect a heap profile with: go tool pprof heap.out

Jump to

Keyboard shortcuts

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