Skip to content

Commit 8a8d6b1

Browse files
committed
Add wait between requests
1 parent 03848bf commit 8a8d6b1

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Tool to test how many dns loopups are slower than 100 ms
22

3-
You can specify the `DNS_NAME` and `DNS_NAME_TIMEOUT` environment variables.
3+
You can specify the `DNS_NAME`, `DNS_NAME_TIMEOUT` and `WAIT_BETWEEN_REQUESTS` environment variables.
44

55
Start with:
66

index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ const dnsLoopupAsync = util.promisify(dns.lookup);
1010

1111
const dnsName = process.env.DNS_NAME || 'kubernetes.default.svc.cluster.local';
1212
const dnsTimeout = parseInt(process.env.DNS_NAME_TIMEOUT, 10) || 100;
13+
const waitBetweenRequests = parseInt(process.env.WAIT_BETWEEN_REQUESTS, 10) || 100;
1314

1415
(async () => {
1516
const timeout = new Timeout();
@@ -37,7 +38,7 @@ const dnsTimeout = parseInt(process.env.DNS_NAME_TIMEOUT, 10) || 100;
3738
timeout.clear();
3839
}
3940

40-
await sleep(10);
41+
await sleep(waitBetweenRequests);
4142

4243
if (lookups % 100 == 0) {
4344
const time = Math.round((+new Date() - startDate) / 1000);

kubernetes/deployment.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,6 @@ spec:
1212
- name: DNS_NAME
1313
value: 'kubernetes.default.svc.cluster.local'
1414
- name: DNS_NAME_TIMEOUT
15-
value: '100'
15+
value: '300'
16+
- name: WAIT_BETWEEN_REQUESTS
17+
value: '50'

0 commit comments

Comments
 (0)