Scaling a Highly-Available Scheduler Using the Mesos Replicated Log - - PowerPoint PPT Presentation

scaling a highly available scheduler using the mesos
SMART_READER_LITE
LIVE PREVIEW

Scaling a Highly-Available Scheduler Using the Mesos Replicated Log - - PowerPoint PPT Presentation

Scaling a Highly-Available Scheduler Using the Mesos Replicated Log Kevin Sweeney (@kts) Twitter Apache Aurora Long-running services Cron jobs Ad-hoc jobs resourceOffers launchTasks statusUpdate acknowledgeStatusUpdate Any


slide-1
SLIDE 1

Scaling a Highly-Available Scheduler Using the Mesos Replicated Log

Kevin Sweeney (@kts) Twitter

slide-2
SLIDE 2
  • Long-running services
  • Cron jobs
  • Ad-hoc jobs

Apache Aurora

slide-3
SLIDE 3

resourceOffers launchTasks statusUpdate acknowledgeStatusUpdate

slide-4
SLIDE 4

resourceOffers launchTasks statusUpdate acknowledgeStatusUpdate

Any Scheduler

slide-5
SLIDE 5

resourceOffers launchTasks statusUpdate acknowledgeStatusUpdate

slide-6
SLIDE 6

+

slide-7
SLIDE 7

+

slide-8
SLIDE 8

Mesos Log API

  • Writer ¡
  • Position ¡append(byte[] ¡data); ¡
  • Position ¡truncate(Position ¡to); ¡
  • Reader ¡
  • List<byte[]> ¡read(


¡ ¡Position ¡from,
 ¡ ¡Position ¡to);

slide-9
SLIDE 9
  • Interface Definition Language
  • Field Numbers, not Field Names
slide-10
SLIDE 10

struct ¡Task ¡{ ¡ ¡ ¡1: ¡string ¡id ¡ }

slide-11
SLIDE 11

struct ¡TaskID ¡{ ¡ ¡ ¡1: ¡string ¡clusterName ¡ ¡ ¡2: ¡string ¡id ¡ }

slide-12
SLIDE 12

struct ¡Task ¡{ ¡ ¡ ¡1: ¡string ¡deprecatedId ¡ ¡ ¡2: ¡TaskID ¡id ¡ }

slide-13
SLIDE 13

struct ¡Task ¡{ ¡ ¡2: ¡TaskID ¡id ¡ }

slide-14
SLIDE 14

Mesos Log API

  • Writer ¡
  • Position ¡append(byte[] ¡data); ¡
  • Position ¡truncate(Position ¡to); ¡
  • Reader ¡
  • List<byte[]> ¡read(


¡ ¡Position ¡from,
 ¡ ¡Position ¡to);

slide-15
SLIDE 15

byte[]s?

union ¡LogEntry ¡{ ¡ ¡ ¡1: ¡Snapshot ¡snapshot ¡ ¡ ¡2: ¡Transaction ¡transaction ¡ ¡ ¡3: ¡bool ¡noop ¡ }

slide-16
SLIDE 16

byte[]s?

union ¡LogEntry ¡{ ¡ ¡ ¡1: ¡Snapshot ¡snapshot ¡ ¡ ¡2: ¡Transaction ¡transaction ¡ ¡ ¡3: ¡bool ¡noop ¡ }

slide-17
SLIDE 17

byte[]s?

