Scale Out and Conquer: Architectural Decisions Behind Distributed...

53
© 2018 GridGain Systems, Inc. GridGain Company Confidential Scale Out and Conquer: Architectural Decisions Behind Distributed In-Memory Systems Denis Magda Apache Ignite PMC Chair GridGain Product Management

Transcript of Scale Out and Conquer: Architectural Decisions Behind Distributed...

Page 1: Scale Out and Conquer: Architectural Decisions Behind Distributed …files.informatandm.com/uploads/2018/10/Scale_Out_and... · 2018-10-12 · Among Top 5 Apache Projects Total number

© 2018 GridGain Systems, Inc. GridGain Company Confidential

Scale Out and Conquer: Architectural

Decisions Behind Distributed In-Memory

Systems

Denis Magda

Apache Ignite PMC Chair

GridGain Product Management

Page 2: Scale Out and Conquer: Architectural Decisions Behind Distributed …files.informatandm.com/uploads/2018/10/Scale_Out_and... · 2018-10-12 · Among Top 5 Apache Projects Total number

© 2018 GridGain Systems, Inc. GridGain Company Confidential

Agenda

• Partitioning – Pitfalls of Even Distribution

• Affinity Collocation – Laid Out in Numbers

• Multi-threading of Distributed Systems – Things to Know

Page 3: Scale Out and Conquer: Architectural Decisions Behind Distributed …files.informatandm.com/uploads/2018/10/Scale_Out_and... · 2018-10-12 · Among Top 5 Apache Projects Total number

© 2018 GridGain Systems, Inc. GridGain Company Confidential

Memory-centric distributed

database, caching, and processing platform

Memory-centric platform based on Apache Ignite

adds enterprise features and support

for mission critical deployments

Page 4: Scale Out and Conquer: Architectural Decisions Behind Distributed …files.informatandm.com/uploads/2018/10/Scale_Out_and... · 2018-10-12 · Among Top 5 Apache Projects Total number

© 2018 GridGain Systems, Inc. GridGain Company Confidential

Among Top 5 Apache Projects

Total number of Apache Projects: 318Top-Level Apache Projects: 193

Top 5 Apache Projects by Commits

1. Hadoop2. Ambari3. Lucene-Solr4. Camel5. Ignite

Top 10 most active Apache mailing lists 1. Flex2. Lucene3. Ignite4. Kafka5. Geode6. Flink7. Tomcat8. Cassandra9. Beam10. Sentry

Page 5: Scale Out and Conquer: Architectural Decisions Behind Distributed …files.informatandm.com/uploads/2018/10/Scale_Out_and... · 2018-10-12 · Among Top 5 Apache Projects Total number

© 2018 GridGain Systems, Inc. GridGain Company Confidential

Partitioning – Pitfalls of Even Distribution

Page 6: Scale Out and Conquer: Architectural Decisions Behind Distributed …files.informatandm.com/uploads/2018/10/Scale_Out_and... · 2018-10-12 · Among Top 5 Apache Projects Total number

© 2018 GridGain Systems, Inc. GridGain Company Confidential

Where request goes?

Page 7: Scale Out and Conquer: Architectural Decisions Behind Distributed …files.informatandm.com/uploads/2018/10/Scale_Out_and... · 2018-10-12 · Among Top 5 Apache Projects Total number

© 2018 GridGain Systems, Inc. GridGain Company Confidential

Affinity Function

Key Partition

Server Node

ON-DISK

Page 8: Scale Out and Conquer: Architectural Decisions Behind Distributed …files.informatandm.com/uploads/2018/10/Scale_Out_and... · 2018-10-12 · Among Top 5 Apache Projects Total number

© 2018 GridGain Systems, Inc. GridGain Company Confidential

Affinity Function

Page 9: Scale Out and Conquer: Architectural Decisions Behind Distributed …files.informatandm.com/uploads/2018/10/Scale_Out_and... · 2018-10-12 · Among Top 5 Apache Projects Total number

© 2018 GridGain Systems, Inc. GridGain Company Confidential

Naïve Affinity

