axios-cached-dns-resolve
Advanced tools
Comparing version 1.0.0 to 1.0.1
{ | ||
"name": "axios-cached-dns-resolve", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Caches dns resolutions made with async dns.resolve instead of default sync dns.lookup, refreshes in background", | ||
@@ -5,0 +5,0 @@ "scripts": { |
# axios-cached-dns-resolve | ||
Axios uses node.js dns.resolve to resolve host names. | ||
dns.resolve is synchronous and executes on limited libuv thread pool. | ||
Axios uses node.js dns.lookup to resolve host names. | ||
dns.lookup is synchronous and executes on limited libuv thread pool. | ||
Every axios request will resolve the dns name in kubernetes, openshift, and cloud environments that intentionally set TTL low or to 0 for quick dynamic updates. | ||
The dns resolvers can be overwhelmed with the load. | ||
There is/was a bug in DNS resolver that manifests as very long dns.lookups in node.js. | ||
There is/was a bug in DNS resolutions that manifests as very long dns.lookups in node.js. | ||
@@ -26,2 +26,3 @@ From the kubernetes [documentation](https://kubernetes.io/docs/concepts/services-networking/service/#why-not-use-round-robin-dns) | ||
* Constant DNS load/latency vs random load/variable latency | ||
* Providing statistics and introspection | ||
@@ -45,7 +46,8 @@ ## Requirements | ||
axiosCachingDns.registerInterceptor(axiosClient) | ||
registerInterceptor(axiosClient) | ||
Use axiosClient as normal | ||
``` | ||
Use axiosClient as normal | ||
## Configuration | ||
@@ -79,11 +81,25 @@ | ||
const stats = { | ||
dnsEntries: 0, | ||
refreshed: 0, | ||
hits: 0, | ||
misses: 0, | ||
idleExpired: 0, | ||
errors: 0, | ||
lastError: 0, | ||
lastErrorTs: 0, | ||
"dnsEntries": 4, | ||
"refreshed": 375679, | ||
"hits": 128689, | ||
"misses": 393, | ||
"idleExpired": 279, | ||
"errors": 0, | ||
"lastError": 0, | ||
"lastErrorTs": 0 | ||
} | ||
const cacheEntries = [ | ||
{ | ||
"host": "foo-service.domain.com", | ||
"ips": [ | ||
"51.210.235.165", | ||
"181.73.135.40" | ||
], | ||
"nextIdx": 1, | ||
"lastUsedTs": 1604151366910, | ||
"updatedTs": 1604152691039 | ||
}, | ||
... | ||
] | ||
``` |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
17255
103
4