  Coordination services are a fundamental building block of modern cloud
systems, providing critical functionalities like configuration management and
distributed locking. The major challenge is to achieve low latency and high
throughput while providing strong consistency and fault-tolerance. Traditional
server-based solutions require multiple round-trip times (RTTs) to process a
query. This paper presents NetChain, a new approach that provides scale-free
sub-RTT coordination in datacenters. NetChain exploits recent advances in
programmable switches to store data and process queries entirely in the network
data plane. This eliminates the query processing at coordination servers and
cuts the end-to-end latency to as little as half of an RTT---clients only
experience processing delay from their own software stack plus network delay,
which in a datacenter setting is typically much smaller. We design new
protocols and algorithms based on chain replication to guarantee strong
consistency and to efficiently handle switch failures. We implement a prototype
with four Barefoot Tofino switches and four commodity servers. Evaluation
results show that compared to traditional server-based solutions like
ZooKeeper, our prototype provides orders of magnitude higher throughput and
lower latency, and handles failures gracefully.
