Getting started with Riak in the Cloud
Upcoming SlideShare
Loading in...5

Getting started with Riak in the Cloud



Given at RICON 2012

Given at RICON 2012



Total Views
Views on SlideShare
Embed Views



0 Embeds 0

No embeds



Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
Post Comment
Edit your comment

Getting started with Riak in the Cloud Getting started with Riak in the Cloud Presentation Transcript

  • Getting started withRiak in the Cloud
  • I work with I work with Code! Data!Michael Brodhead Ines Sombra @mojinations @RandomMood
  • AgendaApplication layer Database layer
  • A tale of 2 apps• One brand new (no code written)• One in production running MySQL
  • MultipleRegions
  • MultipleClouds
  • 11
  • The Librariesriak-client• simple Ruby access to Riaks HTTP & protocol buffer APIs
  • The LibrariesRipple• Higher level, ORM interface• ActiveModel based buffer APIs
  • Simplicity
  • The Librariesdm-riak• Already using DataMapper• Hoping for trivial switchover
  • The LibrariesRiak Shim• database.yml• Bucket naming• Hides JSON• 2i
  • Challenges • Unit tests • Data migration • Deployment
  • Testing
  • Testing
  • Deployment
  • Use your app logic
  • How do we get here?
  • “We need aRiak cluster” (@mojinations circa 3 months ago) ... but we have no hardware
  • Let’s do it!
  • Why Riak Product?• Linearly Scalable• Fault-tolerant• Ops friendly• Product lacks HA options
  • Riak @ Engine Yard • We’ll use it first • No custom Chef • Provisioning, configuration, monitoring, & backups
  • Your Choices• Number of nodes• Instance type You are trying to create a Riak cluster. Do you need any help?• Data location• Backend type
  • AWS OpsThe Riak on AWS slide
  • Instances & I/O• Riak’s I/O patterns• Small blobs from many places on disk• EBS best at bulk reads &writes
  • Instance types• m1.large & m1.xlarge• EBS-optimized NEW!• Consider PIOPS NEW!• High I/O Quadruple XL (hi1.4xlarge) - SSDs! NEW!
  • Prepare YourselfMore instances to compensatefor the performance variabilityof virtualized resources
  • Cluster Sizes• 5 nodes or more Best performance & growth• Scales linearly• Don’t be stingy
  • Ring Size• Change default value!• Cannot be reset• Ring size: 256 8/64 vnodes per node• Don’t go above 512
  • Provisioning Riak Cluster App MyRiakCluster: node-0haproxy HTTP or MyRiakCluster: node-1 Protobuff Apphaproxy MyRiakCluster: node-2 App MyRiakCluster: node-3haproxy MyRiakCluster: node-4
  • Disable Swap• Riak process pages should not hit swap• Swap usage can result in unresponsive server• Let the kernel kill it
  • Mount & Scheduler• mount with noatime flag• Use deadline scheduler on EBS cat /sys/block/xvdj1/queue/scheduler noop [deadline] cfq echo deadline > /sys/block/xvdj1/ queue/scheduler
  • Linux Filesystems• xfs, ext3• ext4 • barrier = 0 • data = writeback• ZFS not recommended
  • Backend choices• Bitcask* • help mitigate EBS• LevelDB Can be changed• Memory and optimized!
  • Kernel Optimizations• /etc/sysctl.conf vm.swappiness = 0 net.core.somaxconn= 4000 net.ipv4.tcp_timestamps = 0 net.ipv4.tcp_window_scaling = 1 net.ipv4.tcp_max_syn_backlog = 40000 net.ipv4.tcp_sack = 1 net.ipv4.tcp_fin_timeout = 15 net.ipv4.tcp_keepalive_intvl = 30 net.ipv4.tcp_tw_reuse = 1
  • Monitoring• stats or riak-admin status• Collectd & Nagios• Riaknostic• Riak Control (maybe soon)
  • Backups• Backup both the ring and data directories• Integrate with EY tools• scp or rsync data directory• EBS snapshots
  • Scaling Riak• Verticalriak-admin cluster replace <old> <new>• Horizontal • reduces node load • batch is better
  • Benchmarks
  • Tests• 5-node cluster / 5 hours• 50 concurrent connections• gets 10 /puts 5 /deletes 1• Bitcask backend• Protobuffs protocol
  • Medium - PIOPS 500
  • Medium - PIOPS 1K
  • Medium - EphemeralFAIL!
  • XL - EBS
  • XL -PIOPS 500
  • 4XL - EBS
  • 4XL - PIOPS 1k
  • What’s next?