SlideShare une entreprise Scribd logo
1  sur  30
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

Contenu connexe

Tendances

Redis Introduction
Redis IntroductionRedis Introduction
Redis Introduction
Alex Su
 
Tarantool: как сэкономить миллион долларов на базе данных на высоконагруженно...
Tarantool: как сэкономить миллион долларов на базе данных на высоконагруженно...Tarantool: как сэкономить миллион долларов на базе данных на высоконагруженно...
Tarantool: как сэкономить миллион долларов на базе данных на высоконагруженно...
Ontico
 

Tendances (20)

Introduction to redis
Introduction to redisIntroduction to redis
Introduction to redis
 
Redis persistence in practice
Redis persistence in practiceRedis persistence in practice
Redis persistence in practice
 
Redis Introduction
Redis IntroductionRedis Introduction
Redis Introduction
 
redis basics
redis basicsredis basics
redis basics
 
Introduction to Redis
Introduction to RedisIntroduction to Redis
Introduction to Redis
 
深入了解Redis
深入了解Redis深入了解Redis
深入了解Redis
 
Everything you always wanted to know about Redis but were afraid to ask
Everything you always wanted to know about Redis but were afraid to askEverything you always wanted to know about Redis but were afraid to ask
Everything you always wanted to know about Redis but were afraid to ask
 
An Introduction to REDIS NoSQL database
An Introduction to REDIS NoSQL databaseAn Introduction to REDIS NoSQL database
An Introduction to REDIS NoSQL database
 
Your 1st Ceph cluster
Your 1st Ceph clusterYour 1st Ceph cluster
Your 1st Ceph cluster
 
Bluestore
BluestoreBluestore
Bluestore
 
Ceph Performance and Sizing Guide
Ceph Performance and Sizing GuideCeph Performance and Sizing Guide
Ceph Performance and Sizing Guide
 
Ceph BlueStore - новый тип хранилища в Ceph / Максим Воронцов, (Redsys)
Ceph BlueStore - новый тип хранилища в Ceph / Максим Воронцов, (Redsys)Ceph BlueStore - новый тип хранилища в Ceph / Максим Воронцов, (Redsys)
Ceph BlueStore - новый тип хранилища в Ceph / Максим Воронцов, (Redsys)
 
Redis, another step on the road
Redis, another step on the roadRedis, another step on the road
Redis, another step on the road
 
Redis database
Redis databaseRedis database
Redis database
 
Tarantool: как сэкономить миллион долларов на базе данных на высоконагруженно...
Tarantool: как сэкономить миллион долларов на базе данных на высоконагруженно...Tarantool: как сэкономить миллион долларов на базе данных на высоконагруженно...
Tarantool: как сэкономить миллион долларов на базе данных на высоконагруженно...
 
Redis acc 2015_eng
Redis acc 2015_engRedis acc 2015_eng
Redis acc 2015_eng
 
Setting up mongodb sharded cluster in 30 minutes
Setting up mongodb sharded cluster in 30 minutesSetting up mongodb sharded cluster in 30 minutes
Setting up mongodb sharded cluster in 30 minutes
 
Redis tutoring
Redis tutoringRedis tutoring
Redis tutoring
 
librados
libradoslibrados
librados
 
SUSE Storage: Sizing and Performance (Ceph)
SUSE Storage: Sizing and Performance (Ceph)SUSE Storage: Sizing and Performance (Ceph)
SUSE Storage: Sizing and Performance (Ceph)
 

Similaire à This is redis - feature and usecase

Storage, San And Business Continuity Overview
Storage, San And Business Continuity OverviewStorage, San And Business Continuity Overview
Storage, San And Business Continuity Overview
Alan McSweeney
 
Red Hat Storage Day Dallas - Red Hat Ceph Storage Acceleration Utilizing Flas...
Red Hat Storage Day Dallas - Red Hat Ceph Storage Acceleration Utilizing Flas...Red Hat Storage Day Dallas - Red Hat Ceph Storage Acceleration Utilizing Flas...
Red Hat Storage Day Dallas - Red Hat Ceph Storage Acceleration Utilizing Flas...
Red_Hat_Storage
 
quickguide-einnovator-10-redis-admin
quickguide-einnovator-10-redis-adminquickguide-einnovator-10-redis-admin
quickguide-einnovator-10-redis-admin
jorgesimao71
 

Similaire à This is redis - feature and usecase (20)

Cost Savings at High Performance with Redis Labs and AWS
Cost Savings at High Performance with Redis Labs and AWSCost Savings at High Performance with Redis Labs and AWS
Cost Savings at High Performance with Redis Labs and AWS
 
Ceph
CephCeph
Ceph
 
Ceph: Open Source Storage Software Optimizations on Intel® Architecture for C...
Ceph: Open Source Storage Software Optimizations on Intel® Architecture for C...Ceph: Open Source Storage Software Optimizations on Intel® Architecture for C...
Ceph: Open Source Storage Software Optimizations on Intel® Architecture for C...
 
