3 ms·
It was that damn Apache that could not handle any load. Killed it and exposed Node.js directly instead of proxying through mod_proxy, should be fine now
by andris9 10y ago
It was that damn Apache that could not handle any load. Killed it and exposed Node.js directly instead of proxying through mod_proxy, should be fine now
- ddorian43 10y agoDoes nodejs protect against slow requests (probably not) ?
- andris9 10y agoSlow requests are not an issue as all connections are handled by the same process. If a connection gets idling or slow, then it does not take almost any resources (compared to apache where a separate process is spawned to handle that request)
- xorcist 10y ago> compared to apache where a separate process is spawned That's not how Apache works. If your glibc is >= 2.3.2 (we're talking 2004 or newer) the default mode is epoll ("event" MPM), otherwise you will get a threadpool ("worker" MPM), and failing that you will get a processpool ("prefork" MPM). It will never spawn a process to handle a request, unless you forcibly enable prefork mode with a pool size of 1.
- andris9 10y agoSure, I agree that my knowledge about Apache internals might be severely outdated. And I can't really blame Apache either because it's a very small box, in a larger one it might have quickly stabilized
- brazzledazzle 10y agoIn my experience this is due to an Apache default configuration that probably seemed reasonable when introduced but in practice can really screw you. Basically it caches and serves only the 503 for something like 3s to prevent the application it's proxying from getting kicked while it's down/flapping/starting. So the end result is that even if your app is only occasionally returning 503s for a small subset of users everyone gets to enjoy them for several seconds every time one is encountered. Fun stuff.
- andris9 10y agoIt's a really small box (512mb) that runs everyting and on a normal day it does not have any issues but when the requests from HN started coming in Apache used up all the RAM. I stopped Apache and started Mailtrain from command line in a screen session to listen directly on the web ports (so once it's out from the HN frontpage I can reboot the VPS and everything gets back to normal settings). So far it has been running smoothly with the server RAM usage in a constant 50%, no fluctuations https://cloudup.com/cokRbDpMIuw https://cloudup.com/cokRbDpMIuw
- brazzledazzle 10y agoYeah that's a pretty tight fit. Can't say I have much experience doing that all on one small box outside of local dev stuff.