apache / apache/apisix

Question: Is it possible to change the DNS resolution timeout in the configuration file?

Open
#13,082 1 comment 0 reactions 0 assignees View on GitHub
question
Dominant language
Lua
Stars
17.1k
Forks
2.9k
Avg merge
3d 16h
Merged PRs (30d)
63

Description

### Description

For our system, we are using the DNS resolver provided by APISIX. To do this, we configured the following in the configuration file:

```
apisix:
node_listen:
- ip: X.X.X.X
port: 10080
enable_ipv6: false
dns_resolver:
- "x.x.x.x"
- "y.y.y.y"
dns_resolver_valid: 30
resolver_timeout: 1
```

With this configuration, we expected the DNS query timeout to be 1 second. However, it seems that regardless of the value we set, we still observe a DNS timeout of 2 seconds.

It appears that this setting configures the NGINX instance associated with the service, but the DNS resolution is performed earlier within APISIX itself.

While investigating the root cause, we found that the DNS resolution timeout seems to be hardcoded in the source code at the highlighted line (client.lua):

Image

After testing by changing that value (from 2000 to 1000) and running systemctl reload apisix, we observed that the DNS resolution timeout then becomes 1 second, which is what we expected.

Is there any way to configure this timeout without modifying the source code? If not, is there any plan to make these values configurable in the future?

### Environment

- APISIX version (run `apisix version`): 3.8.0
- Operating system (run `uname -a`): debian 11
- OpenResty / Nginx version (run `openresty -V` or `nginx -V`): openresty/1.21.4.2

Contributor guide

Open the contributing guide

Research direction

Start by reading the referenced client.lua timeout handling and the APISIX configuration around resolver_timeout, then compare those paths with the reported APISIX 3.8.0 behavior. Verify whether the configuration reaches the resolver used by APISIX itself; done means establishing the supported configuration behavior or defining the required configuration change and tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua, nginx
Domain
backend-api-design, networking
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.