dongqidi2799 2014-11-29 10:33
浏览 23
已采纳

通过地图,通过通道和网络切片?

What is the best way to pass slice and map structure over channel that is distributed over network? I need to distribute the application running over several EC2 instances and wonder how I can achieve this by communicating each application by Go channel.

Here's the workflow that I would like to run:

1. Process data in one application
2. Distribute the data into 10 replica applications
3. Each 10 application does its job in a separate EC2 instance
4. Once they are all done, they send the result back to the original program
5. This is sent over the channel

Please let me know. Thanks!

  • 写回答

1条回答 默认 最新

  • douyi8760 2014-11-29 10:44
    关注

    If depends on the format you will chose for the serialization.

    One well-suited for over-the-network communication is MessagePack (an efficient binary serialization format. It lets you exchange data among multiple languages like JSON. But it's faster and smaller)

    A Go library like philhofer/msgp can serializaze any struct (like one with a map), including composite types like maps and arrays.

    However, it uses Go1.4 go generate command. (go 1.4rc1 is already out)

    From there, a library like docker/libchan can help: Libchan is an ultra-lightweight networking library which lets network services communicate in the same way that goroutines communicate using channels.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 在获取boss直聘的聊天的时候只能获取到前40条聊天数据
  • ¥20 关于URL获取的参数,无法执行二选一查询
  • ¥15 液位控制,当液位超过高限时常开触点59闭合,直到液位低于低限时,断开
  • ¥15 marlin编译错误,如何解决?
  • ¥15 有偿四位数,节约算法和扫描算法
  • ¥15 VUE项目怎么运行,系统打不开
  • ¥50 pointpillars等目标检测算法怎么融合注意力机制
  • ¥20 Vs code Mac系统 PHP Debug调试环境配置
  • ¥60 大一项目课,微信小程序
  • ¥15 求视频摘要youtube和ovp数据集