Page 10: Scale Out and Conquer: Architectural Decisions Behind Distributed …files.informatandm.com/uploads/2018/10/Scale_Out_and... · 2018-10-12 · Among Top 5 Apache Projects Total number

© 2018 GridGain Systems, Inc. GridGain Company Confidential

Naïve Function: New Node

Page 11: Scale Out and Conquer: Architectural Decisions Behind Distributed …files.informatandm.com/uploads/2018/10/Scale_Out_and... · 2018-10-12 · Among Top 5 Apache Projects Total number

© 2018 GridGain Systems, Inc. GridGain Company Confidential

Naïve Function: What’s Wrong?

Page 12: Scale Out and Conquer: Architectural Decisions Behind Distributed …files.informatandm.com/uploads/2018/10/Scale_Out_and... · 2018-10-12 · Among Top 5 Apache Projects Total number

© 2018 GridGain Systems, Inc. GridGain Company Confidential

Naïve Affinity: Redundant Partitions Re-shuffling!

Page 13: Scale Out and Conquer: Architectural Decisions Behind Distributed …files.informatandm.com/uploads/2018/10/Scale_Out_and... · 2018-10-12 · Among Top 5 Apache Projects Total number

© 2018 GridGain Systems, Inc. GridGain Company Confidential

Productized Affinity Functions

• Consistent hashing [1]

• Rendezvous hashing (HRW) [2]

[1] https://en.wikipedia.org/wiki/Consistent_hashing

[2] https://en.wikipedia.org/wiki/Rendezvous_hashing

Page 14: Scale Out and Conquer: Architectural Decisions Behind Distributed …files.informatandm.com/uploads/2018/10/Scale_Out_and... · 2018-10-12 · Among Top 5 Apache Projects Total number

© 2018 GridGain Systems, Inc. GridGain Company Confidential

Rendezvous Affinity: Weight Calculation

WEIGHT(partition, node)

Page 15: Scale Out and Conquer: Architectural Decisions Behind Distributed …files.informatandm.com/uploads/2018/10/Scale_Out_and... · 2018-10-12 · Among Top 5 Apache Projects Total number

© 2018 GridGain Systems, Inc. GridGain Company Confidential

Rendezvous Affinity: Weight Calculation

WEIGHT(partition, node)

Page 16: Scale Out and Conquer: Architectural Decisions Behind Distributed …files.informatandm.com/uploads/2018/10/Scale_Out_and... · 2018-10-12 · Among Top 5 Apache Projects Total number

© 2018 GridGain Systems, Inc. GridGain Company Confidential

Rendezvous Affinity: Weight Calculation

WEIGHT(partition, node)

Page 17: Scale Out and Conquer: Architectural Decisions Behind Distributed …files.informatandm.com/uploads/2018/10/Scale_Out_and... · 2018-10-12 · Among Top 5 Apache Projects Total number

© 2018 GridGain Systems, Inc. GridGain Company Confidential

Rendezvous Affinity: Two Nodes to Three

Page 18: Scale Out and Conquer: Architectural Decisions Behind Distributed …files.informatandm.com/uploads/2018/10/Scale_Out_and... · 2018-10-12 · Among Top 5 Apache Projects Total number

© 2018 GridGain Systems, Inc. GridGain Company Confidential

Rendezvous Affinity: Distribute Evenly at Best

Page 19: Scale Out and Conquer: Architectural Decisions Behind Distributed …files.informatandm.com/uploads/2018/10/Scale_Out_and... · 2018-10-12 · Among Top 5 Apache Projects Total number

© 2018 GridGain Systems, Inc. GridGain Company Confidential

Rendezvous Affinity: Possible Distribution

Page 20: Scale Out and Conquer: Architectural Decisions Behind Distributed …files.informatandm.com/uploads/2018/10/Scale_Out_and... · 2018-10-12 · Among Top 5 Apache Projects Total number

© 2018 GridGain Systems, Inc. GridGain Company Confidential

Affinity Collocation – Laid Out in Numbers

