Last week I discovered a significant performance regression in the HTTP server (https://github.com/nodejs/node/issues/37937
) while I was preparing for the previous edition of this newsletter - I wanted to speak how fast Node.js v16 would be… and it was significantly slower!
dropped the number req/s from 80k to 76k; I co-wrote this feature and we benchmarked it extensively, I’m really surprised we missed it! I plan to work on fixing this in the future as it’s going to be extremely hard because it was introduced following a security report.
, made debuglog safer to use - however it dropped our req/s from 72k to 67k. Turns out there was not a problem with this commit at all, but it was rather a problem with how debuglog was cached with Micheal fixed in https://github.com/nodejs/node/pull/37966
“http: align with stream.Writable” e2f5bb7
brought us down from 67k to 60k, which I reverted at #37963
. I have been extremely sorry for this, as I was excited it finally happened.
Fixing the problems introduced by “SafeIterator” and “align with stream.Writable” did not bring back the full throughput - so I dig deeper and I found that “perf_hooks: complete overhaul of the implementation” f3eb224
added two process.hrtime() calls to ServerResponse.
During this investigation I also found that https://github.com/nodejs/node/pull/37964
introduced a severe Denial of Service attack where a few closures were leaked in every request. Luckily, this did not ship into a release.