Top Banner
Ensky Lin
21
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Redis

Ensky Lin

Page 2: Redis

Redis is a Fast, Memory-based key-value storage database.

Page 3: Redis

And more…

Page 4: Redis

Features

• Data types

• Publish–subscribe

• Transactions

• Replication

• Persistence

• Partition

Page 5: Redis

Licence

Page 6: Redis

Fast

• Almost the same as Memcached

Page 7: Redis

Fast

• Even more, the bottleneck may from your network card.

Page 8: Redis

Support lots of complex operations, you don’t need to

process data in client side.

a lot of I/O is sometimes needed

Page 9: Redis

Data types

• Strings

– Binary safe, with a maximum of 512MB

• Lists

• Sets

• Sorted sets

– Set with score

• Hashes

– Perfect to represent object

Page 10: Redis

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.

Page 11: Redis

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

Page 12: Redis

Replication

• Official Master-slave replication

– Write in Master, Read in Slaves

Page 13: Redis

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)

Page 14: Redis

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

Page 15: Redis

Twemproxy

• Twemproxy is an intermediate layer between clients and Redis instances.

• Reliably handle partitioning

Client

Twemproxy

Redis instance

Redis instance

Redis instance

Redis instance

Client Twemproxy

Page 16: Redis

Many clients for nearly all languages

Page 17: Redis

• ActionScript • C / C++ • C# • Clojure • Lisp • Dart • Erlang • Fancy • Go • Haskell • haXe • Io • Java

• Lua • Node.js • Objective-C • Perl • PHP • Python • Ruby • Scala • Smalltalk • Tcl

Page 18: Redis

Who is using redis?

Page 19: Redis

Redis project is sponsored by

Page 20: Redis

And use by …

Page 21: Redis

Thank you!