Transcript
Page 1: Cassandra Summit 2014: Active-Active Cassandra Behind the Scenes
Page 2: Cassandra Summit 2014: Active-Active Cassandra Behind the Scenes

ABOUT NETFLIX!

Page 3: Cassandra Summit 2014: Active-Active Cassandra Behind the Scenes

NETFLIX

Page 4: Cassandra Summit 2014: Active-Active Cassandra Behind the Scenes
Page 5: Cassandra Summit 2014: Active-Active Cassandra Behind the Scenes

ACTIVE - ACTIVE!

Page 6: Cassandra Summit 2014: Active-Active Cassandra Behind the Scenes

WHAT IS ACTIVE ACTIVE?

Also called dual active, it is a phrase used to describe a network of independent processing nodes where each node has access to replicated database. Traffic intended for a failed node is either passed onto an existing node or load balanced across the remaining nodes.

Page 7: Cassandra Summit 2014: Active-Active Cassandra Behind the Scenes

WHY ACTIVE-ACTIVE ?!

ENTERPISE IT SOLUTIONS

WEB SCALE CLOUD

SOLUTIONS

RAPID SCALING

HIGH AVAILABILITY

Page 8: Cassandra Summit 2014: Active-Active Cassandra Behind the Scenes

DOES AN INSTANCE FAIL?!•  It can, plan for it!•  Bad code / configuration pushes!•  Latent issues!•  Hardware failure!•  Test with Chaos Monkey!

Page 9: Cassandra Summit 2014: Active-Active Cassandra Behind the Scenes

DOES A ZONE FAIL?!•  Rarely, but happened before!•  Routing issues!•  DC-specific issues!•  App-specific issues within a zone!•  Test with Chaos Gorilla!

Page 10: Cassandra Summit 2014: Active-Active Cassandra Behind the Scenes

DOES A REGION FAIL?!

•  Full region – unlikely, very rare!•  Individual Services can fail region-wide!•  Most likely, a region-wide configuration issues!•  Test with Chaos Kong!

Page 11: Cassandra Summit 2014: Active-Active Cassandra Behind the Scenes

EVERYTHING FAILS… EVENTUALLY!

•  Keep your services running by embracing isolation and redundancy!

•  Construct a highly agile and highly available service from ephemeral and assumed broken components!

Page 12: Cassandra Summit 2014: Active-Active Cassandra Behind the Scenes

ISOLATION!

•  Changes in one region should not affect others!•  Regional outage should not affect others!•  Network partitioning between regions should not affect

functionality / operations!

Page 13: Cassandra Summit 2014: Active-Active Cassandra Behind the Scenes

REDUNDANCY!

•  Make more than one (of pretty much everything)!•  Specifically, distribute services across Availability

Zones and regions!

Page 14: Cassandra Summit 2014: Active-Active Cassandra Behind the Scenes

HISTORY: X-MAS EVE 2012!

•  Netflix multi-hour outage!•  US-East1 regional Elastic Load Balancing issue!!•  “...data was deleted by a maintenance process

that was inadvertently run against the production ELB state data”!

Page 15: Cassandra Summit 2014: Active-Active Cassandra Behind the Scenes

ACTIVE-ACTIVE ARCHITECTURE!

Page 16: Cassandra Summit 2014: Active-Active Cassandra Behind the Scenes
Page 17: Cassandra Summit 2014: Active-Active Cassandra Behind the Scenes
Page 18: Cassandra Summit 2014: Active-Active Cassandra Behind the Scenes

THE PROCESS!

Page 19: Cassandra Summit 2014: Active-Active Cassandra Behind the Scenes

IDENTIFYING CLUSTERS FOR AA !

Page 20: Cassandra Summit 2014: Active-Active Cassandra Behind the Scenes

SNITCH CHANGES!

EC2Snitch! EC2MultiRegionSnitch!

Uses Private IPs! Uses Public IPs!

Page 21: Cassandra Summit 2014: Active-Active Cassandra Behind the Scenes

PRIAM.MULTIREGION.ENABLE =TRUE!

storage_port : Using Private IPs!

ssl_storage_port : Using Public IPs!

Page 22: Cassandra Summit 2014: Active-Active Cassandra Behind the Scenes
Page 23: Cassandra Summit 2014: Active-Active Cassandra Behind the Scenes

SPIN UP NODES IN NEW REGION!

us-east-1! us-west-2!

APP

Page 24: Cassandra Summit 2014: Active-Active Cassandra Behind the Scenes

UPDATE KEYSPACE!

Update keyspace <keyspace> with placement_strategy = 'NetworkTopologyStrategy'! and strategy_options = {us-east : 3, us-west-2 : 3};!

Existing region and replication factor ! New region and replication factor!

Page 25: Cassandra Summit 2014: Active-Active Cassandra Behind the Scenes

REBUILD NEW REGION

