Redis - N✮SQL Berlin
Upcoming SlideShare
Loading in...5
×
 

Redis - N✮SQL Berlin

on

  • 9,058 views

Redis, the fast and furious key-value store.

Redis, the fast and furious key-value store.

Statistics

Views

Total Views
9,058
Views on SlideShare
6,087
Embed Views
2,971

Actions

Likes
14
Downloads
141
Comments
0

7 Embeds 2,971

http://www.paperplanes.de 2885
http://wiki 47
http://www.slideshare.net 32
http://translate.googleusercontent.com 3
http://webcache.googleusercontent.com 2
http://feeds.feedburner.com 1
http://74.125.155.132 1
More...

Accessibility

Categories

Upload Details

Uploaded via as Apple Keynote

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
  • (that’s not a lot, even for C code)
  • (even for C code)
  • (old school)
  • Strings can&#x2019;t be longer than 1GB <br /> Lists are implemented as doubly linked lists <br /> Sets are stored as hashesh
  • Different datatypes require using different command sets. Not doing so will raise errors.
  • Get is wicked fast.
  • incr requires parsing of the value
  • lset is destructive, replaces the existing element
  • List access only through ranges, getting a whole list requires you to fetch the length first.
  • Data in Redis isn&#x2019;t volatile, at least most of the time
  • ..and only if necessary. <br /> Data is put into a single dump file.
  • Database is dumped into a tempfile, then renamed. <br /> It&#x2019;s possible to loose data in the dumping period.
  • Writes out data after x seconds if at least y number of keys have changed. <br /> On startup the dump is reread into memory.
  • Fast, more complex, datatypes
  • Redis stores the daemon state and is used for service lookup.

Redis - N✮SQL Berlin Redis - N✮SQL Berlin Presentation Transcript

  • Redis - Fast and Furious N✮SQL Berlin Mathias Meyer, 22.10.2009 Peritor GmbH
  • Self I work at Peritor in Berlin I tweet @roidrage I code at http://github.com/mattmatt I blog at http://paperplanes.de 2
  • Peritor Working on http://scalarium.com 3 View slide
  • Redis - Key-Value Store Simple, yet awesome Fast, yet nonvolatile code.google.com/p/redis 4 View slide
  • Redis REmote DIctionary Server 5
  • Redis Went public in March 2009 Just reached 1.0 6
  • Redis < 6000 lines of code 7
  • Redis And the code is simple 8
  • Redis No threading, just one process 9
  • Redis Like Memcached, only awesome 10
  • Redis Simple and efficient text-based protocol (just like grandma and Memcached used to make) 11
  • Redis Protocol 12
  • Redis Protocol redis[“key”] = “value” 13
  • Redis Protocol Duh! 14
  • Redis Protocol Values can be strings, lists or sets 15
  • Redis Protocol - Special Ops Push and pop elements (atomic) Fetch arbitrary set and array elements Sorting 16
  • Redis Protocol set foo 4 1000 +OK 17
  • Redis Protocol set foo 4 Request 1000 +OK Response 17
  • Redis Protocol get foo $4 1000 get bar $-1 18
  • Redis Protocol get foo Request $4 Response 1000 get bar Reques $-1 Respons 18
  • Redis Protocol incr foo :1001 type foo +string 19
  • Redis Protocol - Lists lpush pizza 4 fury +OK rpush pizza 8 ortolana +OK 20
  • Redis Protocol - Lists lrange pizza 0 1 *2 $4 fury $8 ortolana 21
  • Redis Protocol - Lists lrange pizza 0 1 Request *2 $4 fury Response $8 ortolana 21
  • Redis Protocol - Sets sadd mq 8 rabbitmq :1 sadd mq 6 zeromq :1 22
  • Redis Protocol - Sets smembers mq *2 $6 zeromq $8 rabbitmq 23
  • Redis Protocol - Sets sort mq alpha *2 $8 rabbitmq $6 zeromq 24
  • Redis Protocol - The Rest Random list/set access Intersections, Unions Monitoring Controlling the Server Multi-Set Commands 25
  • Redis Data is held in memory, but can be persisted 26
  • Redis Key-Value Database Persistent Asynchronous Just like Super Pursuit Mode 27
  • Redis Database Data is written to disk asynchronously 28
  • Redis Database Redis Server Dump Database fork() Redis Server rename() exit() 29
  • Redis Database save 900 1 save 300 10 save 60 100000 30
  • Replication 1 Master - N Slaves Asynchronous on Master Synchronous on Slave 31
  • Redis Replication Like dumping the database, only to a different file descriptor. 32
  • Redis Replication Redis Master Redis Slave Redis Slave Redis Slave Redis Slave 33
  • Redis - Scaling Horizontal • Run multiple Redis processes • Use HashRing (e.g. in redis-rb) 34
  • Redis - Scaling Vertical • Master-Slave setup • Fetch data from any slave (e.g. random) 35
  • To Redis, or not to Redis? 36
  • As always, it depends 37
  • To Redis Caching Statistical data Recoverable state Worker queue 38
  • Not to Redis 100% consistent dataset required Data is larger than memory 39
  • Redis Use Cases Nanite - A self-assembling cluster of Ruby daemons 40
  • The most important 41
  • Is it faster than 42
  • No, but fast enough for you (if you need the extra features) 43
  • Redis Simple, fast, awesome. 44
  • Questions 45
  • Peritor GmbH Blücherstr. 22, Hof III Aufgang 6 10961 Berlin Tel.: +49 (0)30 69 20 09 84 0 Fax: +49 (0)30 69 20 09 84 9 Internet: www.peritor.com E-Mail: info@peritor.com © Peritor GmbH - Alle Rechte Vorbehalten