antonputra / tutorials

DevOps Tutorials
https://youtube.com/antonputra
MIT License
3.18k stars 2.49k forks source link

keep alive http header in node tests #348

Open itachi880 opened 1 week ago

itachi880 commented 1 week ago

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(); });

antonputra commented 4 days ago

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

itachi880 commented 4 days ago

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 commented 4 days ago

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.