key-value stores fast scans on - harvard seas

68
Fast Scans on Key-Value Stores James Lennon

Upload: others

Post on 04-Jun-2022

4 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Key-Value Stores Fast Scans on - Harvard SEAS

Fast Scans on Key-Value Stores

James Lennon

Page 2: Key-Value Stores Fast Scans on - Harvard SEAS

1. What is the problem?

Page 3: Key-Value Stores Fast Scans on - Harvard SEAS

What is the problem?

Page 4: Key-Value Stores Fast Scans on - Harvard SEAS

What is the problem?

OR

Page 5: Key-Value Stores Fast Scans on - Harvard SEAS

What is the problem?

ORCan we get both?

Page 6: Key-Value Stores Fast Scans on - Harvard SEAS

2. Why is this important?

Page 7: Key-Value Stores Fast Scans on - Harvard SEAS
Page 8: Key-Value Stores Fast Scans on - Harvard SEAS

Increased adoption of NoSQL KVS

Page 9: Key-Value Stores Fast Scans on - Harvard SEAS

Increased adoption of NoSQL KVS

While also using SQL column stores

+

Page 10: Key-Value Stores Fast Scans on - Harvard SEAS

Why this isn’t great

● Time consuming● Requires expertise● Harder to maintain

Page 11: Key-Value Stores Fast Scans on - Harvard SEAS

3. Why is this hard?

Page 12: Key-Value Stores Fast Scans on - Harvard SEAS
Page 13: Key-Value Stores Fast Scans on - Harvard SEAS

Analytical Queries

High localityColumn orientedGreedy updatesCompact representation

Transactional Queries

Differential data structuresRow orientedLazy updatesSparse Indexes

Page 14: Key-Value Stores Fast Scans on - Harvard SEAS

Difficulties when adding scans to KVS

● Versioning● Batching● Design space

Page 15: Key-Value Stores Fast Scans on - Harvard SEAS

4. Why are previous solutions insufficient?

Page 16: Key-Value Stores Fast Scans on - Harvard SEAS
Page 17: Key-Value Stores Fast Scans on - Harvard SEAS
Page 18: Key-Value Stores Fast Scans on - Harvard SEAS

5. Core intuition for the solution

Page 19: Key-Value Stores Fast Scans on - Harvard SEAS

Overview

1. Amend the SQL-over-NoSQL architecture2. Discuss the design space3. Implement TellStore-Log (transaction optimized)4. Implement TellStore-Col (analytics optimized)

Page 20: Key-Value Stores Fast Scans on - Harvard SEAS

SQL-over-NoSQL

Page 21: Key-Value Stores Fast Scans on - Harvard SEAS

SQL-over-NoSQL

● KVS must support scans (selections, simple aggregates, projections)● Multiversion concurrency control● Batching● Asynchronous IO

Page 22: Key-Value Stores Fast Scans on - Harvard SEAS

Updates

Update-in-placeLog-structuredDelta-main

Design space

Page 23: Key-Value Stores Fast Scans on - Harvard SEAS

Updates

Update-in-placeLog-structuredDelta-main

Records

Row-majorColumn-major (PAX)

X

Design space

Page 24: Key-Value Stores Fast Scans on - Harvard SEAS

Updates

Update-in-placeLog-structuredDelta-main

Records

Row-majorColumn-major (PAX)

Versioning

Clustered versionsChained versions

X X

Design space

Page 25: Key-Value Stores Fast Scans on - Harvard SEAS

Updates

Update-in-placeLog-structuredDelta-main

Records

Row-majorColumn-major (PAX)

Versioning

Clustered versionsChained versions

Garbage CollectionPeriodicPiggy-backed

X X X

Design space

Page 26: Key-Value Stores Fast Scans on - Harvard SEAS

TellStore-Log

Log-structuredRow-majorChained VersionsPiggy-backed GC

TellStore-Col

Delta-mainColumn-majorClustered VersionsPeriodic GC

Extremes

Design space

Page 27: Key-Value Stores Fast Scans on - Harvard SEAS

TellStore-Log

Page 28: Key-Value Stores Fast Scans on - Harvard SEAS

TellStore-Log

Append only; lock-free

Page 29: Key-Value Stores Fast Scans on - Harvard SEAS

TellStore-Log

Linear probing

Append only; lock-free

Page 30: Key-Value Stores Fast Scans on - Harvard SEAS

TellStore-Log

Linear probing

Append only; lock-free

Self-contained

Page 31: Key-Value Stores Fast Scans on - Harvard SEAS

TellStore-Log: Insert Example

Hash Table

...

Log

Page 32: Key-Value Stores Fast Scans on - Harvard SEAS

TellStore-Log: Insert Example

Hash Table

...

Log

Page 33: Key-Value Stores Fast Scans on - Harvard SEAS

TellStore-Log: Insert Example

Hash Table

...

Log

foo null 102 null bar

Page 34: Key-Value Stores Fast Scans on - Harvard SEAS

TellStore-Log: Insert Example

foo

Hash Table

...

Log

foo null 102 null bar

Page 35: Key-Value Stores Fast Scans on - Harvard SEAS

TellStore-Log: Update Example

foo

Hash Table

...

Log

foo null 102 null bar

Page 36: Key-Value Stores Fast Scans on - Harvard SEAS

TellStore-Log: Update Example

foo

Hash Table

...

Log

foo null 102 104 bar

foo ptr 104 null bar2

Page 37: Key-Value Stores Fast Scans on - Harvard SEAS

TellStore-Log: Update Example

foo

Hash Table

...

Log

foo null 102 104 bar

