TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Ask HN: What equivalents of Erlang/OTP exist for other languages?

81 点作者 proveanegative将近 10 年前

24 条评论

rvirding将近 10 年前
I know I missed this but I do want to make some (general) comments:<p>- Erlang, the language and system, was designed for highly concurrent and fault tolerant systems. In many ways these were more important than raw throughput in that if it could not handle the massive concurrency and build truly fault-tolerant systems then it wasn&#x27;t interesting. At all.<p>- Same with pre-emptive scheduling, the system had to be non-blocking. Again if it wasn&#x27;t then it wasn&#x27;t interesting. Yes, you can provide primitives to allow the programmers to do it but this does make things difficult and not-reliable.<p>- The language design was focussed on these types of systems and and implementing the types of architectures which OTP supports.<p>- From Erlang&#x27;s point of view using OS threads as a base for Erlang processes is not an option. They are way too heavy and you can&#x27;t have enough of them to be interesting. 10k processes are child&#x27;s play, 100k processes is starting to get interesting and 1M process production systems exist, for example WhatsApp.<p>- For Erlang processes are the basic building blocks in a similar way to objects in an OO language. What would a Java programmer say if they were told that they couldn&#x27;t have more than 1000 objects?<p>- Having the erlang VM handle using all the cores, or as many as you want, by default is just the natural way to do things. If I had to do any form of restructuring of my system because I was running on 4, 8, 16 or 32 cores I would consider that to be intolerable and so primitive I would wonder what the implementors were thinking of.<p>- While the Erlang syntax is different (which functional language doesn&#x27;t have a different syntax?) it is actually very concise and consistent, this by design. The elixir syntax is &quot;Ruby influenced&quot; and more complex and feature filled. Which you prefer is up to you.<p>- I am very fond of lisp so there is at least one native implementation of lisp on the Erlang VM, LFE (Lisp Flavoured Erlang), <a href="http:&#x2F;&#x2F;lfe.io&#x2F;" rel="nofollow">http:&#x2F;&#x2F;lfe.io&#x2F;</a> and <a href="https:&#x2F;&#x2F;github.com&#x2F;rvirding&#x2F;lfe" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;rvirding&#x2F;lfe</a>.<p>- There is nothing which you can do in one which you can&#x27;t do in the others, after all they run on the same VM and you can easily combine them and use them together.<p>That&#x27;s about all for the moment,<p>Robert
MCRed将近 10 年前
The real question is: Why don&#x27;t you just use Erlang or Elixir?<p>Can you find the magic sauce in another language?<p>I believe the honest answer is no. You can&#x27;t do it in Java because the JVM doesn&#x27;t support it. You can&#x27;t really build this on top of something that was not designed with parallelism and concurrency in mind, and designed correctly. For that reason Go doesn&#x27;t do it either. Scripting languages aren&#x27;t even thinking about it and to do it in something like C or C++ you&#x27;d basically be recreating a poorly implemented half working version of erlang.<p>So more interesting is--- why do people have this aversion to Erlang and Elixir?<p>It doesn&#x27;t take but a couple weeks to get used to erlang programming, and Elixir is even faster I think.<p>For the record I&#x27;ve been taking interns thru Programming Elixir in about 2 weeks and getting them to where they can program in the language (just at that point now with a new group so we&#x27;ll see how much they struggle... but I&#x27;ve already seen code written by them.)<p>Erlang did it right and has put in several decades of effort getting it even more right. Other languages, like Go, aren&#x27;t even trying (though of course advertising &quot;concurrency&quot; is very popular, none of them really do it.)<p>All these people choosing things like node.js or go for problems where erlang is the correct solution make me think that too many of the people in our industry aren&#x27;t really engineers, but more scripters following the herd.<p>And engineer knows why erlang is the correct solution for distributed systems.
评论 #9908661 未加载
评论 #9908813 未加载
flippant将近 10 年前
JVM: Quasar <a href="http:&#x2F;&#x2F;www.paralleluniverse.co&#x2F;quasar&#x2F;" rel="nofollow">http:&#x2F;&#x2F;www.paralleluniverse.co&#x2F;quasar&#x2F;</a><p>Scala&#x2F;Java: Akka <a href="http:&#x2F;&#x2F;akka.io" rel="nofollow">http:&#x2F;&#x2F;akka.io</a><p>Haskell: Cloud Haskell <a href="http:&#x2F;&#x2F;haskell-distributed.github.io&#x2F;" rel="nofollow">http:&#x2F;&#x2F;haskell-distributed.github.io&#x2F;</a>
评论 #9908203 未加载
pixelmonkey将近 10 年前
Apache Storm[1] isn&#x27;t exactly like Erlang&#x2F;OTP, but it definitely aims to achieve similar goals. Though Storm is written in Java and Clojure, the infrastructure it provides is usable across languages thanks to something it calls the &quot;multi-lang protocol&quot;.<p>I work on a Storm library for Python that&#x27;s called streamparse[2], and the goal of the project is to allow us to easily achieve Erlang OTP-style reliable processing atop open source infrastructure while still writing pure Python code.<p>I also gave a PyCon talk about streamparse which you can find on YouTube[3]. It describes the motivation for the project -- which is to solve a large-scale real-time analytics problem with Python and do so in a reliable way, while beating Python&#x27;s multi-core limitations (the GIL, etc.)<p>[1]: <a href="https:&#x2F;&#x2F;storm.apache.org&#x2F;" rel="nofollow">https:&#x2F;&#x2F;storm.apache.org&#x2F;</a><p>[2]: <a href="https:&#x2F;&#x2F;github.com&#x2F;Parsely&#x2F;streamparse" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;Parsely&#x2F;streamparse</a><p>[3]: <a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=ja4Qj9-l6WQ" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=ja4Qj9-l6WQ</a>
评论 #9908370 未加载
评论 #9908515 未加载
评论 #9908492 未加载
markonthewall将近 10 年前
I suggest you take a look at Elixir, it&#x27;s an incredibly well designed and powerful languages. FWIW, I am pretty sure that it will take off exponentially in the coming years... the support for concurrency is <i>amazing</i>, and it also allows for simpler software to be developed easily.<p>Definitely worth taking a look at it.
评论 #9908225 未加载
jeffdavis将近 10 年前
My claim is that Erlang&#x2F;OTP is a cluster OS, not a language. It supports two languages: Erlang and Elixir.
评论 #9908856 未加载
评论 #9910325 未加载
评论 #9909405 未加载
davidw将近 10 年前
Erlang was designed from the ground up to do what it does, so it&#x27;s... not easy to replicate that in other systems.
评论 #9908880 未加载
评论 #9908347 未加载
decentrality将近 10 年前
Celluloid: <a href="http:&#x2F;&#x2F;celluloid.io" rel="nofollow">http:&#x2F;&#x2F;celluloid.io</a>
评论 #9908939 未加载
giancarlostoro将近 10 年前
I&#x27;m not an expert in comparing these but there&#x27;s also:<p>Orbit for the JVM &#x2F; Scala by EA (BioWare actually)<p><a href="https:&#x2F;&#x2F;github.com&#x2F;electronicarts&#x2F;orbit" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;electronicarts&#x2F;orbit</a><p>Then there&#x27;s Orleans by Microsoft for .NET:<p><a href="https:&#x2F;&#x2F;github.com&#x2F;dotnet&#x2F;orleans" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;dotnet&#x2F;orleans</a><p>They feature a concept called Virtual Actors as opposed to other frameworks like Akka for the JVM.
评论 #9908516 未加载
egonelbre将近 10 年前
Something like Erlang&#x2F;OTP not really... Although here are some bits&#x2F;pieces I&#x27;ve seen in Go community:<p>* Project Iris <a href="http:&#x2F;&#x2F;iris.karalabe.com&#x2F;" rel="nofollow">http:&#x2F;&#x2F;iris.karalabe.com&#x2F;</a> * Go Circuit <a href="https:&#x2F;&#x2F;github.com&#x2F;gocircuit&#x2F;circuit" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;gocircuit&#x2F;circuit</a> * NSQ <a href="http:&#x2F;&#x2F;nsq.io&#x2F;" rel="nofollow">http:&#x2F;&#x2F;nsq.io&#x2F;</a> * Consul <a href="https:&#x2F;&#x2F;www.consul.io&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.consul.io&#x2F;</a> * SkyNet <a href="https:&#x2F;&#x2F;github.com&#x2F;skynetservices&#x2F;skynet" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;skynetservices&#x2F;skynet</a> * Grace <a href="https:&#x2F;&#x2F;github.com&#x2F;facebookgo&#x2F;grace" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;facebookgo&#x2F;grace</a><p>Each having their pros&#x2F;cons with varying quality.<p>Replicating Erlang processes -&gt; usually you use goroutines. When that level fails you fail the whole process and restart it using some supervisor. You may need computer level failover as well, depending on the requirements.<p>For the servers&#x2F;protocols part of OTP, the stdlib is usually sufficient to get things running; although may need some additions for rarer encodings.<p>For machine level deployment there are cluster managers i.e. kubernetes, aws, google cloud etc.<p>Regarding debugging&#x2F;monitoring I haven&#x27;t seen anything that is close to Erlang.<p>Basically, I have no idea what you are doing and cannot recommend anything particular. For the full feature set there is no single replacement. If you need OTP then use OTP.
babo将近 10 年前
There are similar attempts but OTP is a unique and very powerful approach, the deep integration between the language, core libraries and the framework is hard to match. Why not stick with it? Elixir is fresh and nice, but even Erlang is easy to grab.
评论 #9908497 未加载
anonyfox将近 10 年前
Elixir&#x2F;OTP. :)
rubyn00bie将近 10 年前
Ah. Yes... This is mostly how I began my long awkward journey from the JVM, Ruby, Node, et. al to Elixir. Let me give you the one tip that&#x27;ll make this way easier:<p>Use the right tool for the job. Not the one you like best. Just because you can use the blunt end of a drill to hit a nail, doesn&#x27;t mean you should give up hammers... You might even break your drill!<p>If your problem&#x27;s solution requires extremely concurrent, high availability, low latency, throughput then you must use BeamVM. The JVM will be too slow and largely memory inefficient compared to Beam.<p>If concurrency isn&#x27;t needed, or isnt applicable (parallel, or synchronous, problems), then it&#x27;s not the answer nor is OTP. E.g. I wouldn&#x27;t dream of writing and image processor in Elixir-- Beam isn&#x27;t the right tool to solve that problem.<p>Also, checkout dialzyer if you think you need type safety. It&#x27;ll catch plenty of stupid mistakes... I had that urge (for types) coming from the JVM, or a non-functional non-dynamic language, but it&#x27;s actually a straw man. I&#x27;d highly encourage you to get past classes, and state, so you can really enjoy the platform for what it offers-- it&#x27;s pretty eye opening.
评论 #9908956 未加载
jpgvm将近 10 年前
Celluloid for Ruby implements the actor concurrency model. It&#x27;s not exactly the same, but running on JRuby it&#x27;s a reasonable platform for writing concurrent applications in a highly productive language and style.
评论 #9908541 未加载
beagle3将近 10 年前
Not OTP, but the Erlang message passing model has been available for Python since 2002 or so, in a package called Candygram[0].<p>[0] <a href="https:&#x2F;&#x2F;launchpad.net&#x2F;candygram" rel="nofollow">https:&#x2F;&#x2F;launchpad.net&#x2F;candygram</a> - main page is on SourceForge which is down at the moment, and should be avoided even when it is up.
mapcars将近 10 年前
Preemption. Erlang VM counts each instruction per process and uses it&#x27;s own scheduler to switch processes, all other implementations of lightweight processes can&#x27;t do this without implementing their own erlang.
评论 #9909400 未加载
jtwebman将近 10 年前
Why not just use Elixir or Erlang? I never understood why programmers would spend years re-writing something in their language of choice if it already existed.
ispaceman将近 10 年前
VS C++: Generic Parallel Computing (GPC) API <a href="http:&#x2F;&#x2F;parallect.codeplex.com" rel="nofollow">http:&#x2F;&#x2F;parallect.codeplex.com</a>
评论 #9908526 未加载
RogerAlsing将近 10 年前
Akka for .NET, <a href="http:&#x2F;&#x2F;getakka.net&#x2F;" rel="nofollow">http:&#x2F;&#x2F;getakka.net&#x2F;</a>
Rantenki将近 10 年前
Clojure&#x2F;JVM: core.async, but moreso pulsar: <a href="https:&#x2F;&#x2F;github.com&#x2F;puniverse&#x2F;pulsar" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;puniverse&#x2F;pulsar</a>
评论 #9908519 未加载
Gonzih将近 10 年前
pulsar for clojure
jcrites将近 10 年前
I have not worked in Erlang and and am not super familiar with OTP, so my answer might be only quasi on-topic.<p>Java concurrency primitives like ExecutorService and BlockingQueue with support from libraries like Google Guava (ListenableFuture &amp; ListeningExecutorService and, more loosely related, EventBus), as well as libraries like Netty form an excellent basis for concurrent software development in Java. I&#x27;ve developed a number of event processing type applications in Java (including our email delivery system) using message passing styles and future&#x2F;promise styles and feel like Java does a good job accommodating them, helping them perform well, and allowing them to be easy to operate and troubleshoot. You can make this work all the way down to asynchronous IO at the operating system level if you wish, although in practice we get acceptable performance allowing that lowest level to use blocking IO for simplicity.<p>It&#x27;s really easy to set up a &quot;pipeline&quot; of message processors in a Java application that produce and consume from BlockingQueues; or alternatively, submit work to an ExecutorService or publish an event to an EventBus. Maybe not as easy as other languages or frameworks, since there is some scaffolding, but it feels pretty minimal to me. (Again I say this as someone who has not worked in Erlang or other concurrent languages &#x2F; frameworks extensively.) Unlike some other concurrent code, pipeline-type code is pretty easy to write, understand, and debug. The hardest part is usually orchestrating safe controlled shutdown.<p>One area where I understand that Java probably does not compete with Erlang is in the reliability of individual processes and threads and whatnot within a machine. There is no simple way in Java, for example, to continue processing requests in the application while you shutdown and restart with a new version. However, we typically accommodate problems like this at the next level up by routing traffic away from a machine in preparation for it to receive a software updated.<p>Java&#x27;s exception handling is also robust. There is not much need to worry about &quot;termination&quot; of individual processes. A top level try&#x2F;catch block in your message processing system goes a really long way to making the app itself immune to any kind of lower level failure. It might be difficult to convey the supreme confidence of error handling in Java if you&#x27;ve only worked with other languages, but a subjective feeling is: &quot;There is <i>absolutely nothing</i> that can go wrong in <i>any Java code that I might execute</i> that will not unwind in a controlled way through my try&#x2F;catch blocks and give me a nice, clear stack trace and error message.&quot; Whatever thread was handling that work can move onto the next message nicely and cleanly. And beyond this, &quot;There is <i>absolutely no way</i> that any Java code I execute can interact with any part of the application except the objects being passed to it.&quot;<p>People credit garbage collection in Java with making applications and libraries much easier to compose. I personally believe that Java&#x27;s error handling and behavior containment is also a big part of it. A library that I call simply cannot crash me or interact with anything except what it&#x27;s passed. (OK, there are some exceptions to these rules, such as code that calls into native code, or running out of heap space, or weird dynamic&#x2F;reflective stuff, but (i) you can avoid most of them in practice (ii) they don&#x27;t come up much anyway (iii) exceptions to the rules don&#x27;t tend to be a problem.)<p>Application crashes like OOM are also problems that we solve in other layers: if they happen, it means the software is not correct or not tuned correctly, and the crash of an application at this level is handled by the routing layer on top. We don&#x27;t consider application crashes as something that we need to worry about on an ongoing basis; it&#x27;s more of a QA issue during development. We do not tend to have systems though where &quot;this <i>particular</i> machine must be available at all times&quot;.<p>None of this specifically supports distributed application development along with concurrency, beyond making message passing easy within the app. That&#x27;s where client libraries like Netty or frameworks like Akka go much further.
评论 #9908402 未加载
nmcfarl将近 10 年前
Hugh
Gepsens将近 10 年前
Go <a href="https:&#x2F;&#x2F;golang.org&#x2F;" rel="nofollow">https:&#x2F;&#x2F;golang.org&#x2F;</a>
评论 #9908538 未加载