This is redis - feature and usecase
Upcoming SlideShare
Loading in...5
×
 

This is redis - feature and usecase

on

  • 3,147 views

The name of book "This is redis".

The name of book "This is redis".
Book summary and use case.

Statistics

Views

Total Views
3,147
Views on SlideShare
3,147
Embed Views
0

Actions

Likes
7
Downloads
37
Comments
0

0 Embeds 0

No embeds

Accessibility

Upload Details

Uploaded via as Microsoft PowerPoint

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

This is redis - feature and usecase This is redis - feature and usecase Presentation Transcript

  • This is REDIS - Feature and USECASE
  • About Me  Kris jeong(정경석)  Author a Book of REDIS  ‘This is REDIS’ in korean  Software development Over 14 years.  Web service dev.  Messaging server dev.  Recommendation dev.  Interested about NoSQL http://www.aladin.co.kr/shop/wproduct.aspx?ISBN=8968480591
  • What is  REDIS is In-Memory Database  Variety data types  Support persistence  Key value based NoSQL
  • IMDB(In-Memory DB) Disk based data store In-Memory data store Query Engine Query Engine Speed Storage Manager Memory(Cache) Disk Memory Durability Disk is optional Disk
  • Redis is cache server? Not a cache server. But, It can be. Turn off Persistence.
  • Running platform https://github.com/MSOpenTech/redis
  • Install and test $ wget http://download.redis.io/redis-stable.tar.gz $ tar xvf redis-stable.tar.gz $ cd redis-stable $ make … … done. $ make test ※ CentOS 6.4 64bit
  • Feature
  • Super fast (TPS) $ ./src/redis-benchmark --csv -d 1024 "PING_INLINE","34602.07" "PING_BULK","35971.22" "SET","35211.27" "GET","31347.96" … "LPUSH (needed to benchmark LRANGE)","32467.53" "LRANGE_100 (first 100 elements)","4714.76" "LRANGE_300 (first 300 elements)","1605.91" "LRANGE_500 (first 450 elements)","1030.93" "LRANGE_600 (first 600 elements)","735.13" "MSET (10 keys)","22471.91" ※ CentOS 6.4 64bit, Core i5 3337U@1.8Gz
  • Feature - expire  Duration cache  expire user:212:cart 259200 seconds It will be expired 3 days later.  Specified time cache  expireat user:212:item:sward 1388534400 It will be expired 2014/01/01 Unix timestamp
  • Support data types  String key value { "product": { "id": "2951", "name": "testing 01", "options": { "color": "red" }, "quantity": 4 } user:1:cart_info } ※ Up to 512MB
  • Support data types (cont.)  Hash Key field value name min damage 13 max damage 20 durability 32/50 price item:1:info bastard sword 3500 add a new value durability 31/50
  • Support data types (cont.)  Hash Key field value name min damage item:1:info bastard sword 13 max damage 20 durability 31/50 32/50 price 3500
  • Support data types (cont.)  List Key user:1:messag e elements hi~ how r you. bye. add a new value
  • Support data types (cont.)  List Key user:1:messag e elements hi~ how r you. bye.
  • Support data types (cont.)  Set kris mike frank user:1:friend martin tom add a new value chris
  • Support data types (cont.)  Set kris mike user:1:friend frank martin tom chris
  • Support data types (cont.)  Sorted Set score Key value 1 91 mike 200 frank 250 martin 251 user:ranking kris tom add a new value 220 chris
  • Support data types (cont.)  Sorted Set Key score value 1 91 user:ranking kris mike 200 frank 220 250 chris martin 250 251 martin tom 251 tom
  • Feature – RDB(Snapshot) Redis instance Redis data Data dump to disk Dump file (Redis.rdb) When snapshot event raised Check point of Redis snapshot  Redis data size vs Physical memory size ratio  vm.overcommit_memory setting  Disk I/O rate for swap
  • Feature – AOF(Append Only File) Redis instance Command logging Redis data Data change command Redis client Check point of Redis aof  Disk space  Restart time is slower than RDB appendonly.aof
  • Replication – Single slave Redis cluster Master Node Slave Node Replication key1 test value set key1 ‘test value’ key1 set key1 ‘test value’ Redis client test value
  • Replication – Multiple slave Redis cluster Slave Node 1 Replication Master Node Slave Node 2 Slave Node 3 Read Write Redis client
  • Replication – Multiple slave (cont.) Redis cluster 1st Replication Master Node Slave Node 1 2nd Replication Slave Node 2 Slave Node 3 Write Redis client Slave Node 4 Read Redis client
  • Sharding – range ● Data range based data split User Key 1 ~ 100 User Key 1~50 User Key 51~100 Shard 1 Shard 2 Master Node Master Node Slave Node Slave Node Slave Node Slave Node
  • Sharding - vertical ● Schema based data split User info Content Shard 1 Shard 2 Master Node Master Node Slave Node Slave Node Slave Node Slave Node
  • Sharding - consistent hashing ● Key based data split User Key 1 ~ 100 Key % Number of Shard(Key % 2) Shard 1 Shard 2 Master Node Master Node Slave Node Slave Node Slave Node Slave Node
  • Sharding – Redis client Shard 1 Shard N … Sharding Calc Read/Write Read/Write Redis client Check point of Redis Sharding  Redis does not support server-side sharding  Most Redis client support hash based sharding  Re sharding issue
  • Useage PV/UV Calculation 1Billion user  Daily logged in user count  Weekly logged in user count  List of Logged-in account at least once of week Most popular News list - Real time  Top 10 of news by click count  News list by popular by comment count Real time gamers ranking  Score based Top 10 ranker.  Recent user list
  • Demo