3 ms·
You're being too clever - if you run out of memory, throw away the request and all associated resources and return "500: Internal server error". There are lots
by JoachimSchipper 16y ago
You're being too clever - if you run out of memory, throw away the request and all associated resources and return "500: Internal server error". There are lots of reasons why this isn't perfect (if the OS overcommits memory, like Linux (typically?) does, it will have to kill you to avoid running out; if you need to use swap you're too slow to be useful; etc), but it's not impossible.
node.js (one process for many requests) is a different model than the author is considering; no matter its (dis)advantages, integrating it into the server is not nearly as advantageous as for a process-per-request model (like mod_php).
- otterley 16y agoFrom a service perspective, I'd prefer to have the process crash and supervisor restart it. Returning HTTP/500 errors on memory allocation failures (which usually last until the process is restarted anyway) is likely to deny service to a larger number of users.
- swolchok 16y agoOvercommit seems to have changed somewhat since the "early days," as it's now heuristic. I ran into this once when I couldn't malloc 8 GB on a 64-bit machine because RAM + swap was less than 8 GB. http://www.mjmwired.net/kernel/Documentation/vm/overcommit-accounting http://www.mjmwired.net/kernel/Documentation/vm/overcommit-a...