struct ¡Snapshot ¡{ ¡ ¡ ¡// ¡… ¡ ¡ ¡4: ¡set<api.ScheduledTask> ¡tasks ¡ ¡ ¡// ¡… ¡ }

slide-18
SLIDE 18

How Big?

¡ ¡% ¡du ¡-­‑sm ¡scheduler-­‑backup-­‑2015-­‑08-­‑17-­‑05-­‑33 ¡ ¡ ¡1546 ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡scheduler-­‑backup-­‑2015-­‑08-­‑17-­‑05-­‑33

slide-19
SLIDE 19

byte[]s?

union ¡LogEntry ¡{ ¡ ¡ ¡// ¡… ¡ ¡ ¡5: ¡binary ¡deflatedEntry ¡ ¡ ¡// ¡… ¡ }

slide-20
SLIDE 20

Solution: Compression

% ¡gzip ¡-­‑3c ¡scheduler-­‑backup-­‑2015-­‑08-­‑17-­‑05-­‑33 ¡|\ ¡ ¡ ¡ ¡ ¡wc ¡-­‑c ¡ 296351535 ¡ # ¡296 ¡MiB

slide-21
SLIDE 21

Solution: Normalization

union ¡LogEntry ¡{ ¡ ¡ ¡// ¡… ¡ ¡ ¡6: ¡DeduplicatedSnapshot ¡deduplicated ¡ ¡ ¡// ¡… ¡ }

slide-22
SLIDE 22

Solution: Normalization

struct ¡Snapshot ¡{ ¡ ¡ ¡// ¡… ¡ ¡ ¡4: ¡set<api.ScheduledTask> ¡tasks ¡ ¡ ¡// ¡… ¡ }

slide-23
SLIDE 23

Solution: Normalization

struct ¡Snapshot ¡{ ¡ ¡ ¡// ¡… ¡ ¡ ¡4: ¡set<api.ScheduledTask> ¡tasks ¡ ¡ ¡// ¡… ¡ }

slide-24
SLIDE 24

Solution: Normalization

struct ¡ScheduledTask ¡{ ¡ ¡ ¡/** ¡The ¡task ¡that ¡was ¡scheduled. ¡*/ ¡ ¡ ¡1: ¡AssignedTask ¡assignedTask ¡ ¡ ¡/** ¡The ¡current ¡status ¡of ¡this ¡task. ¡*/ ¡ ¡ ¡2: ¡ScheduleStatus ¡status ¡ }

slide-25
SLIDE 25

Solution: Normalization

struct ¡AssignedTask ¡{ ¡ ¡ ¡/** ¡Globally-­‑unique ¡Mesos ¡task ¡ID. ¡*/ ¡ ¡ ¡1: ¡string ¡taskId ¡ ¡ ¡4: ¡TaskConfig ¡task ¡ }

slide-26
SLIDE 26

Solution: Normalization

struct ¡DeduplicatedSnapshot ¡{ ¡ ¡ ¡2: ¡list<DeduplicatedTask> ¡partialTasks ¡ ¡ ¡3: ¡list<api.TaskConfig> ¡taskConfigs ¡ }

slide-27
SLIDE 27

Solution: Normalization

% ¡snapshot-­‑tool ¡deduplicate ¡\ ¡ ¡ ¡ ¡ ¡< ¡scheduler-­‑backup-­‑2015-­‑08-­‑17-­‑05-­‑33 ¡\ ¡ ¡ ¡ ¡ ¡| ¡wc ¡-­‑c ¡ 295598543 ¡ # ¡281 ¡MiB

slide-28
SLIDE 28

Solution: Both

% ¡snapshot-­‑tool ¡deduplicate ¡\ ¡ ¡ ¡< ¡scheduler-­‑backup-­‑2015-­‑08-­‑17-­‑05-­‑33 ¡\ ¡ ¡ ¡| ¡gzip ¡-­‑3c ¡-­‑ ¡\ ¡ ¡ ¡| ¡wc ¡-­‑c ¡ ¡ ¡ ¡ ¡47030119 ¡ # ¡44 ¡MiB

slide-29
SLIDE 29

resourceOffers launchTasks statusUpdate acknowledgeStatusUpdate

slide-30
SLIDE 30

Conclusions: Performance

  • A performant scheduler needs a performant

database…

slide-31
SLIDE 31

Conclusions: Performance

  • …so you might as well start with a performant

database

slide-32
SLIDE 32

Conclusions: Normalization

  • Normalization is really important
slide-33
SLIDE 33

Conclusions: Normalization

CREATE ¡TABLE ¡tasks( ¡ ¡ ¡id ¡IDENTITY, ¡ ¡ ¡task_id ¡VARCHAR ¡NOT ¡NULL, ¡ ¡ ¡task_config_row_id ¡INT ¡NOT ¡NULL ¡ ¡ ¡ ¡ ¡ ¡ ¡REFERENCES ¡task_configs(id), ¡ ¡ ¡UNIQUE(task_id) ¡ );

slide-34
SLIDE 34

Conclusions: Normalization

  • SQL is a pretty good tool for expressing

normalization

slide-35
SLIDE 35

Questions?

slide-36
SLIDE 36

Get Involved

  • @ApacheAurora on Twitter
  • #aurora on irc.freenode.net
  • aurora.apache.org