• Save
Redis on Rails (RedDotRubyConf 2012)
Upcoming SlideShare
Loading in...5
×
 

Redis on Rails (RedDotRubyConf 2012)

on

  • 12,462 views

 

Statistics

Views

Total Views
12,462
Views on SlideShare
3,541
Embed Views
8,921

Actions

Likes
7
Downloads
0
Comments
0

22 Embeds 8,921

http://blog.obiefernandez.com 8763
http://feeds.feedburner.com 28
http://rubyonrails.collected.info 24
http://localhost 24
https://twitter.com 21
http://theoldreader.com 15
http://webcache.googleusercontent.com 9
http://translate.googleusercontent.com 6
http://dashboard.bloglines.com 5
http://www.typepad.com 4
http://newsblur.com 4
http://www.newsblur.com 3
http://web.archive.org 3
http://blog.obiefernandez.com. 2
http://www.hanrss.com 2
http://xss.yandex.net 2
https://si0.twimg.com 1
http://www.ranksit.com 1
http://obiefernandez.typepad.com 1
http://ranksit.com 1
http://reader.googleusercontent.com 1
http://111.221.29.49 1
More...

Accessibility

Categories

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.

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

Redis on Rails (RedDotRubyConf 2012) Redis on Rails (RedDotRubyConf 2012) Presentation Transcript

  • Redis on Rails Obie FernandezTuesday, May 22, 2012
  • Salvatore Sanfilippo aka “antirez” Pieter NoordhuisTuesday, May 22, 2012
  • It’s a sidekick to your regular database!Tuesday, May 22, 2012 View slide
  • Tuesday, May 22, 2012 View slide
  • Tuesday, May 22, 2012
  • clues that you should consider using Redis •SQL database seems overkill •update-only data (only inserted) •non-transactional needs •no relations with other tablesTuesday, May 22, 2012
  • Why Redis and not something else?Tuesday, May 22, 2012
  • Redis is blazing fast!Tuesday, May 22, 2012
  • Source: http://antirez.com/post/redis-memcached-benchmark.htmlTuesday, May 22, 2012
  • Redis DurabilityTuesday, May 22, 2012
  • :REDIS0001<FE>^@^C^RAttendee:27:events^B<C1><A8>^@ 1335369284<C1><A6>^@ 1335369244^C^TAttendee:1:events:11^A<C0>J 1335364980^@^PAttendee:10:name^SJorge H. Cuadrado C^@ESCConference:8:breakevenpoint<C1><A0>^O^C^TAttendee:1:events: 13^B<C0>a 1335365085<C0>g 1335365112^@^PAttendee:22:name Mark Bates^D^RConference:1:notes^A<C0>^A<C3>=@C^Xthese are my notes, lala ^C@^A^E mo ^^<A0>ESC^LIll addd som 4^Bore^C^QAttendee:4:events^F<C0>^] 1335314963<C0>^_ 1335314968<C0>D 1335335712<C0>E RDB 1335335715<C0>^S 1335314271<C0>^T 1335314300^C^RAttendee:16:events^C<C0>k 1335365137<C0>^ 1335365082<C0>V files 1335365068^B^UAttendee: 11:followers^B<C0>^A<C0>^O^D^ZAttendeeRegisteredEvent: 65^B^Kattendee_id^A1^Mconference_id^A8^D^ AttendeeUnregisteredEvent:64^B^Kattendee_id^A1 ^Mconference_id^A8^C^TAttendee:13:events:1^A<C0>a 1335365085^D^AttendeeUnregisteredEvent: 66^B^Kattendee_id^A1^Mconference_id^A8^D^] AttendeeUnregisteredEvent: 170^B^Kattendee_id^B25^Mconference_id^A8^C^UAttendee:21:events: 21^M<C1><97>^@ 1335365767<C1><8F>^@ 1335365733<C1><92>^@ 1335365741<C1><9B>^@ 1335365879<C1><93>^@ 1335365742<C1><94>^@ 1335365743<C1><95>^@ 1335365744<C1><96>^@ 1335365746<C1><98>^@ 1335365783<C1><99>^@Tuesday, May 22, 2012
  • ################################ SNAPSHOTTING ################################# # # Save the DB on disk: # # save <seconds> <changes> # # Will save the DB if both the given number of seconds and # the given number of write operations against the DB occurred. # # In the example below the behaviour will be to save: # after 900 sec (15 min) if at least 1 key changed # after 300 sec (5 min) if at least 10 keys changed # after 60 sec if at least 10000 keys changed # # Note: you can disable saving at all commenting all the # "save" lines. save 900 1 save 300 10 save 60 10000Tuesday, May 22, 2012
  • Redis AOF (Append Only File)Tuesday, May 22, 2012
  • AOF optionsTuesday, May 22, 2012
  • Redis has lots of featuresTuesday, May 22, 2012
  • Tuesday, May 22, 2012
  • Photo Credit: http://www.flickr.com/photos/blingrocksTuesday, May 22, 2012
  • Nest Object-oriented Keys for Redis github.com/soveran/nest • Creates a Redis connection by default • Calls to_s for key representation • Really simple code / hack it for your needsTuesday, May 22, 2012
  • Tuesday, May 22, 2012
  • Tuesday, May 22, 2012
  • Example App http://github.com/obie/redis_on_railsTuesday, May 22, 2012
  • Tuesday, May 22, 2012
  • Adding properties to ActiveRecord ExampleTuesday, May 22, 2012
  • RedisProps Easy annotation of ActiveRecord objects http://github.com/obie/redis_props example: facebook_authentication.rbTuesday, May 22, 2012
  • ...Redis hash ExampleTuesday, May 22, 2012
  • Basic Twitter functionality in about 60 lines of RubyTuesday, May 22, 2012
  • Examples of intersections and unionsTuesday, May 22, 2012
  • Tuesday, May 22, 2012
  • Events - Sorted sets ExampleTuesday, May 22, 2012
  • SortedSet zunionstore and zinterstore ExamplesTuesday, May 22, 2012
  • RedisObjects Map Redis types directly to Ruby objects github.com/nateware/redis-objectsTuesday, May 22, 2012
  • RedisObjects •Values •Lists •Sets •SortedSets •Atomic Counters and LocksTuesday, May 22, 2012
  • Atomic Counter ExampleTuesday, May 22, 2012
  • Testing Tips •Don’t bother mocking out Redis •Select a different database number so you don’t clobber anything •Redis.current.flushdb is your friendTuesday, May 22, 2012
  • Tuesday, May 22, 2012
  • Rails Console ♥s RedisTuesday, May 22, 2012
  • Redis makes you more creativeTuesday, May 22, 2012
  • Obie Fernandez Thanks... obiefernandez@gmail.com @obie on twitter Example Code http://github.com/obie/redis_on_rails Slides available at my blog http://blog.obiefernandez.com Redis http://redis.io Check out DueProps http://dueprops.comTuesday, May 22, 2012