Created
July 19, 2022 15:37
-
-
Save galkin/7ee5af256f1c095bd508b06a206ef772 to your computer and use it in GitHub Desktop.
Example for demonstration request count limit with big event loop deleay
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
➜ ~ ab -c 20 -n 1000 http://localhost:3000/ ([email protected]:formelife-develop)(gke_formelife-develop_us-central1_cluster-develop/default) | |
This is ApacheBench, Version 2.3 <$Revision: 1879490 $> | |
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ | |
Licensed to The Apache Software Foundation, http://www.apache.org/ | |
Benchmarking localhost (be patient) | |
Completed 100 requests | |
Completed 200 requests | |
Completed 300 requests | |
Completed 400 requests | |
Completed 500 requests | |
Completed 600 requests | |
Completed 700 requests | |
Completed 800 requests | |
Completed 900 requests | |
Completed 1000 requests | |
Finished 1000 requests | |
Server Software: | |
Server Hostname: localhost | |
Server Port: 3000 | |
Document Path: / | |
Document Length: 2 bytes | |
Concurrency Level: 20 | |
Time taken for tests: 100.055 seconds | |
Complete requests: 1000 | |
Failed requests: 0 | |
Total transferred: 77000 bytes | |
HTML transferred: 2000 bytes | |
Requests per second: 9.99 [#/sec] (mean) | |
Time per request: 2001.099 [ms] (mean) | |
Time per request: 100.055 [ms] (mean, across all concurrent requests) | |
Transfer rate: 0.75 [Kbytes/sec] received | |
Connection Times (ms) | |
min mean[+/-sd] median max | |
Connect: 0 1 0.5 2 2 | |
Processing: 101 1994 85.8 1999 2003 | |
Waiting: 100 1138 569.8 1099 2002 | |
Total: 101 1995 85.8 2001 2004 | |
ERROR: The median and mean for the initial connection time are more than twice the standard | |
deviation apart. These results are NOT reliable. | |
Percentage of the requests served within a certain time (ms) | |
50% 2001 | |
66% 2001 | |
75% 2001 | |
80% 2001 | |
90% 2002 | |
95% 2002 | |
98% 2003 | |
99% 2004 | |
100% 2004 (longest request) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const http = require('http'); | |
const { monitorEventLoopDelay } = require('perf_hooks'); | |
const h = monitorEventLoopDelay({ resolution: 10 }); | |
h.enable(); | |
http.createServer(async (req, res) => { | |
blockFor100ms(); | |
res.end('OK'); | |
}).listen(3000) | |
function blockFor100ms () { | |
let counter = 0 | |
while (counter++ < 10) { | |
const start = Date.now() | |
let i = 0 | |
while (Date.now() - start < 10) { | |
i++ | |
} | |
} | |
} | |
setInterval(() => console.log(h.mean / 1_000_000), 1_000); | |
setInterval(() => h.reset(), 60_000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment