Skip to content

Add option to disable keep-alive connections and repurpose NoConnectionReuse option #623

@robingustafsson

Description

@robingustafsson

Currently k6 will always try to use keep-alive connections, and by default it will reuse connections across iterations (unless told not to using k6 run --no-connection-reuse ... or the in-script noConnectionReuse: true|false option).

We should make it configurable whether to use keep-alive connections or not by making an option out of Go's Transport.DisableKeepAlives option [1][2].

After some internal discussion I'd also like to suggest we change the meaning of --no-connection-reuse/noConnectionReuse to mean whether keep-alive connections are used or not, and then introduce a new option to control what --no-connection-reuse/noConnectionReuse controls today, whether connections should be reused across VU iterations: --no-vu-connection-reuse/noVUConnectionReuse. In summary:

To control keep-alive:
k6 run --no-connection-reuse or in-script option noConnectionReuse: true|false

To control connection reuse across VU iterations:
k6 run --no-vu-connection-reuse or in-script option noVUConnectionReuse: true|false

[1] - https://golang.org/pkg/net/http/#Transport
[2] - https://github.com/loadimpact/k6/blob/master/js/runner.go#L156

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions