K6 default DNS ttl set to 5 mins

Hi Team,
We have been using the k6 OSS and have been advised by one of our gateway vendors to set the DNS ttl to 0 in order to address some 502 errors we were seeing when executing load tests.
Can someone please help understand what is the significance of setting this value to 5 mins as default and should we really update this ?

Thanks,
Sumanta

Hey @sumantaroy,
sorry for the late reply, as the documentation mentions setting 0 as ttl means no caching mechanism is applied.

The end goal of k6 is to test the SUT and not whatever there is in between. Having some caching allows k6 to maximize the throughput. It is true that on the other side, this approach has some limits.

You can read an extensive discussion about it in the original issue Unexpected DNS caching · Issue #726 · grafana/k6 · GitHub.
If you have specific suggestions or requests the k6 repository has open discussions about the topic, you may consider contributing there. A concrete mention as an example is New DNS resolver · Issue #1751 · grafana/k6 · GitHub.

Let me know if it helps.

1 Like