Storage, San And Business Continuity Overview
Storage, San And Business Continuity OverviewStorage, San And Business Continuity Overview
Storage, San And Business Continuity Overview
 
Intro to Apache Spark
Intro to Apache SparkIntro to Apache Spark
Intro to Apache Spark
 
Intro to Apache Spark
Intro to Apache SparkIntro to Apache Spark
Intro to Apache Spark
 
Firebird and RAID
Firebird and RAIDFirebird and RAID
Firebird and RAID
 
Moving Beyond Cache by Yiftach Shoolman Redis Labs - Redis Day Seattle 2020
Moving Beyond Cache by Yiftach Shoolman Redis Labs - Redis Day Seattle 2020Moving Beyond Cache by Yiftach Shoolman Redis Labs - Redis Day Seattle 2020
Moving Beyond Cache by Yiftach Shoolman Redis Labs - Redis Day Seattle 2020
 
SQL 2005 Disk IO Performance
SQL 2005 Disk IO PerformanceSQL 2005 Disk IO Performance
SQL 2005 Disk IO Performance
 
Red Hat Storage Day Dallas - Red Hat Ceph Storage Acceleration Utilizing Flas...
Red Hat Storage Day Dallas - Red Hat Ceph Storage Acceleration Utilizing Flas...Red Hat Storage Day Dallas - Red Hat Ceph Storage Acceleration Utilizing Flas...
Red Hat Storage Day Dallas - Red Hat Ceph Storage Acceleration Utilizing Flas...
 
Day 2 General Session Presentations RedisConf
Day 2 General Session Presentations RedisConfDay 2 General Session Presentations RedisConf
Day 2 General Session Presentations RedisConf
 
Hadoop Architecture_Cluster_Cap_Plan
Hadoop Architecture_Cluster_Cap_PlanHadoop Architecture_Cluster_Cap_Plan
Hadoop Architecture_Cluster_Cap_Plan
 
Data Replication Options in AWS
Data Replication Options in AWSData Replication Options in AWS
Data Replication Options in AWS
 
Redis meetup
Redis meetupRedis meetup
Redis meetup
 
What's new with enterprise Redis - Leena Joshi, Redis Labs
What's new with enterprise Redis - Leena Joshi, Redis LabsWhat's new with enterprise Redis - Leena Joshi, Redis Labs
What's new with enterprise Redis - Leena Joshi, Redis Labs
 
In-memory database
In-memory databaseIn-memory database
In-memory database
 
Quick-and-Easy Deployment of a Ceph Storage Cluster
Quick-and-Easy Deployment of a Ceph Storage ClusterQuick-and-Easy Deployment of a Ceph Storage Cluster
Quick-and-Easy Deployment of a Ceph Storage Cluster
 
Introduction to Redis
Introduction to RedisIntroduction to Redis
Introduction to Redis
 
quickguide-einnovator-10-redis-admin
quickguide-einnovator-10-redis-adminquickguide-einnovator-10-redis-admin
quickguide-einnovator-10-redis-admin
 
Ingesting Over Four Million Rows Per Second With QuestDB Timeseries Database ...
Ingesting Over Four Million Rows Per Second With QuestDB Timeseries Database ...Ingesting Over Four Million Rows Per Second With QuestDB Timeseries Database ...
Ingesting Over Four Million Rows Per Second With QuestDB Timeseries Database ...
 

Dernier

IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 

Dernier (20)

Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 

This is redis - feature and usecase

  • 1. This is REDIS - Feature and USECASE
  • 2. 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
  • 3. What is  REDIS is In-Memory Database  Variety data types  Support persistence  Key value based NoSQL
  • 4. 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
  • 5. Redis is cache server? Not a cache server. But, It can be. Turn off Persistence.
  • 7. 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
  • 9. 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
  • 10. 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
  • 11. Support data types  String key value { "product": { "id": "2951", "name": "testing 01", "options": { "color": "red" }, "quantity": 4 } user:1:cart_info } ※ Up to 512MB
  • 12. 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
  • 13. 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
  • 14. Support data types (cont.)  List Key user:1:messag e elements hi~ how r you. bye. add a new value
  • 15. Support data types (cont.)  List Key user:1:messag e elements hi~ how r you. bye.
  • 16. Support data types (cont.)  Set kris mike frank user:1:friend martin tom add a new value chris
  • 17. Support data types (cont.)  Set kris mike user:1:friend frank martin tom chris
  • 18. 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
  • 19. 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
  • 20. 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
  • 21. 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
  • 22. 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
  • 23. Replication – Multiple slave Redis cluster Slave Node 1 Replication Master Node Slave Node 2 Slave Node 3 Read Write Redis client
  • 24. 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
  • 25. 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
  • 26. 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
  • 27. 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
  • 28. 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
  • 29. 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
  • 30. Demo