Speaker: Al Tobey, Open Source Mechanic at DataStax
Video: http://www.youtube.com/watch?v=AcPME94F13U&list=PLqcm6qE9lgKLoYaakl3YwIWP4hmGsHm5e&index=24
Ooyala has been using Apache Cassandra since version 0.4. Our data ingest volume has exploded since 0.4 and Cassandra has scaled along with us. Al will cover many topics from an operational perspective on how to manage, tune, and scale Cassandra in a production environment.
2. Outline
⁍ About me
⁍ How not to manage your Cassandra clusters
⁍ Make it better
⁍ How to be a heuristician
⁍ Tools of the trade
⁍ More Settings
⁍ Show & Tell
#CASSANDRAEU
!2
3. Previously: @AlTobey / Ooyala
⁍ Tech Lead, Compute and Data Services at Ooyala, Inc.
⁍ C&D team is #devops: 3 ops, 3 eng, me
⁍ C&D team is #bdaas: Big Data as a Service
⁍ ~200 Cassandra nodes, expanding quickly
#CASSANDRAEU
!3
4. Ooyala
⁍ Founded in 2007
⁍ 230+ employees globally
⁍ 200M unique users,110+ countries
⁍ Over 1 billion videos played per month
⁍ Over 2 billion analytic events per day
#CASSANDRAEU
!4
5. Ooyala & Cassandra
Ooyala has been using Cassandra since v0.4
Use cases:
⁍ Analytics data (real-time and batch)
⁍ Highly available K/V store
⁍ Time series data
⁍ Play head tracking (cross-device resume)
⁍ Machine Learning Data
#CASSANDRAEU
!5
7. Avoiding read-modify-write
cassandra13_drinks column family
Albert
Tuesday
6
Wednesday
0
Evan
Tuesday
0
Wednesday
0
Frank
Tuesday
3
Wednesday
3
Kelvin
Tuesday
0
Wednesday
0
Krzysztof
Tuesday
0
Wednesday
0
Phillip
Tuesday
12
Wednesday
0
memTable
#CASSANDRAEU
!7
8. Avoiding read-modify-write
cassandra13_drinks column family
Al
Tuesday
2
Wednesday
0
Phillip
Tuesday
0
Wednesday
1
Albert
Tuesday
6
Wednesday
0
Evan
Tuesday
0
Wednesday
0
Frank
Tuesday
3
Wednesday
3
Kelvin
Tuesday
0
Wednesday
0
Krzysztof
Tuesday
0
Wednesday
0
Phillip
Tuesday
12
Wednesday
0
memTable
ssTable
#CASSANDRAEU
!8
9. Avoiding read-modify-write
cassandra13_drinks column family
memTable
Albert
Tuesday
22
Wednesday
0
Albert
Tuesday
2
Wednesday
0
Phillip
Tuesday
0
Wednesday
1
Albert
Tuesday
6
Wednesday
0
Evan
Tuesday
0
Wednesday
0
Frank
Tuesday
3
Wednesday
3
Kelvin
Tuesday
0
Wednesday
0
Krzysztof
Tuesday
0
Wednesday
0
Phillip
Tuesday
12
Wednesday
0
ssTable
ssTable
#CASSANDRAEU
!9
10. Avoiding read-modify-write
cassandra13_drinks column family
Albert
Tuesday
22
Wednesday
0
Evan
Tuesday
0
Wednesday
0
Frank
Tuesday
3
Wednesday
3
Kelvin
Tuesday
0
Wednesday
0
Krzysztof
Tuesday
0
Wednesday
0
Phillip
Tuesday
0
Wednesday
1
ssTable
#CASSANDRAEU
!10
11. 2011: 0.6 ➜ 0.8
cassandra
cassandra
GlusterFS P2P
hadoop
Thrift
Scala Map/Reduce
⁍ Migration is still a largely unsolved problem
⁍ Wrote a tool in Scala to scrub data and write via Thrift
⁍ Rebuilt indexes - faster than copying
#CASSANDRAEU
!11
12. Changes: 0.6 ➜ 0.8
⁍ Cassandra 0.8
⁍ 24GiB heap
⁍ Sun Java 1.6 update
⁍ Linux 2.6.36
⁍ XFS on MD RAID5
⁍ Disabled swap or at least vm.swappiness=1
#CASSANDRAEU
!12
16. 2013: Datacenter Move
⁍ 36 nodes ➜ lots more nodes
⁍ As usual, no downtime!
DSE 3.1
DSE 3.1
replication
#CASSANDRAEU
!16
17. Coming Soon for Cassandra at Ooyala
Upcoming use cases:
⁍ Store every event from the players at full resolution
⁍ Cache code for the Spark job server
⁍ AMPLab Tachyon backend?
#CASSANDRAEU
!17
18. Next Generation Architecture: Ooyala Event Store
player
loggers
kafka
API
job server
ingest
spark
Tachyon?
DSE 3.1
#CASSANDRAEU
!18
19. There’s more to tuning than performance:
⁍ Security
⁍ Cost of Goods Sold
⁍ Operations / support
⁍ Developer happiness
⁍ Physical capacity (cpu/memory/network/disk)
⁍ Reliability / Resilience
⁍ Compromise
#CASSANDRAEU
!19
20. I am not a scientist ... heuristician?
⁍ I’d love to be more scientific, but good science takes time
⁍ Sometimes you have to make educated guesses
⁍ It’s not as difficult as it’s made out to be
⁍ Your brain is great at heuristics. Trust it.
⁍ Concentrate on bottlenecks
⁍ Make incremental changes
⁍ Read Malcom Gladwell’s “Blink”
#CASSANDRAEU
!20
21. Testing Shiny Things
⁍ Like kernels
⁍ And Linux distributions
⁍ And ZFS
⁍ And btrfs
⁍ And JVM’s & parameters
⁍ Test them in production (if you must)
#CASSANDRAEU
!21
22. Testing Shiny Things: In Production
ext4
btrfs
ext4
ext4
ext4
kernel
upgrade
ZFS
ext4
#CASSANDRAEU
!22
37. JVM Args
-Xmx8G leave it alone
-Xms8G leave it alone
-Xmn1200M 100MiB * nCPU
-Xss180k should be fine
!
-XX:+UseNUMA (test it)
numactl --interleave (safe option)
#CASSANDRAEU
!37
38. cgroups
Provides fine-grained control over Linux resources
⁍ Makes the Linux scheduler behave
⁍ Lets you manage systems under extreme load
⁍ Useful on all Linux machines
⁍ Can choose between determinism and flexibility
#CASSANDRAEU
!38
41. Successful Experiment: ZFS on Linux
zpool create data raidz /dev/sd[c-h]
zfs create data/cassandra
zfs set compression=lzjb data/cassandra
zfs set atime=off data/cassandra
zfs set primarycache=metadata data/cassandra
#CASSANDRAEU
!41
42. Conclusions
⁍ Tuning is multi-dimensional
⁍ Production load is your most important benchmark
⁍ Lean on Cassandra, experiment!
⁍ No one metric tells the whole story
#CASSANDRAEU
!42