26
Kirill Korotaev VP of Advanced Research, Parallels Облачное распределенное хранилище данных для виртуальных машин (и не только) Yet another Conference, 1 октября 2012

Yet another Conference, 1 октября 2012cache-mskmar01.cdn.yandex.net/download.yandex.ru/company/expe… · данных для виртуальных машин (и не только)

  • Upload
    others

  • View
    11

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Yet another Conference, 1 октября 2012cache-mskmar01.cdn.yandex.net/download.yandex.ru/company/expe… · данных для виртуальных машин (и не только)

Kirill Korotaev VP of Advanced Research, Parallels

Облачное распределенное хранилище данных для виртуальных машин (и не только)

Yet another Conference, 1 октября 2012

Page 2: Yet another Conference, 1 октября 2012cache-mskmar01.cdn.yandex.net/download.yandex.ru/company/expe… · данных для виртуальных машин (и не только)

Prehistory

Page 3: Yet another Conference, 1 октября 2012cache-mskmar01.cdn.yandex.net/download.yandex.ru/company/expe… · данных для виртуальных машин (и не только)

Virtualization & needs

3

1. VM migration 2. HA on failures

Page 4: Yet another Conference, 1 октября 2012cache-mskmar01.cdn.yandex.net/download.yandex.ru/company/expe… · данных для виртуальных машин (и не только)

SAN storage

4

Redundancy High availability Monitoring Self healing Reliability Fiber channel Performance

Page 5: Yet another Conference, 1 октября 2012cache-mskmar01.cdn.yandex.net/download.yandex.ru/company/expe… · данных для виртуальных машин (и не только)

How to get best of 2 worlds?

5

local

SAN

100$ 100,000$

Page 6: Yet another Conference, 1 октября 2012cache-mskmar01.cdn.yandex.net/download.yandex.ru/company/expe… · данных для виртуальных машин (и не только)

Focus on needed capabilities is a key to success Idea of maximum simplification

Page 7: Yet another Conference, 1 октября 2012cache-mskmar01.cdn.yandex.net/download.yandex.ru/company/expe… · данных для виртуальных машин (и не только)

From required capability to consistency

7

Consistency - “some well defined and understandable order” of operations. Required for real file systems (NTFS, etx3/4,…) cause they use and rely on these properties of real disks.

A AB B Journal Metadata

•  Immediate/Strict consistency •  Sequential consistency (all observers see the same order) •  Eventual consistency (no time guarantees, most object storages) •  Weak consistency (only synchronization primitives define order)

Page 8: Yet another Conference, 1 октября 2012cache-mskmar01.cdn.yandex.net/download.yandex.ru/company/expe… · данных для виртуальных машин (и не только)

We want grow on demand also… •  Grow on demand means ability to allocate more then locally

available (>HDD or no free space) •  Requires split of data into pieces •  Probability(any of N computer failure) is increasing with N L •  So redundancy/replication and auto recovery is a MUST •  But recovery can be done in parallel (~1TB in 10mins) •  Good news is that MTTF ~1/T2, where T is recovery time. •  So let’s split all objects to chunks (64Mb) •  Replicate chunks, not objects •  Spread chunks over the cluster to reduce recovery T •  Need to take into account topology of cluster L

8

Page 9: Yet another Conference, 1 октября 2012cache-mskmar01.cdn.yandex.net/download.yandex.ru/company/expe… · данных для виртуальных машин (и не только)

More ideas

9

Simplifications: •  No need for POSIX FS •  Optimize for big objects only •  Can assume infrequent/slow metadata updates

Major assumption: •  Shit happens: servers die, even DC can crash

Page 10: Yet another Conference, 1 октября 2012cache-mskmar01.cdn.yandex.net/download.yandex.ru/company/expe… · данных для виртуальных машин (и не только)

Why consistency is not easy? Replication…

10

Simplest case: object is fully stored on a single node

Next step: object is replicated, i.e. multiple instances present

Object

v1

v1

v1

v2

v2

v1 Stale data can be read!

Server2

Server3

t Server1

DC

cra

sh

Page 11: Yet another Conference, 1 октября 2012cache-mskmar01.cdn.yandex.net/download.yandex.ru/company/expe… · данных для виртуальных машин (и не только)

c1v2

c2v2

Why consistency is not easy? Data striping…

11

Splitting data into chunks leads to similar issues as replication:

Server1 c1v1

File

c2v1

c1v1

c2v1

c1v2

c2v2

c1v1 c2v1

t write

actual state is c1v2+c2v2,

but all combinations civj can be found

Note: c1v1 or/and c2v1 should never be read!

=

Server2 Server3 c1v1

Server4 Server5 Server6

c2v1 DC

cra

sh

write

Page 12: Yet another Conference, 1 октября 2012cache-mskmar01.cdn.yandex.net/download.yandex.ru/company/expe… · данных для виртуальных машин (и не только)

So why consistency is not easy?

12

Data versioning is crucial and should be attributed to data, plus heavily checked on operations! Problems with versions: 1.  Tracking versions requires transactions support and sync operations.

SLOW! L 2.  Can’t store versions near data only! Node can not decide alone whether

it’s uptodate or not. Solution: 1.  Let’s update version only when some server can’t complete write! And

leave it constant on successful data modifications. 2.  To solve #2 let’s store versions on metadata servers (MDS) – authority

which tracks full cluster state. It should be reliable and HA.

Page 13: Yet another Conference, 1 октября 2012cache-mskmar01.cdn.yandex.net/download.yandex.ru/company/expe… · данных для виртуальных машин (и не только)

Design

