PotW: The Chubby Lock Service for Loosely-Coupled Distributed Systems

Wondering what PotW is? Check out my first Read Along.

This week’s HackerSchool paper is The Chubby Lock Service for Loosely-Coupled Distributed Systems by Mike Burrows from Google.

It describes design of distributed lock service called Chubby. In addition to locks it provides capabilities for sharing small pieces of state (configuration, name information, etc) and event mechanism to notify clients about changes. There are no low level details in the paper, just description of high level design and overview of its use at Google.

The main design goals:

  • reliability
  • availability to moderately large # of clients (tens of thousands)
  • easy to understand semantics

Throughput and storage capacity were considered secondary.

Chubby provides FS-like interface for clients. You have hierarchy of directories and files and operations to read and write a whole file. Also, client can subscribe to notifications of file modifications and acquire locks.

Essentially, Chubby was designed to allow developers at Google write their own distributed system without worrying much about common problems like synchronization, leader election, etc. For example GFS and BigTable use Chubby in several ways. Also, it is used as naming service internally with what they call protocol-conversion server to make it integrate with DNS.

I was thinking “probably it’s like ZooKeeper” all the time while reading this paper. And in some sense it is. They both provide CP system with FS-like interface. Though, ZooKeeper did not provide locks initially, but added them later on top of it’s primitives. You can read more about it here.

My takeaways:

  • client library is almost as complicated as a server, which makes sense, since client is a part of distributed system itself
  • client uses extensive caching to reduce load on Chubby cell and it works!
  • caching of absence of a file was even more important than caching of file contents

And, as always, if you’re interested in gaining more rigorous understanding - go read the paper!