Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Torus: Storage Demystified

Sponsored · SiteGround - Reliable hosting with speed, security, and support you can count on. →

Torus: Storage Demystified

My first talk on the inspiration and implementation of Torus

Avatar for Barak Michener

Barak Michener

June 17, 2016

Other Decks in Programming

Transcript

  1. UNIX File API • read(), write() • fsync() (Flush(), in

    Go) The fsync() function is intended to force a physical write of data from the buffer cache, and to assure that after a system crash or other failure that all data up to the time of the fsync() call is recorded on the disk. Since the concepts of ``buffer cache'', ``system crash'', ``physical write'', and ``non-volatile storage'' are not defined here, the wording has to be more abstract.
  2. Magical File Pointer • Distributed/Sharded • Replicated • Error-corrected •

    Versioned • Available anywhere on the cluster The Dream of Plan 9 is alive in Golang
  3. Storage is Generic (when you squint) Bytes, persisted somewhere •

    Block Devices ◦ One, fixed size, “magical file pointer” • Object Stores ◦ HTTP API to some magic bucket of (often append- only) MFPs • Filesystems ◦ POSIX semantics and metadata referring to MFPs
  4. Reminder : The only way to know something is durable

    is to sync() (and pray you’re not being lied to)
  5. Architecture, Explained • Client ◦ Mounts a data source ◦

    Gets data from storage directly ◦ Updates metadata • Metadata ◦ Presents a consistent view for multiple clients ◦ Knows where the data lives ◦ Service discovery, etc • Storage ◦ Truthfully stores data it’s responsible for
  6. Architecture, Explained • Client <-> Metadata ◦ Updates metadata about

    what it’s reading/writing ◦ Where to find the storage in question • Client <-> Storage ◦ Bulk data transport • Metadata <-> Storage ◦ Is told what data it owns ◦ Tells it what to keep or throw away
  7. Distributed Consensus is Hard Any form of distributed storage (FS,

    database, ….) requires at least some of its data be strongly consistent. Everyone has had to reimplement this in some form or another, if for no other reason than locking -- but for many good reasons too, eg, declaring something written/available to all clients. Yo, turns out we have a secret weapon….
  8. “That means what is left is the business logic of

    storing bits in ways which are accessible, redundant, scalable, and performant. While this is no small feat, being able to assume and trust the consistency of your metadata makes the storage logic much easier” --Seán McCord
  9. • Discovery of Peers • Coordination ◦ Checkpointing ◦ Metadata

    • Takes the place of MDS Server • Entry point for main() ◦ Create a Server object ◦ Creates Files • Monitoring • Heartbeats Distributor P2P GRPC Storage INode Abstraction • Manages Peer-to-Peer GRPC • Rebalancing, GC Thread • Stores the actual data blocks Torus process etcd
  10. • Discovery of Peers • Coordination, etc Server Distributor P2P

    GRPC Storage • No long-term storage, all data comes from the P2P Torusblk process etcd Block Volume Abstraction • Treats a Server File as a block device • Provides interface with other services (NBD) • Locks the volume • Same code for the Server and Distributor
  11. INode v1 INode v2 sync() BlockRef BlockRef BlockRef BlockRef BlockRef

    BlockRef Data Data Data Data Ready for GC at versions >=2
  12. Pure func() [Node2, Node4, Node1, Node3] BlockRef This is a

    full permutation of the nodes. They may not all have the data, but the first N (replication leve) will eventually hold the data when quiescent. F(List of Nodes, Replication factor)
  13. [Node2, Node5, Node4, Node1, Node3] R=2 [Node2, Node4, Node1, Node3]

    R=2 [Node2, Node5, Node4, Node1, Node3] R=2 [Node2, Node5, Node4, Node1, Node3] R=2 [Node2, Node5, Node4, Node1, Node3] R=2
  14. Short term • Stress testing • More block device features

    • Even better Kubernetes integration
  15. Long term • Object storage volumes ◦ Multi R/W, various

    object-y APIs • Experiments with transports ◦ eg, QUIC • More intricate rings ◦ Rack-awareness, data locality, drive speed…. ◦ (Lots of ‘fun’ here) • Kubernetes awareness ◦ Schedule work near data
  16. Thank you! Barak Michener @barakmich | [email protected] | github. com/coreos/torus

    We’re hiring in all departments! Email: [email protected] Positions: coreos.com/ careers Including Torus!
  17. We’re hiring in all departments! Email: [email protected] Positions: coreos.com/ careers

    90+ Projects on GitHub, 1,000+ Contributors OPEN SOURCE CoreOS.com - @coreoslinux - github/coreos Secure solutions, support plans, training + more ENTERPRISE [email protected] - tectonic.com - quay.io CoreOS is Running the World’s Containers
  18. $ rkt run presentation # everyone claps # drink a

    beer $ rkt run... Let’s run a container Man that was fun Supports pods for fun in a group setting