5 ms·
Using the cluster module for nodejs will make it almost the fastest and when we add activities like reading from a database nodejs asynchronous pattern beats ev
by zealsham 10y ago
Using the cluster module for nodejs will make it almost the fastest and when we add activities like reading from a database nodejs asynchronous pattern beats everybody
- socmag 10y agoahem, apart from C++
- tehlike 10y agoCitation needed. Not that i object to the fact that c++ is usually faster :)
- tracker1 10y agoC/C++/Rust and other low-level languages should be able to perform faster than a Node implementation... Although a less-simple example would mitigate a lot of those differences, as many interfaces would need to interact with other systems, and with any kind of redundancy (multiple servers) coordination becomes an issue as well. In the end, if you're within 10% is probably moot, and at 39% on a single instance for node, that's very impressive and once you add multiple system, multiple instances per system aren't any harder and node would probably make up most of the difference.
- socmag 10y agoThat was the citation :-) Seriously though, Node is written in C++ and is a single threaded interpreted / Jitted / Garbage Collected Virtual Machine which has to jump through trampolines and layers of abstraction to call system services. While it might be very efficient at what it does, it isn't as close to the machine as a native C++ application. One asynchronous WebSocket server written in C++ can run rings around one Node WebSocket server. If the premise is that to mitigate this we can set up an entire cluster of node servers that will beat the C++ server, it follows that we can set up an entire cluster of C++ servers that would be even faster. C++ is faster in every regard. There is no "usually", about it. If we are talking about some metric like programmer productivity, sure sometimes it takes more effort to write code in C++ to achieve what may take a single line in Node.
- tehlike 10y agoOk let me rephrase: The speed benefit of C++ not always matters. At Google scale, sure. For most intents and purposes, probably not. Otherwise, totally agreed.
- socmag 10y agoI use node quite a lot, mostly for prototyping, demos and where I just plain don't have the time or need to use something else. I have no problem with node as an application development platform. Right tool for the right job is fine The trick is to minimize aggregate kWh of energy use per unit task. Sometimes that means ordering a take out, and occasionally baking a pie. A lot of the time I'm in the position of buildng upstream tools and platforms for people downstream, so whatever I do has a direct impact on their performance. The way I look at it is it is my duty to make them look good. I do take that a little far though on occasion. Shipping is a feature too of course. Heh.
- tehlike 10y agoIt is just more natural too since all of io is inherently async.
- brightball 10y agoNot likely. Node will have to send out to an external source to pass messages between the cores of the cluster. Go and Elixir would do that fairly naturally without the external latency. Elixir and Phoenix would do the same over multiple machines with multiple cores without the need for a database or Redis to handle routing. Both also make it pretty natural to async everything. If Node beat either in a distributed benchmark it would be a shock to all involved.