4 ms·
Node-the-software-project is a feat of engineering. But the API, the client language, the ecosystem, and even the idea are bad, IMO. Bad API example: Tell me
by ragnese 5y ago
Node-the-software-project is a feat of engineering.
But the API, the client language, the ecosystem, and even the idea are bad, IMO.
Bad API example: Tell me how to deal with time zones in Node without pulling in a big third party library. Answer: You can't. So, a "scalable" backend platform can't handle datetimes from different time zones? Neat!
"Well, that's JavaScript's fault" you say. Node certainly has (a few) APIs that don't apply to the frontend, so why not add more of the important ones for backend work?
Or, maybe JavaScript really just doesn't belong on the backend at all...
Not to mention that it's single-threaded, so the answer to scaling up better is to just run more instances. -_-
See? I should've stayed quiet. ;)
- matheusmoreira 5y ago> Not to mention that it's single-threaded, so the answer to scaling up better is to just run more instances. Yeah, this sucks. It's impossible to do any actual processing in javascript since functions that don't return immediately will clog the event loop. Why can't we have javascript code that runs asynchronously and reports completion and results as events? Even browsers seem to have this now. I tracked issue #2133 on GitHub for a long time and nothing materialized. Not sure if Node.js still lacks this feature. If so then it means Node.js is nothing but an I/O scripting platform. You get events and you make the system copy data from some source to some destination in response. Any sort of actual processing means latency becomes unacceptably high.
- infensus 5y agoNode has worker threads, which are basically the equivalent of Web Workers from browsers, with similar message based API
- matheusmoreira 5y agoWow really? Since when/what version? I have to see it. How did they solve the serialization issue? If I remember correctly that was necessary to pass objects between threads.
- infensus 5y agoI think they became stable in v12. I'm actually not sure about the internal implementation, but from user's point of view you can pass almost [1] any value via a message and you will get a copy on the other side. You can even share memory between threads with SharedArrayBuffer. [1] https://nodejs.org/api/worker_threads.html#worker_threads_port_postmessage_value_transferlist https://nodejs.org/api/worker_threads.html#worker_threads_po...