Page 21: Scale Out and Conquer: Architectural Decisions Behind Distributed …files.informatandm.com/uploads/2018/10/Scale_Out_and... · 2018-10-12 · Among Top 5 Apache Projects Total number

© 2018 GridGain Systems, Inc. GridGain Company Confidential

Running Transaction: No Collocation

1: class Account {

2: long id;

3: long city;

4: }

Page 22: Scale Out and Conquer: Architectural Decisions Behind Distributed …files.informatandm.com/uploads/2018/10/Scale_Out_and... · 2018-10-12 · Among Top 5 Apache Projects Total number

© 2018 GridGain Systems, Inc. GridGain Company Confidential

Running Transaction: No Collocation

Page 23: Scale Out and Conquer: Architectural Decisions Behind Distributed …files.informatandm.com/uploads/2018/10/Scale_Out_and... · 2018-10-12 · Among Top 5 Apache Projects Total number

© 2018 GridGain Systems, Inc. GridGain Company Confidential

Non Collocated Data: Number of Operations

2 (2 nodes)

Page 24: Scale Out and Conquer: Architectural Decisions Behind Distributed …files.informatandm.com/uploads/2018/10/Scale_Out_and... · 2018-10-12 · Among Top 5 Apache Projects Total number

© 2018 GridGain Systems, Inc. GridGain Company Confidential

Non Collocated Data: Number of Operations

2 (2 nodes)

2 (primary + backup)

Page 25: Scale Out and Conquer: Architectural Decisions Behind Distributed …files.informatandm.com/uploads/2018/10/Scale_Out_and... · 2018-10-12 · Among Top 5 Apache Projects Total number

© 2018 GridGain Systems, Inc. GridGain Company Confidential

Non Collocated Data: Number of Operations

2 (2 nodes)

2 (primary + backup)

2 (two-phase commit)

Page 26: Scale Out and Conquer: Architectural Decisions Behind Distributed …files.informatandm.com/uploads/2018/10/Scale_Out_and... · 2018-10-12 · Among Top 5 Apache Projects Total number

© 2018 GridGain Systems, Inc. GridGain Company Confidential

Non Collocated Data: Number of Operations

2 (2 nodes)

2 (primary + backup)

2 (two-phase commit)

2 (request-response)

--

16 network operations

Page 27: Scale Out and Conquer: Architectural Decisions Behind Distributed …files.informatandm.com/uploads/2018/10/Scale_Out_and... · 2018-10-12 · Among Top 5 Apache Projects Total number

© 2018 GridGain Systems, Inc. GridGain Company Confidential

Network Operations!

Page 28: Scale Out and Conquer: Architectural Decisions Behind Distributed …files.informatandm.com/uploads/2018/10/Scale_Out_and... · 2018-10-12 · Among Top 5 Apache Projects Total number

© 2018 GridGain Systems, Inc. GridGain Company Confidential

Running Transaction: Collocated Data

1: class Account{

2: long id;

3:

4: @AffinityKeyMapped

5: long city;

6: }

Page 29: Scale Out and Conquer: Architectural Decisions Behind Distributed …files.informatandm.com/uploads/2018/10/Scale_Out_and... · 2018-10-12 · Among Top 5 Apache Projects Total number

© 2018 GridGain Systems, Inc. GridGain Company Confidential

Running Transaction: Collocated Data!

Page 30: Scale Out and Conquer: Architectural Decisions Behind Distributed …files.informatandm.com/uploads/2018/10/Scale_Out_and... · 2018-10-12 · Among Top 5 Apache Projects Total number

© 2018 GridGain Systems, Inc. GridGain Company Confidential

Collocated Data: Number of Operations

1 (1 node)

Page 31: Scale Out and Conquer: Architectural Decisions Behind Distributed …files.informatandm.com/uploads/2018/10/Scale_Out_and... · 2018-10-12 · Among Top 5 Apache Projects Total number

© 2018 GridGain Systems, Inc. GridGain Company Confidential

Collocated Data: Number of Operations

1 (1 node)

2 (primary + backup)

