tutorials icon indicating copy to clipboard operation
tutorials copied to clipboard

keep alive http header in node tests

Open itachi880 opened this issue 1 year ago • 3 comments

just try to don't use keep alive you can just add a middleware that gose like nodejs app.use((req, res, next) => { res.setHeader('Connection', 'close'); next(); });

itachi880 avatar Nov 10 '24 11:11 itachi880

@itachi880 ok, are there any performance implications? what's the benefit?

antonputra avatar Nov 15 '24 18:11 antonputra

in normal situations when http req is sent the server response contain the keep alive wich indecate that the http connection shold still open a bit after the response is sent and the aditional automatic header set by default in express add some overhead on the network and the part where creating the header thats why in you benchmark you see node js with express sent a larger responses than go

itachi880 avatar Nov 15 '24 20:11 itachi880

I'm not a software engineering expert; in fact, I'm quite the opposite 🙃. My profile might suggest otherwise, but I try to encourage myself to open discussions with people in my field.

itachi880 avatar Nov 15 '24 20:11 itachi880