Page 14: Yet another Conference, 1 октября 2012cache-mskmar01.cdn.yandex.net/download.yandex.ru/company/expe… · данных для виртуальных машин (и не только)

Overall design

14

MDS

CS

Clients

Meta Data Server (MDS) •  Metadata database •  Chunks and versions tracker •  HA

Ethernet

CS CS CS CS CS CS

Chunk Server (CS) •  Stores data (chunks) •  Chunk management •  READ/WRITE

Page 15: Yet another Conference, 1 октября 2012cache-mskmar01.cdn.yandex.net/download.yandex.ru/company/expe… · данных для виртуальных машин (и не только)

Magic (MetaData) Server HA

•  Single point of failure => need HA… •  Ouch, but we don’t want replicated DB, MySQL or Oracle…

It’s a nightmare to manage. Not scalable. •  Database adds noticeable latency per chunk access

15

We have to create our own replicated DB for MDS

Page 16: Yet another Conference, 1 октября 2012cache-mskmar01.cdn.yandex.net/download.yandex.ru/company/expe… · данных для виртуальных машин (и не только)

Local journal

Meta Data Server database

16

Local journal

Full state in memory

Ideas from GoogleFS:

•  ~128 byte per chunk •  64Mb RAM describe ~32 Terabytes

chunks

Commit deltas

•  Journal stores modification records •  It’s growing, so need compacting

method •  To compact in background, need

memory snapshotting •  Journal and state can be synced to

outdated nodes

Page 17: Yet another Conference, 1 октября 2012cache-mskmar01.cdn.yandex.net/download.yandex.ru/company/expe… · данных для виртуальных машин (и не только)

Meta Data Server database compacting

17

Local journal

Full state in memory

New journal

Snap-shot

New journal

Snap-shot

Page 18: Yet another Conference, 1 октября 2012cache-mskmar01.cdn.yandex.net/download.yandex.ru/company/expe… · данных для виртуальных машин (и не только)

PAXOS algorithm The Part-Time Parliament, Leslie Lamport: •  The Island of Paxos, parliament government •  Legislators are traders, travel a lot and often not present in

chamber •  They used non-reliable messengers for notifications and

communication •  Decree is adopted using ballots, need majority of votes •  Legislators are each having it’s own journal of records •  Consistency of decrees is required •  Add/removal of legislators is needed •  Progress is needed

18

Page 19: Yet another Conference, 1 октября 2012cache-mskmar01.cdn.yandex.net/download.yandex.ru/company/expe… · данных для виртуальных машин (и не только)

Performance

Page 20: Yet another Conference, 1 октября 2012cache-mskmar01.cdn.yandex.net/download.yandex.ru/company/expe… · данных для виртуальных машин (и не только)

Chunk server performance tricks

20

Write requests are split (64k) and chained: Chained write

Completion

CS CS CS

t

64k

1 server, 256K write 3 servers, 256K split/chained write

3 servers, dumb

Write 256Kb req

Page 21: Yet another Conference, 1 октября 2012cache-mskmar01.cdn.yandex.net/download.yandex.ru/company/expe… · данных для виртуальных машин (и не только)

SSD caching

•  Bursts performance > 10x times •  Allows to implement data check summing and scrubbing •  Reason: major difference from object storages –

performance and latency are very noticeable and important. Latency is not hidden by WAN.

21

Page 22: Yet another Conference, 1 октября 2012cache-mskmar01.cdn.yandex.net/download.yandex.ru/company/expe… · данных для виртуальных машин (и не только)

Summary

Page 23: Yet another Conference, 1 октября 2012cache-mskmar01.cdn.yandex.net/download.yandex.ru/company/expe… · данных для виртуальных машин (и не только)

Final result

Storage system: •  With file system interface, scalable to Petabytes •  Suitable for running VMs and Containers, Object Storage,

shared hosting and other needs •  SAN like performance over ethernet networks:

•  13K IOPS on 14 machines cluster (4 SATA HDD each) •  600K IOPS with SSD caching •  1TB drive recovery takes 10 minutes!

23

Page 24: Yet another Conference, 1 октября 2012cache-mskmar01.cdn.yandex.net/download.yandex.ru/company/expe… · данных для виртуальных машин (и не только)

Some experience to share •  Asynchronous non-blocking design •  QA: unit tests and stress testing are the must •  QA: how to emulate power off? SIGSTOP+SIGCONT/KILL.

•  It hangs connections and avoids RESETs as if host disappeared •  Drives/RAIDs/SSDs lie about FLUSHes. •  SSD write performance depends on data. Beware compression

inside. •  Checksum everything (4GB/sec) and validate HW memtest86

24

Page 25: Yet another Conference, 1 октября 2012cache-mskmar01.cdn.yandex.net/download.yandex.ru/company/expe… · данных для виртуальных машин (и не только)

Some experience to share •  All queues should be limited and controlled, like in TCP

congestion control is required (both for memory limit and latency control, i.e. IO queue length)

•  One client can fire Nx4K random requests and effectively it’s equivalent to 1MB requests. Congestion should be calculated correctly (taking into accoung quality of queue).

•  In addition to queues limit FDs/connections etc. •  Linux sync() / syncfs() is not usable •  Linux fdatasync() is 3.5-4x faster then fsync(), but should not be

used when file size changed. •  Replication should be done by pairs

25

Page 26: Yet another Conference, 1 октября 2012cache-mskmar01.cdn.yandex.net/download.yandex.ru/company/expe… · данных для виртуальных машин (и не только)

Thank You

26

Kirill Korotaev [email protected] Try Parallels Cloud Server 6.0 beta2 at http://www.parallels.com/product/pcs