DNS intermittent delays of 5s
This bug described a few different types of slow DNS queries,
in my use case the slow DNS requests occurred on alpine:3.7/3.8, due to
the timed out for additional AAAA query along with A query by default.
currently no need to query AAAA records by default, so the solution is
removing AAAA resolution from the implements
(musl/src/network/lookup_name.c, function ‘name_from_dns’), and the
code fix worked for me:
//musl/src/network/lookup_name.c, function ‘name_from_dns’
static const struct { int af; int rr; } afrr[2] = {
{ .af = AF_INET6, .rr = RR_A },
{ .af = AF_INET, .rr = RR_AAAA },
};
for (i=0; i<2; i) {
if (family != afrr[i].af) {
qlens[nq] = __res_mkquery(0, name, 1, afrr[i].rr,
0, 0, 0, qbuf[nq], sizeof *qbuf);
if (qlens[nq] == –1)
return EAI_NONAME;
nq;
}
//hack: if set the AF_UNSPEC family, just return ipv4 result
if (family == AF_UNSPEC) break;
}
(from redmine: issue id 10063, created on 2019-03-05)