erlang 的常见用例
erlang 的常见用例有哪些?我大致了解它,但我正在寻找具体的例子。 Erlang 在以下情况下可能有用吗?
- 分布式作业调度程序。 (从作业队列中取出复杂的多阶段作业,并将其分配给工作线程,工作线程将执行其中的每个线程,然后将输出从一个阶段传递到另一个阶段)(顺便说一句,这是集成 Erlang 和Java/C++。每个阶段都可能是任意计算密集型的,因此 Erlang 可能不适合每个步骤中的计算,但可以用于协调整个管道)。 (警告:这看起来像 Map-reduce,但事实并非如此。这里没有发生减少操作)
- 网站请求处理
- 分布式算法,用于在多个连续数据流中选择第 K 个最大元素(或执行此类类似分析)
SO 上的某处,我读到使用 Erlang 解决 Project Euler 上的问题是一个好主意。是吗?
除了编写 erlyweb、couchdb、yaws 等之外,还有其他常见的日常用例吗?在看过 Erlyweb、Couchdb、yaws 等应用程序后,似乎 Erlang 主要在你只想大规模并发时发挥作用,但底层业务逻辑本身非常简单。我没有任何著名的应用程序,其业务逻辑也非常复杂并且需要大量并发。 业务逻辑少=>除了调度数据/传递数据/将数据存储在某个地方之外,他们对数据没有做太多事情。
谢谢
What are common use cases of erlang? I know about it in general, but I am looking for specific examples.
Are the following some situations where Erlang might be useful?
- A distributed Job scheduler. (Take complex multi-staged jobs from a job queue and assign it to worker threads that will perform each thread of it and then pass along the output from one stage to another) (As an aside, this is an interesting case for integrating Erlang and Java/C++. Each Stage might be arbitrarily computationally intensive and hence Erlang might not be appropriate for computation within each step, but might be used to co-ordinate the whole pipeline). (Warning: This looks like Map-reduce, but it is not. There is no reduce operation happening here)
- Website Request handling
- Distributed algorithm for selecting the Kth largest element among multiple continuous streams of data (or performing such similar analysis)
Somewhere on SO, I read that solving problems on Project Euler using Erlang is a good idea. Is it?
Any other common day-to-day use cases, other than writing erlyweb, couchdb,yaws etc? After seeing applications like Erlyweb, Couchdb, yaws etc. it seems that Erlang mainly shines when you just want to be massively concurrent, but the underlying business logic itself is pretty simple. I dont any famous applications where the business logic is also very complicated as well as needing massive concurrency.
Business logic less => they don't do much with the data other than just dispatching it/ passing it/storing it somewhere.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Erlang 擅长 SOA 和服务器端编程。业务逻辑的复杂性不是问题。您可以根据需要管理尽可能复杂的应用程序。做同样的事情,它的代码肯定会比 C/C++ 和 Java 少,甚至可能比 Python 或 Ruby 还要少。您的逻辑复杂程度没有限制。我认为电话交换机(这是 Erlang 最初的用途)背后有一些相当复杂的状态机和逻辑。
可以说,逻辑越复杂,函数式语言的表达能力就越强,也越容易维护。 Erlang 在华尔街大型银行的大批量微交易应用中非常流行,进行这些交易的逻辑比常见<的任何交易都要复杂得多。 /strong> 商业应用。
Erlang shines at SOA and Server side programming. The complexity of the business logic is not an issue. You can manage as complex of an application as you need. It will be less code than C/C++ and Java for sure to do the same thing, probably less code than Python or Ruby even. There is no constraint on how complex your logic is. I would argue that a telephone switch ( which is what Erlang was first used for ) has some pretty complex statemachines and logic behind it.
It is arguable that functional languages are more expressive and easier to maintain the more complex the logic gets. Erlang is very popular in high volume micro trading applications at BIG banks on Wall Street, the logic on making these trades is way more complex than anything in a common business application.