Page 32: Scale Out and Conquer: Architectural Decisions Behind Distributed …files.informatandm.com/uploads/2018/10/Scale_Out_and... · 2018-10-12 · Among Top 5 Apache Projects Total number

© 2018 GridGain Systems, Inc. GridGain Company Confidential

Collocated Data: Number of Operations

1 (1 node)

2 (primary + backup)

1 (one-phase commit)

Page 33: Scale Out and Conquer: Architectural Decisions Behind Distributed …files.informatandm.com/uploads/2018/10/Scale_Out_and... · 2018-10-12 · Among Top 5 Apache Projects Total number

© 2018 GridGain Systems, Inc. GridGain Company Confidential

Collocated Data: Number of Operations

1 (1 node)

2 (primary + backup)

1 (one-phase commit)

2 (request-response)

--

4 network operations

Page 34: Scale Out and Conquer: Architectural Decisions Behind Distributed …files.informatandm.com/uploads/2018/10/Scale_Out_and... · 2018-10-12 · Among Top 5 Apache Projects Total number

© 2018 GridGain Systems, Inc. GridGain Company Confidential

Let’s Run an SQL Query – No Collocation

Page 35: Scale Out and Conquer: Architectural Decisions Behind Distributed …files.informatandm.com/uploads/2018/10/Scale_Out_and... · 2018-10-12 · Among Top 5 Apache Projects Total number

© 2018 GridGain Systems, Inc. GridGain Company Confidential

Executing SQL: Full Scan

• 1/3x latency

• 3x throughput

Page 36: Scale Out and Conquer: Architectural Decisions Behind Distributed …files.informatandm.com/uploads/2018/10/Scale_Out_and... · 2018-10-12 · Among Top 5 Apache Projects Total number

© 2018 GridGain Systems, Inc. GridGain Company Confidential

What About Indexes?

Page 37: Scale Out and Conquer: Architectural Decisions Behind Distributed …files.informatandm.com/uploads/2018/10/Scale_Out_and... · 2018-10-12 · Among Top 5 Apache Projects Total number

© 2018 GridGain Systems, Inc. GridGain Company Confidential

Index Search Complexity

log 1_000_000 ≈ 20

vs.

log 333_333 ≈ 18

log 333_333 ≈ 18

log 333_333 ≈ 18

Page 38: Scale Out and Conquer: Architectural Decisions Behind Distributed …files.informatandm.com/uploads/2018/10/Scale_Out_and... · 2018-10-12 · Among Top 5 Apache Projects Total number

© 2018 GridGain Systems, Inc. GridGain Company Confidential

Executing SQL: Indexes Search

• ~same latency

• ~same throughput

Page 39: Scale Out and Conquer: Architectural Decisions Behind Distributed …files.informatandm.com/uploads/2018/10/Scale_Out_and... · 2018-10-12 · Among Top 5 Apache Projects Total number

© 2018 GridGain Systems, Inc. GridGain Company Confidential

Let’s Collocate and Run SQL Again

Page 40: Scale Out and Conquer: Architectural Decisions Behind Distributed …files.informatandm.com/uploads/2018/10/Scale_Out_and... · 2018-10-12 · Among Top 5 Apache Projects Total number

© 2018 GridGain Systems, Inc. GridGain Company Confidential

Executing SQL: Indexed Search and Collocation

• same latency

• 3x throughput

Page 41: Scale Out and Conquer: Architectural Decisions Behind Distributed …files.informatandm.com/uploads/2018/10/Scale_Out_and... · 2018-10-12 · Among Top 5 Apache Projects Total number

© 2018 GridGain Systems, Inc. GridGain Company Confidential

Multi-threading of Distributed Systems – Things to Know

Page 42: Scale Out and Conquer: Architectural Decisions Behind Distributed …files.informatandm.com/uploads/2018/10/Scale_Out_and... · 2018-10-12 · Among Top 5 Apache Projects Total number

© 2018 GridGain Systems, Inc. GridGain Company Confidential

How Requests/Tasks/Queries Processed?

Page 43: Scale Out and Conquer: Architectural Decisions Behind Distributed …files.informatandm.com/uploads/2018/10/Scale_Out_and... · 2018-10-12 · Among Top 5 Apache Projects Total number

© 2018 GridGain Systems, Inc. GridGain Company Confidential

Requests Processing: Bottleneck!

Page 44: Scale Out and Conquer: Architectural Decisions Behind Distributed …files.informatandm.com/uploads/2018/10/Scale_Out_and... · 2018-10-12 · Among Top 5 Apache Projects Total number

© 2018 GridGain Systems, Inc. GridGain Company Confidential

Making Situation Worse

Page 45: Scale Out and Conquer: Architectural Decisions Behind Distributed …files.informatandm.com/uploads/2018/10/Scale_Out_and... · 2018-10-12 · Among Top 5 Apache Projects Total number

© 2018 GridGain Systems, Inc. GridGain Company Confidential

Cluster Node Chokes!

Page 46: Scale Out and Conquer: Architectural Decisions Behind Distributed …files.informatandm.com/uploads/2018/10/Scale_Out_and... · 2018-10-12 · Among Top 5 Apache Projects Total number

© 2018 GridGain Systems, Inc. GridGain Company Confidential

Tread-Per-Partition and Workers

Page 47: Scale Out and Conquer: Architectural Decisions Behind Distributed …files.informatandm.com/uploads/2018/10/Scale_Out_and... · 2018-10-12 · Among Top 5 Apache Projects Total number

© 2018 GridGain Systems, Inc. GridGain Company Confidential

Thread-Per-Partition and I/O Queues

Page 48: Scale Out and Conquer: Architectural Decisions Behind Distributed …files.informatandm.com/uploads/2018/10/Scale_Out_and... · 2018-10-12 · Among Top 5 Apache Projects Total number

© 2018 GridGain Systems, Inc. GridGain Company Confidential

Thread-Per-Partition: Not a Magic Bullet

Page 49: Scale Out and Conquer: Architectural Decisions Behind Distributed …files.informatandm.com/uploads/2018/10/Scale_Out_and... · 2018-10-12 · Among Top 5 Apache Projects Total number

© 2018 GridGain Systems, Inc. GridGain Company Confidential

Thread-Per-Partition: Not a Magic Bullet

Page 50: Scale Out and Conquer: Architectural Decisions Behind Distributed …files.informatandm.com/uploads/2018/10/Scale_Out_and... · 2018-10-12 · Among Top 5 Apache Projects Total number

© 2018 GridGain Systems, Inc. GridGain Company Confidential

Upshot

Page 51: Scale Out and Conquer: Architectural Decisions Behind Distributed …files.informatandm.com/uploads/2018/10/Scale_Out_and... · 2018-10-12 · Among Top 5 Apache Projects Total number

© 2018 GridGain Systems, Inc. GridGain Company Confidential

Upshot

• Partitioning – it’s not about even distribution only

• Affinity Collocation – a golden concept of distributed systems

• Business Data Model should be adopted/reconsidered

• Thread-per-partition – speeds up most but not all usage scenarios

Page 52: Scale Out and Conquer: Architectural Decisions Behind Distributed …files.informatandm.com/uploads/2018/10/Scale_Out_and... · 2018-10-12 · Among Top 5 Apache Projects Total number

© 2018 GridGain Systems, Inc. GridGain Company Confidential

These Days in New York

Docker NYC Meetup, Tomorrow, 6:00 PM

• Location: PeerSpace, 1740 Broadway, 15th Floor

• Distributed Database DevOps Dilemmas?

Kubernetes to the rescue

https://ignite.apache.org/events.html

Page 53: Scale Out and Conquer: Architectural Decisions Behind Distributed …files.informatandm.com/uploads/2018/10/Scale_Out_and... · 2018-10-12 · Among Top 5 Apache Projects Total number

© 2018 GridGain Systems, Inc. GridGain Company Confidential

Any Questions?

#apacheignite

#TheASF

Thank you for joining us. Follow the conversation.https://ignite.apache.org

#gridgain

#denismagda

https://www.meetup.com/NYC-In-Memory-Computing-Meetup/