Hi - there is an article on k6’s website about fine tuning the OS to ensure k6 does not overload the host machine.
Does anyone know whether this automatically applies to the docker container when running k6 from within a container?
We’re seeing a lot of dial timeout i/o (1% randomly whilst the test runs). We’ve applied the OS tuning guide to the host EC2 instance, but are wondering whether Docker is further limiting those, or whether we should extend the k6 docker image, and apply the OS tuning settings and build a new container?
Or possibly Docker containers inherit those settings already, or was built into the k6 image.
Many Thanks for any advice in advance
welcome to the community forum
You should find details on how Docker applies limits in Docker run reference | Docker Docs page from the Docker documentation.
We’re seeing a lot of dial timeout i/o (1% randomly whilst the test runs). We’ve applied the OS tuning guide to the host EC2 instance
Why do you think this is related to OS tuning? Does this issue disappear if you run k6 directly on the host and not in a container?
Did you check that the SUT was able to establish the connection and returned responses in time?
Hi @codebien thank you for your response.
I’ve not got to the bottom of it yet, but yes - the dial timeouts did disappear when we ran the k6 binary on the host instead of inside a docker container. I haven’t seen anything in the docker reference that specifies whether network connections outbound are limited, but wasn’t sure what the recommended approach from k6 was (e.g. running inside or outside of a container).
The only reason we do run inside a container is to run from our CI/CD pipeline.
but wasn’t sure what the recommended approach from k6 was (e.g. running inside or outside of a container).
There isn’t a recommended approach, they both have pros and cons, and you need to balance your use case. Docker shouldn’t be a reason to see the limit, it should be mainly related to the setup. The entire concept of Docker is adding isolation so it adds a layer on top to manage, for this reason, you probably shouldn’t expect to get the same set of values you’ve set for the host.
You could try to run with
--net=host flag to see if the main impact is mainly related to the networking configuration.
Can you share which options you’ve changed on the host at the moment, please?
Thanks @codebien - at the moment it’s just the ones from the OS tuning guide. But I think I have to pass the same parameters to the docker container as part of the run command which I didn’t realise. Trying it now
docker run --sysctl net.ipv4.ip_local_port_range="15000 61000" k6 run ...