foo ptr 104 null bar2

Page 38: Key-Value Stores Fast Scans on - Harvard SEAS

TellStore-Log: Garbage Collection

1. Get “health” of pagesa. Mark if below threshold

2. Move and update to head of log

Page 39: Key-Value Stores Fast Scans on - Harvard SEAS

TellStore-Log: Summary

● Log structure -> Fast put operations● Hash Table -> Fast get operations● Snapshot Isolation -> Higher throughput, concurrent queries without locks● Self-contained entries -> Improve scan performance● Lazy GC -> Improve scan performance, keep memory in check

Page 40: Key-Value Stores Fast Scans on - Harvard SEAS

TellStore-Col

Page 41: Key-Value Stores Fast Scans on - Harvard SEAS

TellStore-Col

Read-only;Read optimized

Page 42: Key-Value Stores Fast Scans on - Harvard SEAS

TellStore-Col

Read-only;Read optimized

Append-only;Write optimized

Append-only;Write optimized

Page 43: Key-Value Stores Fast Scans on - Harvard SEAS

TellStore-Col: Main Storage (PAX)

Page 44: Key-Value Stores Fast Scans on - Harvard SEAS

TellStore-Col: Main Storage (PAX)

Fixed-size data is column-major

Page 45: Key-Value Stores Fast Scans on - Harvard SEAS

TellStore-Col: Main Storage (PAX)

Fixed-size data is column-major

Var-size data is indexed column-wise

but stored in row-major format

Page 46: Key-Value Stores Fast Scans on - Harvard SEAS

TellStore-Col: Versioning

● Main & Insert log have newest pointer● Update log has previous pointer● In main, different versions of same key stored contiguously, newest to oldest

Page 47: Key-Value Stores Fast Scans on - Harvard SEAS

TellStore-Col: Insert Example

abc

...

Insert Log

...

Update Log

Hash Table abc xyz null

Main Storage

Page 48: Key-Value Stores Fast Scans on - Harvard SEAS

TellStore-Col: Insert Example

abc

...

Insert Log

...

Update Log

Hash Table abc xyz null

Main Storage

Page 49: Key-Value Stores Fast Scans on - Harvard SEAS

TellStore-Col: Insert Example

abc

...

Insert Log

...

Update Log

Hash Table abc xyz null

Main Storage

foo 102 null null bar

Page 50: Key-Value Stores Fast Scans on - Harvard SEAS

TellStore-Col: Insert Example

abc

foo

...

Insert Log

...

Update Log

Hash Table abc xyz null

Main Storage

foo 102 null null bar

Page 51: Key-Value Stores Fast Scans on - Harvard SEAS

TellStore-Col: Update Example

abc

foo

...

Insert Log

...

Update Log

Hash Table abc xyz null

Main Storage

foo 102 null null bar

Page 52: Key-Value Stores Fast Scans on - Harvard SEAS

TellStore-Col: Update Example

abc

foo

...

Insert Log

...

Update Log

Hash Table abc xyz null

Main Storage

foo 102 104 null bar

foo 104 null ptr bar2

Page 53: Key-Value Stores Fast Scans on - Harvard SEAS

TellStore-Col: Update Example

abc

foo

...

Insert Log

...

Update Log

Hash Table abc xyz null

Main Storage

foo 102 104 ptr bar

foo 104 null ptr bar2

Page 54: Key-Value Stores Fast Scans on - Harvard SEAS

TellStore-Col: Garbage Collection

● Dedicated thread● Scans over main

○ Aggressive; rewrites page if single entry out of date○ Adds valid previous entries from update log

● Scans over insert-log● Truncates logs

Page 55: Key-Value Stores Fast Scans on - Harvard SEAS

TellStore-Col: Summary

● Delta-main -> Compromise between scans and updates● PAX structured main -> Minimize disk IO while still having data locality● Separate insert and update logs -> More efficient garbage collection● Aggressive GC -> Improve scan performance, keep memory in check

Page 56: Key-Value Stores Fast Scans on - Harvard SEAS

TellStore: Implementation Details

Page 57: Key-Value Stores Fast Scans on - Harvard SEAS

TellStore: Implementation Details

Page 58: Key-Value Stores Fast Scans on - Harvard SEAS

6. Does the paper prove its claims?

Page 59: Key-Value Stores Fast Scans on - Harvard SEAS

Clear Justifications and Considerations

● Clearly explain design options and tradeoffs involved● Consistently choose good compromises between transactions & scans● Provide two designs, “extreme” hybrids to optimize for either

Page 60: Key-Value Stores Fast Scans on - Harvard SEAS

7. Setup of experiments? Are they sufficient?

Page 61: Key-Value Stores Fast Scans on - Harvard SEAS

Comparing Transactional Throughput

Page 62: Key-Value Stores Fast Scans on - Harvard SEAS

Comparing Transactional Throughput

Page 63: Key-Value Stores Fast Scans on - Harvard SEAS

Investigating Batch Size

Page 64: Key-Value Stores Fast Scans on - Harvard SEAS

Comparing Query Response Time

Page 65: Key-Value Stores Fast Scans on - Harvard SEAS

Comparing Query Response Time

Page 66: Key-Value Stores Fast Scans on - Harvard SEAS

Comparing Query Response Time

Page 67: Key-Value Stores Fast Scans on - Harvard SEAS

8/9. Gaps in the logic / proof? Possible next steps?

Page 68: Key-Value Stores Fast Scans on - Harvard SEAS

Next Steps

● How do their designs perform with disk storage?● Data replication (high availability)● Distributed queries● Less aggressive GC variants