3 ms·
I've had some similar experiences as we've scaled from internal only applications a couple years ago, to handling thousands of requests a second at peak. 1. Ev
by vkjv 12y ago
I've had some similar experiences as we've scaled from internal only applications a couple years ago, to handling thousands of requests a second at peak.
1. Event loop. Yep, always be careful not to block it. But, I think this is more of a tuning thing. If you're using Java, you figure out how many requests you can reasonably handle and make that your water mark. Do the same thing in node, if you take too many connections, start refusing them fast and not queuing them forever.
2. Exceptions. Honestly this has never been an issue. We've used Promises for async flow from the beginning. This means that there is nearly zero code that is not inside of a promise chain and hence inside of a try {} catch {}. We just don't have this problem and we don't crash.
3 / 4. Oddly enough, I found streams to be a solution to this problem and not a cause, if using back pressure properly. I highly recommend highland.js.