Docker node.js-alpine 不缓存 DNS 结果

lib*_*bik -2 dns networking amazon-web-services node.js docker

我们尝试对我们的(dockerized 并部署到 AWS ECS)Node.js 应用程序进行负载测试,指标显示我们的容器中的 CPU 和内存非常好,但是 DNS 解析在更大的负载(每秒约 600 个请求,我们需要达到30000左右)

这是错误(我们正在使用 http-proxy 模块,但这应该超出它的范围):

// I have renamed the URL to xxx.com
"err": {
    "code": "EAI_AGAIN",
    "errno": "EAI_AGAIN",
    "syscall": "getaddrinfo",
    "hostname": "xxx.com",
    "host": "xxx.com",
    "port": 80,
    "statusCode": 500,
    "stack": "Error: getaddrinfo EAI_AGAIN xxx.com:80\n    at Object._errnoException (util.js:1024:11)\n    at errnoException (dns.js:55:15)\n    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:92:26)"
},
Run Code Online (Sandbox Code Playgroud)

我在想 DNS 会被操作系统自动缓存几分钟,但这并没有发生。

我们正在使用官方 Node.js docker 镜像 8.9.4-alpine

lib*_*bik 5

确认,切换到-slim版本解决了问题