k6 icon indicating copy to clipboard operation
k6 copied to clipboard

DNS TTL not Expiring

Open Salamandastron1 opened this issue 4 years ago • 2 comments

When running the k6 tool with

export let options = {
    dns: {
      ttl: '0',
      select: 'roundRobin',
      policy: 'any'
    },

The TTL value of '0' is not honored until after the first transaction expires at 30 seconds.

Screen Shot 2021-02-09 at 12 13 32 PM

Environment

  • k6 version:
    • v0.30.0
  • OS and version:
    • linux 5.0.0

Expected Behavior

The expected behavior is that the DNS TTL session should be reset on every call.

Actual Behavior

The initial TTL call caches the first IP returned and didn't expire until after 30 seconds. Then k6 starts behaving normally.

Steps to Reproduce the Problem

  1. Create a k6 script with the options object set to the below value
  export let options = {
    dns: {
      ttl: '0',
      select: 'roundRobin',
      policy: 'any'
    },
    vus: 10,
    duration: '30s',
  }
  1. Be sure to run this against this an Active-Active setup. This will properly show in metrics where only one site will receive the initial run of traffic.

Salamandastron1 avatar Feb 09 '21 17:02 Salamandastron1

Hi, thanks for reporting this.

Are you using HTTP keep-alive? As mentioned in the documentation k6 will keep a connection open if keep-alive is in use, so the only way to force any DNS resolver strategy is to disable it with the noConnectionReuse option.

Can you give that a try and let us know if the issue persists?

imiric avatar Feb 10 '21 09:02 imiric

This has been awaiting response from @Salamandastron1 for over a year. I would like to close it unless the user confirms that this isn't due to keep-alive connections

mstoykov avatar Apr 26 '22 13:04 mstoykov