翻译进度
5
分块数量
3
参与人数

21.1. Heroku —— Go 实现的可用性极高的数据一致性存储方案

这是一篇协同翻译的文章,你可以点击『我来翻译』按钮来参与翻译。

http://www.heroku.com/ (参考文献39)

Heroku是位于美国旧金山的硅谷公司,最近被 Salesforce.com 购买,该公司为 Ruby 和 Rails,Java,Clojure 和 node.js 应用程序提供了强大的,可扩展的,非常易于管理的云托管。Heroku 的两名工程师 Keith Raric 和 Blake Mizerany,设计了并且开源了一个名为 Doozer “分布式初始系统”,用于管理机器集群中的进程,并且能够从实例故障和网络分区中恢复正常。其中一个要求是他们需要在许多服务器之间对信息进行可靠的同步和共享。

为了能够使系统能够协调运行,系统中的每个服务器都需要有关于整个系统的大量信息(配置数据,锁等),并且即使在数据存储失败期间,该信息也需要保持一致且可用,因此他们需要一个具有可靠一致性保证的数据存储。为了这个目的,他们开发了 Doozer ,一个用 Go 编写的新的,一致的,高度可用的数据存储库,仿照 Google 的(封闭源码)Chubby 程序来写的一个产品,用来管理其后端基础架构。

miss201 翻译于 5个月前

Doozer 基于 Paxos (Paxos 是用于统一网络中,不可靠节点内容统一的一系列协议)。Paxos 对于容错系统的运行至关重要,但它很难实现。即使网上有出于教育的目的进行了简化的示例,实现它也很复杂且难以继续深入下去。现有的产品系统因此更加「臭名远扬」了。

Doozer 为分布式系统的开发提供了坚实基础:

  • 高可用性(分布式网络中)。

  • 一致性(避免不一致的写入)。

  • 数据存储(对于少量数据)。
zhangjian 翻译于 3周前

As the developers say: "Doozer is where you put the family jewels." It provides a single fundamental synchronization primitive: compare-and-set. Example use cases:

  • Database master election

  • Name service

  • Configuration

Why Go was chosen and how did Go's characteristics make it a successful product:

Paxos is defined in terms of independent, concurrent processes that communicate via passing messages. This is the kind of problem where Go's concurrency primitives (goroutines and channels, see chapter 14) excel. In Doozer, these processes are implemented as goroutines, and their communications as channel operations. In the same way that Go's garbage collector keeps memory usage to a minimum, the developers of Doozer found that goroutines and channels improve upon the lock-based approach to concurrency. These tools let them avoid complex bookkeeping and stay focused on the problem at hand. They are still amazed at how few lines of code it took to achieve something renowned for being difficult.

The standard packages in Go were another big win for Doozer, most notably the websocket package.

Here follows some of the afterthoughts of the developers themselves:

. . . For instance, a package we quickly found useful was websocket. Once we had a working data store, we needed an easy way to introspect it and visualize activity. Using the websocket package, Keith was able to add the web viewer on his train ride home and without requiring external dependencies. This is a real testament to how well Go mixes systems and application programming.
Deploying Doozer was satisfyingly simple. Go builds statically linked binaries which means Doozer has no external dependencies; it's a single file that can be copied to any machine and immediately launched to join a cluster of running Doozers.
Finally, Go's maniacal focus on simplicity and orthogonality aligns with our view of software engineering. Like the Go team, we are pragmatic about what features go into Doozer. We sweat the details, preferring to change an existing feature instead of introducing a new one. In this sense, Go is a perfect match for Doozer. We already have future projects in mind for Go. Doozer is just the start of much bigger system.

They also liked the automatic formatting tool gofmt, to achieve consistent code styling and layout, avoiding discussions about these topics.

Other languages provide somewhat similar mechanisms for concurrency---such as Erlang and Scala---but Go is designed to provide maximum efficiency and control, as well. In another article (ref. 12) Keith Rarick states:

Go comes from a line of systems programming languages like C and C++, so it gives you the ability to really control the performance characteristics. When it comes time to measure things and make sure they run fast, you have the flexibility to really get in there and do what you need. And when you figure out why your program is being slow, you really have the control you need to fix it. Go gives you a unique combination: C gives you control, but it's not good for concurrency. It doesn't even give you garbage collection. Go gives you concurrency and garbage collection, but it still gives you control over memory layout and resource use.

In Doozer Go is primarily used as a systems programming language. A more technical description can be found in ref. 38; the code can be found at https://github.com/ha/doozer

本文章首发在 GolangCaff
本文中的所有译文仅用于学习和交流目的,转载请务必注明文章译者、出处、和本文链接
我们的翻译工作遵照 CC 协议,如果我们的工作有侵犯到您的权益,请及时联系我们。

参与译者:3
讨论数量: 0
发起讨论


暂无话题~