4 ms·
Why can't you do these things in PHP (or whatever other language you're already using)?
by rubiquity 13y ago
Why can't you do these things in PHP (or whatever other language you're already using)?
- EGreg 13y agoYou can, but Node.js is often a better choice than PHP. Caching: you can have ONE node.js process listening to all requests, and it can keep the cached info in memory, to be looked up much more quickly. In PHP, you'd have to load the entire script environment, connect to an external source like Memcached or APC, etc. Waitlist: Similar to caching, except Node.js can hold off on responding to the request until the response came back. It's MUCH harder to make something like PHP iterate through the waitlist because a bunch of scripts might get called at once, and the way it works, all of them will have to sleep. With Node.js, only one process has to sleep -- or handles something else while you're waiting. etc.
- Touche 13y agoBecause that shouldn't be the responsibility of the business layer. Perhaps they are serving many apps other than just the web client, some of which don't want cached data.