KEMBAR78
Redis | PDF
Ensky Lin
Redis is a Fast, Memory-based
 key-value storage database.
And more…
Features
•   Data types
•   Publish–subscribe
•   Transactions
•   Replication
•   Persistence
•   Partition
Licence
Fast
• Almost the same as Memcached
Fast
• Even more, the bottleneck may from
  your network card.
Support lots of complex
operations, you don’t need to
 process data in client side.

    a lot of I/O is sometimes needed
Data types
• Strings
  – Binary safe, with a maximum of 512MB
• Lists
• Sets
• Sorted sets
  – Set with score
• Hashes
  – Perfect to represent object
Publish–subscribe
• Redis supports publish-subscribe
  mode.
• You can subscribe some topics, and
  when someone publish topic matches
  your interest, redis send it to you.
Transactions
• Redis also support transactions.
• you can execute multiple command in a
  single step.
• Either all of the commands or none are
  processed
  > MULTI
  OK
  > INCR foo
  QUEUED
  > INCR bar
  QUEUED
  > EXEC
  1) (integer) 1
  2) (integer) 1
Replication
• Official Master-slave replication
  – Write in Master, Read in Slaves
Persistence
• You can choose persistence yourself
  – RDB
    • Take snapshot in an interval
    • Fast
    • may loss several minutes data if kill -9
  – AOF
    • Log-based, redo whole steps since startup
    • Still fast enough
    • may loss 1 second data if kill -9
  – None(like memcached)
Partition
• There are three way that is recommend by
  redis official group.
  – Redis Cluster
    • Official way, Under development


  – Twemproxy
    • Twitter developed, support redis and memcached.


  – Clients supporting consistent hashing
Twemproxy
• Twemproxy is an intermediate layer
  between clients and Redis instances.
• Reliably handle partitioning
                         Redis
                       instance
          Twem
 Client
          proxy


                         Redis
                       instance




                         Redis
          Twem         instance
 Client
          proxy


                         Redis
                       instance
Many clients for nearly all
       languages
•   ActionScript   •   Lua
•   C / C++        •   Node.js
•   C#             •   Objective-C
•   Clojure        •   Perl
•   Lisp           •   PHP
•   Dart           •   Python
•   Erlang         •   Ruby
•   Fancy          •   Scala
•   Go             •   Smalltalk
•   Haskell        •   Tcl
•   haXe
•   Io
•   Java
Who is using redis?
Redis project is sponsored by
And use by …
Thank you!

Redis

  • 1.
  • 2.
    Redis is aFast, Memory-based key-value storage database.
  • 3.
  • 4.
    Features • Data types • Publish–subscribe • Transactions • Replication • Persistence • Partition
  • 5.
  • 6.
    Fast • Almost thesame as Memcached
  • 7.
    Fast • Even more,the bottleneck may from your network card.
  • 8.
    Support lots ofcomplex operations, you don’t need to process data in client side. a lot of I/O is sometimes needed
  • 9.
    Data types • Strings – Binary safe, with a maximum of 512MB • Lists • Sets • Sorted sets – Set with score • Hashes – Perfect to represent object
  • 10.
    Publish–subscribe • Redis supportspublish-subscribe mode. • You can subscribe some topics, and when someone publish topic matches your interest, redis send it to you.
  • 11.
    Transactions • Redis alsosupport transactions. • you can execute multiple command in a single step. • Either all of the commands or none are processed > MULTI OK > INCR foo QUEUED > INCR bar QUEUED > EXEC 1) (integer) 1 2) (integer) 1
  • 12.
    Replication • Official Master-slavereplication – Write in Master, Read in Slaves
  • 13.
    Persistence • You canchoose persistence yourself – RDB • Take snapshot in an interval • Fast • may loss several minutes data if kill -9 – AOF • Log-based, redo whole steps since startup • Still fast enough • may loss 1 second data if kill -9 – None(like memcached)
  • 14.
    Partition • There arethree way that is recommend by redis official group. – Redis Cluster • Official way, Under development – Twemproxy • Twitter developed, support redis and memcached. – Clients supporting consistent hashing
  • 15.
    Twemproxy • Twemproxy isan intermediate layer between clients and Redis instances. • Reliably handle partitioning Redis instance Twem Client proxy Redis instance Redis Twem instance Client proxy Redis instance
  • 16.
    Many clients fornearly all languages
  • 17.
    ActionScript • Lua • C / C++ • Node.js • C# • Objective-C • Clojure • Perl • Lisp • PHP • Dart • Python • Erlang • Ruby • Fancy • Scala • Go • Smalltalk • Haskell • Tcl • haXe • Io • Java
  • 18.
  • 19.
    Redis project issponsored by
  • 20.
  • 21.