Node 的 Web Workers 会破坏 erlang 吗?
我很好奇 Erlang 是否会被 Node.js 杀死,因为 Node.js 非常流行、速度很快并且拥有 网络工作人员 。是否可以?为什么?
但是多处理器呢 并发?线程不是必需的吗 将程序扩展到多核 电脑?流程是必要的 扩展到多核计算机,而不是 内存共享线程。这 可扩展系统的基础是 快速网络和非阻塞 设计——剩下的就是消息传递。在 未来的版本中,Node 将能够 派生新进程(使用 Web Workers API )非常适合 当前设计。
I'm curious if Erlang could be killed by Node.js which could be extreme popular, fast and have web workers. Is it possible? Why?
But what about multiple-processor
concurrency? Aren't threads necessary
to scale programs to multi-core
computers? Processes are necessary to
scale to multi-core computers, not
memory-sharing threads. The
fundamentals of scalable systems are
fast networking and non-blocking
design—the rest is message passing. In
future versions, Node will be able to
fork new processes (using the Web
Workers API ) which fits well into the
current design.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
Node.js 和 Erlang 是大草原上截然不同的野兽。
示例:
Node.js 以协作多任务模型为中心,让人想起 Python Twisted 或 Rubys EventMachine。相反,Erlang 是一个抢占式多任务系统,配有调度程序等。
Node.js 实现了 JavaScript,这是一种基于原型的 OO 语言,具有命令式基础和多种功能思想。 Erlang 本质上以通常的函数式风格实现了增强的 lambda 演算。
Node.js 主要以一台机器为中心,每个请求都按顺序处理。即将推出的 Web Worker 和
多节点
扩展让您可以使用机器的所有 CPU。 Erlang 旨在无缝集成多个节点,这些节点旨在让一组(多个)Erlang 物理机彼此无缝通信。Node.js 采用大多数语言中常见的主动故障缓解立场。另一方面,Erlang 采取反应式故障缓解立场:系统的构建是为了即使发生无法解释的错误也能生存。最坏的情况是让另一台物理机器接管。
Node.js 严重依赖 JIT 来获得速度。 Erlang 是一种更标准的编译语言。其后果是,Erlang 可能更适合软实时,因为一段代码的挂钟时间通常更可预测。
讨论:
您应该清楚,两种语言解决所提出问题的方法有很大不同。因此,出于这个原因,保留两者可能是值得的。换句话说,我不认为一种语言会完全取代另一种语言。 Node.js 具有熟悉度。 Erlang 在鲁棒性方面具有独特的优势。
免责声明:我破解了 Erlang。
Node.js and Erlang are quite different beasts on the savannah.
Examples:
Node.js is centered around a cooperative multitasking model, reminiscent of Python Twisted or Rubys EventMachine. Erlang, on the contrary, is a preemptively multitasked system complete with schedulers and so on.
Node.js implements JavaScript which is a prototype-based OO language with an imperative base and several functional ideas. Erlang implements, essentially, an augmented lambda-calculus in the usual functional style.
Node.js is centered mostly around a single machine, where each request is handled in order. The coming Web workers and the
multi-node
extension let you use all CPUs of the machine. Erlang is designed to seamlessly integrate multiple nodes, which are meant to be used to let a cluster of (more than one) Erlang physical machine be seamlessly communicating to each other.Node.js takes the usual stance of proactive fault-mitigation found in most languages. Erlang on the other hand takes a reactive fault-mitigation stance: the system is built to survive even if errors otherwise unaccounted for occur. In the worst case by letting another physical machine take over.
Node.js relies heavily on JIT to obtain speed. Erlang is a more standard compiled language. The ramifications is that Erlang may be better suited for soft-realtime as the wall-clock time of a piece of code is usually more predictable.
Discussion:
It should be clear to you that the approach to the proposed problem is vastly different from the two languages. Hence, it is probably worth keeping both around for this very reason. In other words, I don't think one language will completely replace the other. Node.js has a familiarity strength. Erlang has a distinct strength w.r.t. robustness.
disclaimer: I hack Erlang.
不太可能。
Node.js 确实有很多优点,但这些优点似乎都无法取代 Erlang。我希望 Node.js 能够取代 PHP :)
Not quite probable.
Node.js surely has a number of upsides, but none of these seem to be going to oust Erlang from its place. My hope that node.js will oust PHP instead :)
Node.js 是对“如何通过将事件循环连接到具有极少代码行的语言上来构建高效的并发系统”这一问题的答案。这个问题本身也很精彩。
Erlang 是对并发问题的更完整的答案,语言、编译器、库,一切都是从头开始围绕容错、分布和并发构建的。
Erlang 优点的完整列表?这是一个很长的清单,我没有那么多时间。一些示例:
Node.js 具有使用 JavaScript 的明显优势,因此在 Node.js 足够好的地方(在很多地方),它可能会在受欢迎程度方面击败 Erlang。
Node.js is an answer to the question "How do you build an efficient concurrent system by bolting an event loop onto a language with ridiculously few lines of code". And the question itself is kind of brilliant, too.
Erlang is a much more complete answer to the concurrency-problem, the language, the compiler, the libraries, everything is build around fault tolerance, distribution and concurrency from the ground up.
A full list of Erlang's advantages? That's a long list, I don't have that much time. A few samples:
Node.js has the distinct advantage of using JavaScript, so it will probably beat Erlang in terms of popularity wherever node.js is good enough, which is in a whole lot of places.