Skip to content

Instantly share code, notes, and snippets.

@rebolyte
Last active May 10, 2016 21:37
Show Gist options
  • Save rebolyte/a69fa061435db8957f3555a07517fdaf to your computer and use it in GitHub Desktop.
Save rebolyte/a69fa061435db8957f3555a07517fdaf to your computer and use it in GitHub Desktop.
Moment Timezone perf test
/* jshint esversion:6, node: true */
let http = require('http');
let querystring = require('querystring');
let moment = require('moment-timezone');
const PORT = 8081;
let server = http.createServer(function (req, res) {
let qs = req.url.split('?');
if (qs.length > 1) {
qs = qs[1];
} else {
res.end('Need querystring');
return;
}
let q = querystring.parse(qs);
res.end(moment.tz(q.ts, q.zone.replace(/-/g, '/')).utcOffset().toString());
});
server.listen(PORT, function () {
console.log(`Listening on http://localhost:${PORT}`);
});
A 10-second test with an average of 100 requests per second:
Complete report @ 2016-05-10T21:20:36.579Z
Scenarios launched: 954
Scenarios completed: 954
Number of requests made: 954
RPS: 90.94
Request latency:
min: 0.6
max: 13.7
median: 0.8
p95: 1.5
p99: 3.6
Scenario duration:
min: 1.2
max: 29.8
median: 1.6
p95: 3
p99: 8.2
Codes:
200: 954
---
A 10-second test with an average of 500 requests per second:
$ artillery quick -d 10 -r 500 'http://localhost:8081/?ts=2016-01-02T10:25:36&zone=America-Denver'
Complete report @ 2016-05-10T21:23:11.596Z
Scenarios launched: 4242
Scenarios completed: 4082
Number of requests made: 4082
RPS: 402.85
Request latency:
min: 0.5
max: 15.2
median: 0.7
p95: 1.1
p99: 4
Scenario duration:
min: 1
max: 29.5
median: 1.3
p95: 2.3
p99: 9.5
Codes:
200: 4082
Errors:
ECONNRESET: 125
EMFILE: 35
---
A 30-second test with an average of 500 requests per second:
$ artillery quick -d 30 -r 500 'http://localhost:8081/?ts=2016-01-02T10:25:36&zone=America-Denver'
Complete report @ 2016-05-10T21:27:52.543Z
Scenarios launched: 11822
Scenarios completed: 4083
Number of requests made: 4083
RPS: 387.48
Request latency:
min: 0.5
max: 123.9
median: 1
p95: 5.7
p99: 15.3
Scenario duration:
min: 1.1
max: 128.1
median: 2
p95: 10
p99: 19.2
Codes:
200: 4083
---
A test that went for 30 seconds with an average of 1000 requests per second errored out on my computer with "EMFILE: too many open files"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment