Cluster Sharding

in Effect

Warehouse

a concurrency example

User 1

User 2

System 1

Stock A

System 2

Stock A

Create Order

Create Order

  1. Read the stock
  2. Verify the stock
  3. Write the transaction
  1. Read the stock
  2. Verify the stock
  3. Write the transaction

Global Lock

  • Acquire some kind of global lock between services/servers
  • Perform the write
  • Release the lock

Single Writer

  • Redirect the write request to a single entity that will handle request

Warehouse

a concurrency example

User 1

User 2

System 1

redirect

System 2

redirect

Create Order

Create Order

  1. Read the stock
  2. Verify the stock
  3. Write the transaction

System 3

Stock A

What is Shardcake?

  • Single writer: Ensures each entity is running only in one place
     
  • Location transparency: Communicate with entities with just their ID, without knowing their location

Inspired by the original scala library
by devsisters

Keywords

  • Entity: defines a behaviour
  • Pod: Hosts many entities
  • Shard: A grouping of instances of entities
  • Assignments: A correlation between Pod and Shard
  • Shard Manager: Single instance that supervises and performs assignments

How it works?

Made with Slides.com