Run – nodetool rebuild us-east-1 on all us-west-2 nodes

Page 26: Cassandra Summit 2014: Active-Active Cassandra Behind the Scenes

RUN NODETOOL REPAIR

Page 27: Cassandra Summit 2014: Active-Active Cassandra Behind the Scenes

VALIDATION!

Page 28: Cassandra Summit 2014: Active-Active Cassandra Behind the Scenes

BENCHMARKING GLOBAL CASSANDRA WRITE INTENSIVE TEST OF CROSS-REGION REPLICATION

CAPACITY 16 X HI1.4XLARGE SSD NODES PER ZONE = 96 TOTAL 192 TB OF SSD IN SIX LOCATIONS UP AND RUNNING

CASSANDRA IN 20 MINUTES!

Cassandra Replicas

Zone A

Cassandra Replicas

Zone B

Cassandra Replicas

Zone C

US-West-2 Region - Oregon

Cassandra Replicas

Zone A

Cassandra Replicas

Zone B

Cassandra Replicas

Zone C

US-East-1 Region - Virginia

Test Load

Test Load

Validation Load

Interzone Traffic 18TB Backup Restored from S3 using Priam

1 Million Writes!CL.ONE (Wait for One Replica to ack)!

1 Million Reads!after 500 ms!CL.ONE with No!Data Loss!

Interregional Traffic!Up to 9Gbits/s, 83ms! 18 TB backups

from S3

Page 29: Cassandra Summit 2014: Active-Active Cassandra Behind the Scenes

TEST FOR THUNDERING HERD!

Page 30: Cassandra Summit 2014: Active-Active Cassandra Behind the Scenes

TEST FOR RETRIES!

FAILURE RETRY

Page 31: Cassandra Summit 2014: Active-Active Cassandra Behind the Scenes

KEY METRICS USED!

•  99 /95 th Read Latency (Client & C*)!•  Dropped Metrics on C*!•  Exceptions on C*!•  Heap Usage on C*!•  Threads Pending on C*!

Page 32: Cassandra Summit 2014: Active-Active Cassandra Behind the Scenes

CONFIGURATION FOR TEST!

•  24 Node C* SSDs!•  220 Client instances!•  70+ Jmeter Instances!

Page 33: Cassandra Summit 2014: Active-Active Cassandra Behind the Scenes

C* IOPS

Page 34: Cassandra Summit 2014: Active-Active Cassandra Behind the Scenes

TOTAL READ IOPS

TOTAL WRITE IOPS

Page 35: Cassandra Summit 2014: Active-Active Cassandra Behind the Scenes

95th LATENCY

99th LATENCY

Page 36: Cassandra Summit 2014: Active-Active Cassandra Behind the Scenes

CHECK FOR CEILING!

Page 37: Cassandra Summit 2014: Active-Active Cassandra Behind the Scenes

NETWORK PARTITION!

us-east-1 us-west-2

Page 38: Cassandra Summit 2014: Active-Active Cassandra Behind the Scenes

TAKEAWAYS!

Page 39: Cassandra Summit 2014: Active-Active Cassandra Behind the Scenes

REPAIRS AFTER EXTENSION ARE PAINFUL !!!

Page 40: Cassandra Summit 2014: Active-Active Cassandra Behind the Scenes

TIME TO REPAIR DEPENDS ON!

•  Number of regions!•  Number of replicas!•  Data size!•  Amount of entropy!!

Page 41: Cassandra Summit 2014: Active-Active Cassandra Behind the Scenes

ADJUST GC_GRACE AFTER EXTENSION!•  Column Family Setting!•  Defined in seconds!•  Default 10 days!•  Tweak gc_grace settings to

accommodate time taken to repair!•  BEWARE of deleted columns!

Page 42: Cassandra Summit 2014: Active-Active Cassandra Behind the Scenes

RUNBOOK!

Page 43: Cassandra Summit 2014: Active-Active Cassandra Behind the Scenes

PLAN FOR CAPACITY!

Page 44: Cassandra Summit 2014: Active-Active Cassandra Behind the Scenes

CONSISTENCY LEVEL !

•  Check the client for consistency level setting!•  In a Multiregional cluster QUORUM <>

LOCAL_QUORUM!•  Recommended consistency levels

LOCAL_ONE (CASSANDRA-6202) for reads and LOCAL_QUORUM for writes!

•  For region resiliency avoid – ALL or QUORUM calls!

Page 45: Cassandra Summit 2014: Active-Active Cassandra Behind the Scenes

HOW DO WE KNOW IT WORKS? CREATE CHAOS!!!

Page 46: Cassandra Summit 2014: Active-Active Cassandra Behind the Scenes

Benchmark …!!Time Consuming !!But worth it!!

Page 47: Cassandra Summit 2014: Active-Active Cassandra Behind the Scenes

Recommended