When I make a request to IP Address and Port combination the timings.phases.dns logs around 300ms
wait: 2, dns: 342, tcp: 0, tls: undefined, req: 1, fb: 341, download: 5, total: 691
...
wait: 2, dns: 0, tcp: 0, tls: undefined, req: 1, fb: 341, download: 5, total: 349
timings.phases.dns should be 0 for request mad eon IP addresses as there is no DNS Lookup involved
...
This is my server code
########HTTPRequestV2.js###########
var wrappedgot = null;
var customGot = null;
function HTTPRequestV2(hostURL, defaultOptions) {
this.hostUrl = hostURL;
}
HTTPRequestV2.prototype.init = async function(){
wrappedgot = (await import('got')).default;
const CacheableLookup = (await import('cacheable-lookup')).default;
const cacheable = new CacheableLookup({lookup: false});
customGot = wrappedgot.extend({
dnsCache : cacheable
})
};
HTTPRequestV2.prototype.makeRequest = async function(){
const res = await customGot('http://10.21.64.91:8085/api/v5/at?terms=aged&categories=aged&relevance=100&match_type=exact&limit=-1',
{timeout: {
lookup: 100,
connect: 500,
secureConnect: 50,
socket: 1000,
send: 10,
response: 1000
},dnsLookupIpVersion:4});
console.log("wait: " + res.timings.phases.wait
+ ", dns: " + res.timings.phases.dns
+ ", tcp: " + res.timings.phases.tcp
+ ", tls: " + res.timings.phases.tls
+ ", req: " + res.timings.phases.request
+ ", fb: " + res.timings.phases.firstByte
+ ", download: " + res.timings.phases.download
+ ", total: " + res.timings.phases.total);
// console.log(res.json());
};
module.exports = HTTPRequestV2;
################################
########test.js########
const http = require('http');
const HTTPRequestV2 = require('./HTTPRequestV2')
const hostname = '127.0.0.1';
const port = 3000;
let hTTPRequestV2 = new HTTPRequestV2();
hTTPRequestV2.init();
const server = http.createServer((req, res) => {
res.statusCode = 200;
res.setHeader('Content-Type', 'text/plain');
hTTPRequestV2.makeRequest();
res.end('Hello World');
});
server.listen(port, hostname, () => {
console.log(`Server running at http://${hostname}:${port}/`);
});
########################################
...
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too