23
7 Deadly Sins for Cassandra Ops Rachel Pedreschi DSE Evangelist, Datastax

DataStax: 7 Deadly Sins for Cassandra Ops

Embed Size (px)

Citation preview

Page 1: DataStax: 7 Deadly Sins for Cassandra Ops

7 Deadly Sins for Cassandra OpsRachel Pedreschi

DSE Evangelist, Datastax

Page 2: DataStax: 7 Deadly Sins for Cassandra Ops

2© 2015. All Rights Reserved.

Page 3: DataStax: 7 Deadly Sins for Cassandra Ops

Lust

3© 2015. All Rights Reserved.

#1 USE THE SIMPLE SNITCH

Page 4: DataStax: 7 Deadly Sins for Cassandra Ops

So many snitches…

4© 2015. All Rights Reserved.

• SimpleSnitch • RackInferringSnitch • PropertyFileSnitch • GossipingPropertyFileSnitch • Ec2Snitch • Ec2MultiRegionSnitch • GoogleCloudSnitch • CloudstackSnitch

Page 5: DataStax: 7 Deadly Sins for Cassandra Ops

Switching snitches

5© 2015. All Rights Reserved.

If the topology of the network has changed: -Shut down all the nodes, then restart them. -Run a sequential repair and nodetool cleanup on each node.

DOWNTIME ALERT!!!!

Page 6: DataStax: 7 Deadly Sins for Cassandra Ops

Greed

6© 2015. All Rights Reserved.

#3 NOT UNDERSTANDING

REPAIR

Page 7: DataStax: 7 Deadly Sins for Cassandra Ops

Repair options

7© 2015. All Rights Reserved.

repair (default, check your version!) repair -pr (only repair the primary range) repair -inc (only new data that has not previously been repaired) sequential repair (creates snapshots) parallel repair uses replica not being repaired

Page 8: DataStax: 7 Deadly Sins for Cassandra Ops

Envy

8© 2015. All Rights Reserved.

#3 CHOOSE THE WRONG

COMPACTION STRATEGY FOR

YOUR WORKLOAD

Page 9: DataStax: 7 Deadly Sins for Cassandra Ops

Sized Tiered

9© 2015. All Rights Reserved.

SST1 SST1 SST2 SST1 SST2 SST3 SST1 SST2 SST3 SST4 SST5

FLUSHFLUSH

FLUSH FLUSH

COMPACT

SST5 SST6 SST5 SST6 SST7 SST5 SST6 SST7 SST8 SST5 SST10

FLUSH FLUSH FLUSH

SST5 SST6 SST7 SST8

FLUSH

SST9

COMPACT

Compacts a set number of SSTables into a single, larger SSTable

Page 10: DataStax: 7 Deadly Sins for Cassandra Ops

Leveled

10© 2015. All Rights Reserved.

Level 0

Level 1

10

Level 2100

Level 3

1,000

Level 410,000

Level 5100,000

… Level 6, 7, etc.

Page 11: DataStax: 7 Deadly Sins for Cassandra Ops

Date Tiered

11© 2015. All Rights Reserved. https://labs.spotify.com/2014/12/18/date-tiered-compaction/

Page 12: DataStax: 7 Deadly Sins for Cassandra Ops

Gluttony

12© 2015. All Rights Reserved.

#4 CHOOSING THE WRONG

HARDWARE

Page 13: DataStax: 7 Deadly Sins for Cassandra Ops

13© 2015. All Rights Reserved.

CPU

RAM

DISK

Page 14: DataStax: 7 Deadly Sins for Cassandra Ops

14© 2015. All Rights Reserved.

• 2 socket, ECC memory • 16GiB minimum, prefer 32-64GiB, over 128GiB and Linux will need

serious tuning

• SSD where possible, Samsung 840 Pro is a good choice, any Intel is fine

• NO SAN/NAS, 20ms latency tops • if you MUST (and please, don’t) dedicate spindles to C* nodes, use

separate network

• Avoid disk configurations targeted at Hadoop, disks are too slow

Page 15: DataStax: 7 Deadly Sins for Cassandra Ops

Sloth

15© 2015. All Rights Reserved.

#5 NOT TUNING YOUR OS

Page 16: DataStax: 7 Deadly Sins for Cassandra Ops

/etc/rc.local

16© 2015. All Rights Reserved.

ra=$((2**14))# 16kss=$(blockdev --getss /dev/sda)blockdev --setra $(($ra / $ss)) /dev/sda

echo 128 > /sys/block/sda/queue/nr_requestsecho deadline > /sys/block/sda/queue/schedulerecho 16384 > /sys/block/md7/md/stripe_cache_size

Page 17: DataStax: 7 Deadly Sins for Cassandra Ops

/etc/sysctl.conf

17© 2015. All Rights Reserved.

fs.file-max = 1048576vm.max_map_count = 1048576net.core.rmem_max = 16777216net.core.wmem_max = 16777216net.ipv4.tcp_rmem = 4096 65536 16777216net.ipv4.tcp_wmem = 4096 65536 16777216vm.swappiness = 1

Page 18: DataStax: 7 Deadly Sins for Cassandra Ops

Wrath

18© 2015. All Rights Reserved.

#6 OVER OR UNDERSIZING

YOUR JVM

Page 19: DataStax: 7 Deadly Sins for Cassandra Ops

G1 or CMS?

19© 2015. All Rights Reserved.

• Cassandra 8150 vs 7486 • Larger heap? Look into using G1 • Read the Docs • Test, test and did I mention, test?

Page 20: DataStax: 7 Deadly Sins for Cassandra Ops

Pride

20© 2015. All Rights Reserved.

#7 NOT STRESS TESTING

Page 21: DataStax: 7 Deadly Sins for Cassandra Ops

cassandra-stress .yaml (>= 2.1)

21© 2015. All Rights Reserved.

1. DDL – for defining your schema 2. Column Distributions – for defining the shape and size of each

column globally and within each partition 3. Insert Distributions – for defining how the data is written during the

stress test 4. DML – for defining how the data is queried during the stress test

Page 22: DataStax: 7 Deadly Sins for Cassandra Ops

Recommended Sessions

22© 2015. All Rights Reserved.

DataStax Making Cassandra Fail (for effective testing) 3:30 Thursday Ballroom H

Pythian Manage your compactions before they manage you 4:20 Ballroom H

The Last Pickle Steady State Data Size with Compaction, Tombstones, and TTL 4:20 Great America #2 Wednesday

Crowdstrike, Inc. Real World DTCS For Operators

Page 23: DataStax: 7 Deadly Sins for Cassandra Ops

Thank you@RachelPedreschi