Akka或类似的替代品在Golang中是否有支持分布式并发的解决方案?

huangapple go评论97阅读模式
英文:

akka or similar alternative for golang to support distributed concurrency?

问题

我知道Golang在并发方面非常出色,因为它具有内置的支持,但在我看来,它似乎不是分布式的。那么,在分布式环境中,有哪些框架/库可以让我们编写生产者/消费者应用程序呢?

英文:

I know golang is very good at concurrency with its built-in support, but seems to me they are not distributed, so what would be the framework/library allow us to write producers/consumers applications, in a distributed environment.

答案1

得分: 23

如果你想在分布式程序中使用Go语言的通道概念,可以考虑使用Go Circuit框架。

它提供了一个框架,用于运行多进程程序(可能分布在多台机器上),允许你使用通道在这些进程之间进行通信。

Go Circuit

英文:

If you want to use Go's channel concepts in a distributed program, perhaps check out the Go Circuit framework.

It provides a framework for running multi-process programs (possibly spread over multiple machines), allowing you to use channels to communicate between those processes.

答案2

得分: 10

这里不需要重新发明轮子...生产者/消费者应用通常使用消息队列构建。

采用这种方法,你应该将问题分解为小的(最好是幂等的)任务,构建一个可以将这些任务入队的应用程序,然后再有另一个工作程序可以将这些任务出队并执行。扩展很容易:只需添加更多的工作程序。

市面上有很多队列解决方案,如果你想使用Go语言编写一个非常好的队列解决方案,可以看看NSQ

英文:

No need to reinvent the wheel here... producer/Consumer applications are usually built using a message queue.

With this approach you should try to break up your problem into small (and ideally idempotent) tasks, build an application which can enqueue these tasks, and then have another worker application which can dequeue these tasks and execute them. Scaling is easy: just add more workers.

There are lots of queuing solutions out there, for a very good one written in Go take a look at NSQ.

答案3

得分: 7

两年晚了,但如果还有其他人在寻找的话,可以参考以下链接:

GAM(Go Actor Model)支持类似Akka的actors和类似Ms Orleans的Virtual Grains。
类似Ms Orleans的Virtual Grains是通过Protobuf代码生成来支持的,可以提供给您类型化的消息和类型化的grain类型。
请参考以下链接:
https://github.com/AsynkronIT/gam/blob/dev/examples/cluster/member/main.go
https://github.com/AsynkronIT/gam/blob/dev/examples/cluster/shared/protos.proto

它还非常快,每秒可以处理100万个远程消息。

英文:

Two years late but if anyone else is looking.
https://github.com/AsynkronIT/gam

GAM (Go Actor Model) supports both Akka like actors, and Ms Orleans like Virtual Grains.
The Ms Orleans like Virtual Grains are supported via Protobuf code generation to give you typed messages and typed grain types.
See
https://github.com/AsynkronIT/gam/blob/dev/examples/cluster/member/main.go
https://github.com/AsynkronIT/gam/blob/dev/examples/cluster/shared/protos.proto

It's also extremely fast, 1 mil+ remote messages per sec.

答案4

得分: 6

Akka基于Actor模型。为此,我邀请您测试一个很好的Go框架:https://github.com/AsynkronIT/protoactor-go

据说它具有出色的性能,因为它声称可以在节点之间传递:

每秒传递两百万条消息

虽然Go已经使用CSP进行实现,但Protoactor还添加了以下功能:

  • 解耦并发
  • 默认分布式
  • 容错性
英文:

Akka is based on the Actor Model. For that, there is a nice Go framework I invite you to test : https://github.com/AsynkronIT/protoactor-go

It is said to have great performance since it claims to be passing between nodes:
> two million messages per second

While Go is already implementing using CSP, Protoactor adds :

  • Decoupled Concurrency
  • Distributed by default
  • Fault tolerance

答案5

得分: 3

只是为了记录,NATS是一个用于分布式系统的高性能解决方案。它是开源的,并且采用MIT许可证。"核心NATS服务器充当构建分布式应用程序的中枢神经系统",并且它有官方的客户端,包括Go、C#、Java、Ruby、Python、Node.js等,由社区提供更多的客户端。

英文:

Just for the record NATS is a high performance solution for distributed systems. It's open source and under MIT license. "The core NATS Server acts as a central nervous system for building distributed applications." and it has official clients for Go, C#, Java, Ruby, Python, Node.js and much more provided by the community.

答案6

得分: 0

这是一个很老的问题,但我建议你查看daprprotoactor

dapr更加灵活,但使用了sidecar模式,会增加一些开销。

protoactor更像是akka,因为它是由同一个人开发akka.net的。

根据你的使用情况,两者都是不错的选择。这篇博客对它们的性能进行了很好的比较。

英文:

Such an old question but I would check out dapr and protoactor.

dapr is more flexible but carries overhead from employing a sidecar pattern.

protoactor is more like akka having been written by the same guy who made akka.net.

Both are good depending on your use case. This blog does a good comparison of the performance.

huangapple
  • 本文由 发表于 2014年2月1日 12:42:13
  • 转载请务必保留本文链接:https://go.coder-hub.com/21494157.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定