k6
k6 copied to clipboard
Support HTTP over UNIX Socket
Feature Description
It is possible to bind an HTTP server to a UNIX Socket rather than to a TCP socket. This provides better performance, better security (nothing is exposed by default).
Suggested Solution (optional)
Go's http.Client can be configured with an http.Transport to connect to UNIX sockets (and more).
k6 should provide a way to configure the HTTP transport, and document how to use it.
Already existing or connected issues / PRs (optional)
#1493 is about TCP sockets (aka: not HTTP), and is a different issue.
Interesting, I can see the utility, but can you explain what your use case for this is in more details? You want to test only the performance of your application locally, without any of the interference and overhead from the network?
From the implementation side, it will be somewhat tricky to implement correctly... :thinking: Here are some of the complexities I can think of right now:
- because it will require a custom HTTP
Transportand/orClientto dial the UNIX socket, it will probably need to wait for the new HTTP API in k6, since the current one has a global transport and client per VU :disappointed: - metrics like
http_req_connectingandhttp_req_tls_handshakingwon't make a lot of sense in this context, so they will either have to always be0or be omitted - we need to figure out the validation and/or security for this feature, because it makes sense only for local
k6 runtests - it probably has to be disabled (since it will always fail) fork6 cloudtests or maybe even for local distributed tests (e.g. with k6-operator or natively in the future) between multiple k6 instances... :thinking: