Building Consistent and Highly Available Distributed Systems with Apache Ignite and GridGain

Valentin Kulichenko GridGain Lead Architect & Apache Ignite PMC

© 2017 GridGain Systems, Inc. Agenda

• What is Ignite/GridGain? • Ignite/GridGain and CAP Theorem • High Availability in Ignite/GridGain • Cache Backups • Persistence • Data Center Replication • Data Snapshots (+Demo) • Q&A

© 2017 GridGain Systems, Inc. the in-memory that is durable, strongly consistent and highly available with powerful SQL, key-value and processing APIs

© 2017 GridGain Systems, Inc. GridGain In-Memory Computing Platform

Financial Telco Travel & E-Commerce Pharma & IoT Services Logistics Healthcare & Recovery SQL Key/Value Transactions Compute Services Streaming ML

Memory-Centric Storage Security & Auditing Security & Data Center Replication Monitoring & Management Data Snapshots Ignite Native Persistence Third-Party Persistence (Flash, SSD, Intel 3D XPoint) (RDBMS, HDFS, NoSQL)

© 2017 GridGain Systems, Inc. Data Grid

JCache & SQL JCache Transactions Compute SQL ACID Transaction

Distributed partitioned Distributed Key-Value Store hash map DURABLE MEMORY DURABLE MEMORY DURABLE MEMORY RDBMS Dynamic HDFS Scaling NoSQL

Server Node Server Node Server Node 3rd party storage caching

© 2017 GridGain Systems, Inc. Distributed SQL

Cross-platform .NET C++ BI Tools Compatibility

SELECT, UPDATE, DDL, DML Support JDBC ODBC SQL API INSERT, MERGE, DELETE, CREATE and ALTER

Apache Ignite Cluster

Indexes in DURABLE MEMORY DURABLE MEMORY DURABLE MEMORY Dynamic RAM or Disk Scaling

Server Node Server Node Server Node

© 2017 GridGain Systems, Inc. GridGain and CAP Theorem

• CAP • Consistency (C) • Availability (A) C • Partition Tolerance (P) • Impossible: CAP A? • Most of distributed systems are CP or AP • GridGain • Strongly CP P • But still highly available?

© 2017 GridGain Systems, Inc. Cache Backups

Ignite Node Ignite Node

A D B C C B A D

Ignite Node Ignite Node

C B D A D A B C

© 2017 GridGain Systems, Inc. Rack Safety: Problem

Client

Switch Switch

Ignite Node Ignite Node

A C C D

Ignite Node Ignite Node

B A D B

Partition A is lost! © 2017 GridGain Systems, Inc. Rack Safety: Solution

• Assign attribute to each node: • Implement affinity backup filter: public class RackFilter implements IgniteBiPredicate> { @Override public boolean apply(ClusterNode candidate, List assigned) { String candidateRack = candidate.attribute("rack"); String primaryRack = assigned.get(0).attribute("rack");

return !Objects.equals(candidateRack, primaryRack); } }

© 2017 GridGain Systems, Inc. Rack Safety: Solved!

Client

Switch Switch

Ignite Node Ignite Node

A D C A

Ignite Node Ignite Node

B C D B

No partitions lost © 2017 GridGain Systems, Inc. Persistence

Ignite Cluster

Ignite Node Ignite Node Ignite Node

RDBMS HDFS NoSQL

© 2017 GridGain Systems, Inc. Durable Memory

Automatic Defragmentation Ignite Cluster Predictable memory Off-heap Removes consumption DURABLE MEMORY DURABLE MEMORY DURABLE MEMORY noticeable GC pauses

Fully Transactional Stores Superset (Write-Ahead Log) of Data

Instantaneous Server Node Server Node Server Node Restarts

© 2017 GridGain Systems, Inc. Ignite Native Persistence

Server Node

1. Update 2. Persist Write-Ahead Log

3. Ack

RAM Partition File 1 4. Checkpointing

Partition File N

© 2017 GridGain Systems, Inc. GridGain Data Center Replication

Active-Passive Replication for Disaster Recovery DC1 DC2 Split-Brain DC5 Resolution

DC4 Active-Active Bi-Directional Replication

DC3

© 2017 GridGain Systems, Inc. Data Snapshots & Recovery

Full & Incremental Backups

GridGain Cluster Backup Data & Indexes External Store DURABLE MEMORY DURABLE MEMORY DURABLE MEMORY

Restore Server Node Server Node Server Node

Managed Backup Schedules

© 2017 GridGain Systems, Inc. Any Questions?

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

@apacheignite @vkulichenko

© 2017 GridGain Systems, Inc.