SlideShare ist ein Scribd-Unternehmen logo
1 von 17
Downloaden Sie, um offline zu lesen
How to use redis




                 2012.05.31
www.uajjang.com 미디어 검색팀
                정경석(kris.j)
   What is
   When is the right time to use
   Advantages and disadvantages
   Install
   Run/Test
   Redis Feature
   Performance test
   Cluster Recommendation
   Summary
   REmote DIctionary Server(REDIS)
   One of open source NoSQL(key–value store)
   In memory database
   Supports persistence
   Redis is written in ANSI C(Portabel)
   Sponsored by VMware
   Using github, blizzard, digg, flicker, bump…
   Last stable version 2.4.14(2012.05.31)
   Supports a rich set of data types
    ◦ List, Set, Sorted Set, Hash
   Need a fast response
   Need a Atomic operations
   Need a transaction
   Need a Publish/Subscribe
   Support for persistence
   Use case
    ◦   Job Queue
    ◦   Session store
    ◦   Real time ranking(for all users)
    ◦   Local Address book(Multi client windows, )
   Advantages
    ◦ Speed(80000 TPS depends on System and Net)
    ◦ Command level Atomic Operation(tx operation)
    ◦ Lots of client Lib(Objective-C, C#, Java, node.js,
      Erlang, Ruby…)
    ◦ Supports a serverside locking

   Disadvantages
    ◦ Snapshot IO overhead/Memory overhead
    ◦ Source compile install
    ◦ Whole dataset be loaded into main memory
   Unix/Linux
$   wget http://redis.googlecode.com/files/redis-2.4.14.tar.gz
$   tar xzf redis-2.4.14.tar.gz
$   cd redis-2.4.14
$   make



   Windows 64/32
    ◦ Unofficial support
    ◦ Binary http://github.com/dmajkic/redis/downloads
    ◦ Source export git from
      https://github.com/dmajkic/redis.git and build
// run redis server
$ cd $REDIS_HOME/src
$ ./redis-server
Redis log…


// run redis client
$ $REDIS_HOME/src
$ ./redis-cli
redis 127.0.0.1:6379> set firstkey sample
OK
redis 127.0.0.1:6379> get firstkey
"sample"
redis 127.0.0.1:6379>

    ※ http://try.redis-db.com(ver 2.0.2) test site
   Supports a Expire             Supports a Multi get
redis> set a 1                 redis> set a 1
ok                             OK
redis> expire a 5              redis> set b 12
ok                             OK
redis> get a                   redis> set c 56
"1"                            OK
…                              redis> mget a b c
(5 second later)               1) "1"
redis>                         2) "12"
(nil)                          3) "56"
redis>



※ Supports more then 100 commands.
   Supports a LIST               Supports a SET
redis>del nickname            redis>del nickname
redis> lpush nickname kris    redis> sadd nickname kris
(integer) 1                   (integer) 1
redis> lpush nickname peter   redis> sadd nickname peter
(integer) 2                   (integer) 1
redis> lpush nickname tom     redis> sadd nickname tom
(integer) 3                   (integer) 1
redis> lpush nickname jane    redis> smembers nickname
(integer) 4                   1) "tom"
redis> lrange nickname 0 1    2) "peter"
1) "jane"                     3) "kris"
2) "tom"                      redis> sismember nickname tom
                              (integer) 1

※ Supports Range search           ※ Non-redundant data processing
   Supports a HASH               Supports a Sorted SET
redis>del nickname            redis>del nickname
redis> hset user1 name kris   redis> zadd nickname 10 kris
(integer) 1                   redis> zadd nickname 10 peter
redis> hset user1 lastname    redis> zadd nickname 10 tom
jey                           redis> zadd nickname 10 jane
(integer) 1                   redis> zrevrange nickname 0 2
redis> hset user2 name tom    1) "tom"
(integer) 1                   2) "peter"
redis> hget user1 lastname    3) "kris"
"jey"                         redis> zincrby nickname 1 kris
redis> hgetall user1          "11"
1) "name"                     redis> zrevrange nickname 0 2
2) "kris"                     1) "kris"
3) "lastname"                 2) "tom"
4) "jey"                      3) "peter"
                                  ※ Real time ranking
   Supports a WildCard KeySet
redis> mset node Node.js node06 Node.js ruby18 Ruby1.8
OK
redis> mset ruby19 Ruby1.9 java Java6 mode9 temp
OK
redis> keys node*
1) "node06"
2) "node"
redis> keys ?ode*
1) "mode9"
2) "node06"
3) "node"

    ※ Most command's time complexity is O(1), except ‘keys’ : O(N)
    ※ On desktop environment : 1million keys in 40ms
   Supports a Blocking Queue
※ Client 1                       ※ Client 2
redis> lpush job-list batch01
                                redis> brpop job-list 10
                                1) "job-list"
                                2) "batch01"
                                redis> brpop job-list 10
                                0
                                (nil)
                                (10.28s)
                                redis> brpop job-list 0
redis> lpush job-list batch02
                                1) "job-list"
                                2) "batch02"
                                (5.82s)
   Supports a Publish/Subscribe(PSubscribe)
※ Client 1                      ※ Client 2
redis> publish public-notice   redis> psubscribe public*
'test message'                 Reading messages... (press Ctrl-C
(integer) 1                    to quit)
                               1) "psubscribe"
                               2) "public*"
                               3) (integer) 1

redis> publish public-alert    1)   "pmessage"
'server will shutdon‘          2)   "public*"
(integer) 1                    3)   "public-notice"
                               4)   "test message"
                               1)   "pmessage"
                               2)   "public*"
                               3)   "public-alert"
                               4)   "server will shutdon"
   Test ENV
    ◦ Server : 10.x.x.xx/10.x.x.xx(dual node v2.4.14)
    ◦ Client : Local PC(Thread 100/100M Lan)
    ◦ Command : get/set            Master/Slave Snapshot on




                                                         Redis Server(Master)
                                 set
              Jedis Client                        Real time replication

                                 get
              16,000~                                    Redis Server(Slave)
              20,000 TPS


                 Redis의 TPS는 대부분 Network/CPU 성능에 좌우되며 설정에 따라서 더 빨라질 수 있음.
                 공식 사이트의 측정치는 80000 TPS.
Master
                         Snapshot off
Write




               Slave                    Slave
               Snapshot on              Snapshot on



        Read                  Read
   모든 데이터가 Memory에 적재되므로 적절한 용량산정 필요.(천만
    Key일때 약 500MB메모리 소요)
   Redis서버의 구현이 Single Thread로 구성되어 있으므로 물리
    Core개수 만큼의 Instance 설치.
   현재 release version 2.4.14에서는 Serverside Cluster(Sharding)
    가 구현되어 있지 않음.(Sharding을 사용하기 위해서는 별도의 구현
    필요)
   Persistence지원을 위하여 Snapshot 또는 AOP설정을 사용하여야
    함.(Disk IO overhead 불가피)
    ◦ 실제 Field에서는 Master(Snapshot off) slave(on), slave(on)의 구성을
      사용하고 있으며 Write는 Master, Read는 Slave에서 처리(성능 향상을
      위함.)
   Redis Server 재 시작시 최종 Snapshot/AOF의 데이터가 로드됨.
   A common convention is to use “obj-type:id:field”
   Amazon EC2 Server에서 서비스중인 사례.
    ◦ 40000~100000 TPS처리중임.
    ◦ 20GB의 데이터 셋
    ◦ Amazon EC2 Server의 Virtualize 특성 때문에 Snapshot 사용 문제
      원인 fork() 시간이 너무 길게 걸림.)
    ◦ 위의 문제로 인하여 Snapshot을 off하고 AOF(Append Only File)기능을
      사용함.
    ◦ 위와 같은 설정에서 서비스 이상없이 운영중임.
   사용사례 Posting(1억2천만 사용자 대상 실시간 로그인 통계)
    ◦ http://blog.getspool.com/2011/11/29/fast-easy-realtime-
      metrics-using-redis-bitmaps/
    ◦ Unique방문자수 집계
      일간 : 50ms, 주간 : 392ms, 월간 : 1624ms

Weitere ähnliche Inhalte

Was ist angesagt?

An Introduction to REDIS NoSQL database
An Introduction to REDIS NoSQL databaseAn Introduction to REDIS NoSQL database
An Introduction to REDIS NoSQL databaseAli MasudianPour
 
Data Warehouse on Kubernetes: lessons from Clickhouse Operator
Data Warehouse on Kubernetes: lessons from Clickhouse OperatorData Warehouse on Kubernetes: lessons from Clickhouse Operator
Data Warehouse on Kubernetes: lessons from Clickhouse OperatorAltinity Ltd
 
AI 연구자를 위한 클린코드 - GDG DevFest Seoul 2019
AI 연구자를 위한 클린코드 - GDG DevFest Seoul 2019AI 연구자를 위한 클린코드 - GDG DevFest Seoul 2019
AI 연구자를 위한 클린코드 - GDG DevFest Seoul 2019Kenneth Ceyer
 
AVX-512(フォーマット)詳解
AVX-512(フォーマット)詳解AVX-512(フォーマット)詳解
AVX-512(フォーマット)詳解MITSUNARI Shigeo
 
文字コードに起因する脆弱性とその対策
文字コードに起因する脆弱性とその対策 文字コードに起因する脆弱性とその対策
文字コードに起因する脆弱性とその対策 Hiroshi Tokumaru
 
An Introduction to Redis for Developers.pdf
An Introduction to Redis for Developers.pdfAn Introduction to Redis for Developers.pdf
An Introduction to Redis for Developers.pdfStephen Lorello
 
Windbg cmds
Windbg cmdsWindbg cmds
Windbg cmdskewuc
 
XIDを周回させてみよう
XIDを周回させてみようXIDを周回させてみよう
XIDを周回させてみようAkio Ishida
 
TPC-DSから学ぶPostgreSQLの弱点と今後の展望
TPC-DSから学ぶPostgreSQLの弱点と今後の展望TPC-DSから学ぶPostgreSQLの弱点と今後の展望
TPC-DSから学ぶPostgreSQLの弱点と今後の展望Kohei KaiGai
 
GPUをJavaで使う話(Java Casual Talks #1)
GPUをJavaで使う話(Java Casual Talks #1)GPUをJavaで使う話(Java Casual Talks #1)
GPUをJavaで使う話(Java Casual Talks #1)なおき きしだ
 
Ask the expert AEM Assets best practices 092016
Ask the expert  AEM Assets best practices 092016Ask the expert  AEM Assets best practices 092016
Ask the expert AEM Assets best practices 092016AdobeMarketingCloud
 
Content Storage With Apache Jackrabbit
Content Storage With Apache JackrabbitContent Storage With Apache Jackrabbit
Content Storage With Apache JackrabbitJukka Zitting
 
RecSplit Minimal Perfect Hashing
RecSplit Minimal Perfect HashingRecSplit Minimal Perfect Hashing
RecSplit Minimal Perfect HashingThomas Mueller
 
Naver속도의, 속도에 의한, 속도를 위한 몽고DB (네이버 컨텐츠검색과 몽고DB) [Naver]
Naver속도의, 속도에 의한, 속도를 위한 몽고DB (네이버 컨텐츠검색과 몽고DB) [Naver]Naver속도의, 속도에 의한, 속도를 위한 몽고DB (네이버 컨텐츠검색과 몽고DB) [Naver]
Naver속도의, 속도에 의한, 속도를 위한 몽고DB (네이버 컨텐츠검색과 몽고DB) [Naver]MongoDB
 

Was ist angesagt? (20)

An Introduction to REDIS NoSQL database
An Introduction to REDIS NoSQL databaseAn Introduction to REDIS NoSQL database
An Introduction to REDIS NoSQL database
 
Data Warehouse on Kubernetes: lessons from Clickhouse Operator
Data Warehouse on Kubernetes: lessons from Clickhouse OperatorData Warehouse on Kubernetes: lessons from Clickhouse Operator
Data Warehouse on Kubernetes: lessons from Clickhouse Operator
 
AI 연구자를 위한 클린코드 - GDG DevFest Seoul 2019
AI 연구자를 위한 클린코드 - GDG DevFest Seoul 2019AI 연구자를 위한 클린코드 - GDG DevFest Seoul 2019
AI 연구자를 위한 클린코드 - GDG DevFest Seoul 2019
 
AVX-512(フォーマット)詳解
AVX-512(フォーマット)詳解AVX-512(フォーマット)詳解
AVX-512(フォーマット)詳解
 
Mongo db 최범균
Mongo db 최범균Mongo db 최범균
Mongo db 최범균
 
Introduction to redis
Introduction to redisIntroduction to redis
Introduction to redis
 
Redis introduction
Redis introductionRedis introduction
Redis introduction
 
Bluestore
BluestoreBluestore
Bluestore
 
文字コードに起因する脆弱性とその対策
文字コードに起因する脆弱性とその対策 文字コードに起因する脆弱性とその対策
文字コードに起因する脆弱性とその対策
 
An Introduction to Redis for Developers.pdf
An Introduction to Redis for Developers.pdfAn Introduction to Redis for Developers.pdf
An Introduction to Redis for Developers.pdf
 
Windbg cmds
Windbg cmdsWindbg cmds
Windbg cmds
 
XIDを周回させてみよう
XIDを周回させてみようXIDを周回させてみよう
XIDを周回させてみよう
 
TPC-DSから学ぶPostgreSQLの弱点と今後の展望
TPC-DSから学ぶPostgreSQLの弱点と今後の展望TPC-DSから学ぶPostgreSQLの弱点と今後の展望
TPC-DSから学ぶPostgreSQLの弱点と今後の展望
 
GPUをJavaで使う話(Java Casual Talks #1)
GPUをJavaで使う話(Java Casual Talks #1)GPUをJavaで使う話(Java Casual Talks #1)
GPUをJavaで使う話(Java Casual Talks #1)
 
Redis database
Redis databaseRedis database
Redis database
 
Ask the expert AEM Assets best practices 092016
Ask the expert  AEM Assets best practices 092016Ask the expert  AEM Assets best practices 092016
Ask the expert AEM Assets best practices 092016
 
Content Storage With Apache Jackrabbit
Content Storage With Apache JackrabbitContent Storage With Apache Jackrabbit
Content Storage With Apache Jackrabbit
 
JSONBはPostgreSQL9.5でいかに改善されたのか
JSONBはPostgreSQL9.5でいかに改善されたのかJSONBはPostgreSQL9.5でいかに改善されたのか
JSONBはPostgreSQL9.5でいかに改善されたのか
 
RecSplit Minimal Perfect Hashing
RecSplit Minimal Perfect HashingRecSplit Minimal Perfect Hashing
RecSplit Minimal Perfect Hashing
 
Naver속도의, 속도에 의한, 속도를 위한 몽고DB (네이버 컨텐츠검색과 몽고DB) [Naver]
Naver속도의, 속도에 의한, 속도를 위한 몽고DB (네이버 컨텐츠검색과 몽고DB) [Naver]Naver속도의, 속도에 의한, 속도를 위한 몽고DB (네이버 컨텐츠검색과 몽고DB) [Naver]
Naver속도의, 속도에 의한, 속도를 위한 몽고DB (네이버 컨텐츠검색과 몽고DB) [Naver]
 

Andere mochten auch

이것이 레디스다.
이것이 레디스다.이것이 레디스다.
이것이 레디스다.Kris Jeong
 
This is redis - feature and usecase
This is redis - feature and usecaseThis is redis - feature and usecase
This is redis - feature and usecaseKris Jeong
 
Redis Introduction
Redis IntroductionRedis Introduction
Redis IntroductionAlex Su
 
Farma Presentatie
Farma PresentatieFarma Presentatie
Farma Presentatiemarcomok
 
Redis dict and_rehash
Redis dict and_rehashRedis dict and_rehash
Redis dict and_rehashDaeMyung Kang
 
C* Summit 2013: Cassandra at Instagram by Rick Branson
C* Summit 2013: Cassandra at Instagram by Rick BransonC* Summit 2013: Cassandra at Instagram by Rick Branson
C* Summit 2013: Cassandra at Instagram by Rick BransonDataStax Academy
 
Node Js와 Redis를 사용한 구조화된 데이터
Node Js와 Redis를 사용한 구조화된 데이터Node Js와 Redis를 사용한 구조화된 데이터
Node Js와 Redis를 사용한 구조화된 데이터jinho park
 
[2B3]ARCUS차별기능,사용이슈,그리고카카오적용사례
[2B3]ARCUS차별기능,사용이슈,그리고카카오적용사례[2B3]ARCUS차별기능,사용이슈,그리고카카오적용사례
[2B3]ARCUS차별기능,사용이슈,그리고카카오적용사례NAVER D2
 
AWS 시작하기 및 Amazon S3 살펴보기 (윤석찬) - AWS 웨비나 시리즈
AWS 시작하기 및 Amazon S3 살펴보기 (윤석찬) - AWS 웨비나 시리즈AWS 시작하기 및 Amazon S3 살펴보기 (윤석찬) - AWS 웨비나 시리즈
AWS 시작하기 및 Amazon S3 살펴보기 (윤석찬) - AWS 웨비나 시리즈Amazon Web Services Korea
 
Lightning Talk: jsPDF
Lightning Talk: jsPDFLightning Talk: jsPDF
Lightning Talk: jsPDFJenny Liang
 

Andere mochten auch (12)

이것이 레디스다.
이것이 레디스다.이것이 레디스다.
이것이 레디스다.
 
This is redis - feature and usecase
This is redis - feature and usecaseThis is redis - feature and usecase
This is redis - feature and usecase
 
Redis edu 1
Redis edu 1Redis edu 1
Redis edu 1
 
Redis Introduction
Redis IntroductionRedis Introduction
Redis Introduction
 
Farma Presentatie
Farma PresentatieFarma Presentatie
Farma Presentatie
 
Redis dict and_rehash
Redis dict and_rehashRedis dict and_rehash
Redis dict and_rehash
 
Redis ndc2013
Redis ndc2013Redis ndc2013
Redis ndc2013
 
C* Summit 2013: Cassandra at Instagram by Rick Branson
C* Summit 2013: Cassandra at Instagram by Rick BransonC* Summit 2013: Cassandra at Instagram by Rick Branson
C* Summit 2013: Cassandra at Instagram by Rick Branson
 
Node Js와 Redis를 사용한 구조화된 데이터
Node Js와 Redis를 사용한 구조화된 데이터Node Js와 Redis를 사용한 구조화된 데이터
Node Js와 Redis를 사용한 구조화된 데이터
 
[2B3]ARCUS차별기능,사용이슈,그리고카카오적용사례
[2B3]ARCUS차별기능,사용이슈,그리고카카오적용사례[2B3]ARCUS차별기능,사용이슈,그리고카카오적용사례
[2B3]ARCUS차별기능,사용이슈,그리고카카오적용사례
 
AWS 시작하기 및 Amazon S3 살펴보기 (윤석찬) - AWS 웨비나 시리즈
AWS 시작하기 및 Amazon S3 살펴보기 (윤석찬) - AWS 웨비나 시리즈AWS 시작하기 및 Amazon S3 살펴보기 (윤석찬) - AWS 웨비나 시리즈
AWS 시작하기 및 Amazon S3 살펴보기 (윤석찬) - AWS 웨비나 시리즈
 
Lightning Talk: jsPDF
Lightning Talk: jsPDFLightning Talk: jsPDF
Lightning Talk: jsPDF
 

Ähnlich wie REDIS intro and how to use redis

Redis SoCraTes 2014
Redis SoCraTes 2014Redis SoCraTes 2014
Redis SoCraTes 2014steffenbauer
 
2013 london advanced-replication
2013 london advanced-replication2013 london advanced-replication
2013 london advanced-replicationMarc Schwering
 
Introduction to Redis
Introduction to RedisIntroduction to Redis
Introduction to RedisDvir Volk
 
Advanced Replication
Advanced ReplicationAdvanced Replication
Advanced ReplicationMongoDB
 
Introduction to redis
Introduction to redisIntroduction to redis
Introduction to redisTanu Siwag
 
Redis — The AK-47 of Post-relational Databases
Redis — The AK-47 of Post-relational DatabasesRedis — The AK-47 of Post-relational Databases
Redis — The AK-47 of Post-relational DatabasesKarel Minarik
 
Exactly once with spark streaming
Exactly once with spark streamingExactly once with spark streaming
Exactly once with spark streamingQuentin Ambard
 
[OpenInfra Days Korea 2018] Day 1 - T4-7: "Ceph 스토리지, PaaS로 서비스 운영하기"
[OpenInfra Days Korea 2018] Day 1 - T4-7: "Ceph 스토리지, PaaS로 서비스 운영하기"[OpenInfra Days Korea 2018] Day 1 - T4-7: "Ceph 스토리지, PaaS로 서비스 운영하기"
[OpenInfra Days Korea 2018] Day 1 - T4-7: "Ceph 스토리지, PaaS로 서비스 운영하기"OpenStack Korea Community
 
Paris Redis Meetup Introduction
Paris Redis Meetup IntroductionParis Redis Meetup Introduction
Paris Redis Meetup IntroductionGregory Boissinot
 
Troubleshooting Redis- DaeMyung Kang, Kakao
Troubleshooting Redis- DaeMyung Kang, KakaoTroubleshooting Redis- DaeMyung Kang, Kakao
Troubleshooting Redis- DaeMyung Kang, KakaoRedis Labs
 
Troubleshooting redis
Troubleshooting redisTroubleshooting redis
Troubleshooting redisDaeMyung Kang
 
Replication MongoDB Days 2013
Replication MongoDB Days 2013Replication MongoDB Days 2013
Replication MongoDB Days 2013Randall Hunt
 
2015 02-09 - NoSQL Vorlesung Mosbach
2015 02-09 - NoSQL Vorlesung Mosbach2015 02-09 - NoSQL Vorlesung Mosbach
2015 02-09 - NoSQL Vorlesung MosbachJohannes Hoppe
 
WebClusters, Redis
WebClusters, RedisWebClusters, Redis
WebClusters, RedisFilip Tepper
 
Redis - Usability and Use Cases
Redis - Usability and Use CasesRedis - Usability and Use Cases
Redis - Usability and Use CasesFabrizio Farinacci
 

Ähnlich wie REDIS intro and how to use redis (20)

Redis SoCraTes 2014
Redis SoCraTes 2014Redis SoCraTes 2014
Redis SoCraTes 2014
 
Redis acc
Redis accRedis acc
Redis acc
 
2013 london advanced-replication
2013 london advanced-replication2013 london advanced-replication
2013 london advanced-replication
 
Introduction to Redis
Introduction to RedisIntroduction to Redis
Introduction to Redis
 
Advanced Replication
Advanced ReplicationAdvanced Replication
Advanced Replication
 
Introduction to redis
Introduction to redisIntroduction to redis
Introduction to redis
 
Comredis
ComredisComredis
Comredis
 
Redis — The AK-47 of Post-relational Databases
Redis — The AK-47 of Post-relational DatabasesRedis — The AK-47 of Post-relational Databases
Redis — The AK-47 of Post-relational Databases
 
Exactly once with spark streaming
Exactly once with spark streamingExactly once with spark streaming
Exactly once with spark streaming
 
[OpenInfra Days Korea 2018] Day 1 - T4-7: "Ceph 스토리지, PaaS로 서비스 운영하기"
[OpenInfra Days Korea 2018] Day 1 - T4-7: "Ceph 스토리지, PaaS로 서비스 운영하기"[OpenInfra Days Korea 2018] Day 1 - T4-7: "Ceph 스토리지, PaaS로 서비스 운영하기"
[OpenInfra Days Korea 2018] Day 1 - T4-7: "Ceph 스토리지, PaaS로 서비스 운영하기"
 
Paris Redis Meetup Introduction
Paris Redis Meetup IntroductionParis Redis Meetup Introduction
Paris Redis Meetup Introduction
 
Redis begins
Redis beginsRedis begins
Redis begins
 
Troubleshooting Redis- DaeMyung Kang, Kakao
Troubleshooting Redis- DaeMyung Kang, KakaoTroubleshooting Redis- DaeMyung Kang, Kakao
Troubleshooting Redis- DaeMyung Kang, Kakao
 
Troubleshooting redis
Troubleshooting redisTroubleshooting redis
Troubleshooting redis
 
Replication MongoDB Days 2013
Replication MongoDB Days 2013Replication MongoDB Days 2013
Replication MongoDB Days 2013
 
2015 02-09 - NoSQL Vorlesung Mosbach
2015 02-09 - NoSQL Vorlesung Mosbach2015 02-09 - NoSQL Vorlesung Mosbach
2015 02-09 - NoSQL Vorlesung Mosbach
 
WebClusters, Redis
WebClusters, RedisWebClusters, Redis
WebClusters, Redis
 
Redis - Usability and Use Cases
Redis - Usability and Use CasesRedis - Usability and Use Cases
Redis - Usability and Use Cases
 
Genode Compositions
Genode CompositionsGenode Compositions
Genode Compositions
 
Dnsdist
DnsdistDnsdist
Dnsdist
 

Kürzlich hochgeladen

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfOrbitshub
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Victor Rentea
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024The Digital Insurer
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 
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 Processorsdebabhi2
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
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...Martijn de Jong
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
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 FresherRemote DBA Services
 

Kürzlich hochgeladen (20)

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
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
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
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...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
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
 

REDIS intro and how to use redis

  • 1. How to use redis 2012.05.31 www.uajjang.com 미디어 검색팀 정경석(kris.j)
  • 2. What is  When is the right time to use  Advantages and disadvantages  Install  Run/Test  Redis Feature  Performance test  Cluster Recommendation  Summary
  • 3. REmote DIctionary Server(REDIS)  One of open source NoSQL(key–value store)  In memory database  Supports persistence  Redis is written in ANSI C(Portabel)  Sponsored by VMware  Using github, blizzard, digg, flicker, bump…  Last stable version 2.4.14(2012.05.31)  Supports a rich set of data types ◦ List, Set, Sorted Set, Hash
  • 4. Need a fast response  Need a Atomic operations  Need a transaction  Need a Publish/Subscribe  Support for persistence  Use case ◦ Job Queue ◦ Session store ◦ Real time ranking(for all users) ◦ Local Address book(Multi client windows, )
  • 5. Advantages ◦ Speed(80000 TPS depends on System and Net) ◦ Command level Atomic Operation(tx operation) ◦ Lots of client Lib(Objective-C, C#, Java, node.js, Erlang, Ruby…) ◦ Supports a serverside locking  Disadvantages ◦ Snapshot IO overhead/Memory overhead ◦ Source compile install ◦ Whole dataset be loaded into main memory
  • 6. Unix/Linux $ wget http://redis.googlecode.com/files/redis-2.4.14.tar.gz $ tar xzf redis-2.4.14.tar.gz $ cd redis-2.4.14 $ make  Windows 64/32 ◦ Unofficial support ◦ Binary http://github.com/dmajkic/redis/downloads ◦ Source export git from https://github.com/dmajkic/redis.git and build
  • 7. // run redis server $ cd $REDIS_HOME/src $ ./redis-server Redis log… // run redis client $ $REDIS_HOME/src $ ./redis-cli redis 127.0.0.1:6379> set firstkey sample OK redis 127.0.0.1:6379> get firstkey "sample" redis 127.0.0.1:6379> ※ http://try.redis-db.com(ver 2.0.2) test site
  • 8. Supports a Expire  Supports a Multi get redis> set a 1 redis> set a 1 ok OK redis> expire a 5 redis> set b 12 ok OK redis> get a redis> set c 56 "1" OK … redis> mget a b c (5 second later) 1) "1" redis> 2) "12" (nil) 3) "56" redis> ※ Supports more then 100 commands.
  • 9. Supports a LIST  Supports a SET redis>del nickname redis>del nickname redis> lpush nickname kris redis> sadd nickname kris (integer) 1 (integer) 1 redis> lpush nickname peter redis> sadd nickname peter (integer) 2 (integer) 1 redis> lpush nickname tom redis> sadd nickname tom (integer) 3 (integer) 1 redis> lpush nickname jane redis> smembers nickname (integer) 4 1) "tom" redis> lrange nickname 0 1 2) "peter" 1) "jane" 3) "kris" 2) "tom" redis> sismember nickname tom (integer) 1 ※ Supports Range search ※ Non-redundant data processing
  • 10. Supports a HASH  Supports a Sorted SET redis>del nickname redis>del nickname redis> hset user1 name kris redis> zadd nickname 10 kris (integer) 1 redis> zadd nickname 10 peter redis> hset user1 lastname redis> zadd nickname 10 tom jey redis> zadd nickname 10 jane (integer) 1 redis> zrevrange nickname 0 2 redis> hset user2 name tom 1) "tom" (integer) 1 2) "peter" redis> hget user1 lastname 3) "kris" "jey" redis> zincrby nickname 1 kris redis> hgetall user1 "11" 1) "name" redis> zrevrange nickname 0 2 2) "kris" 1) "kris" 3) "lastname" 2) "tom" 4) "jey" 3) "peter" ※ Real time ranking
  • 11. Supports a WildCard KeySet redis> mset node Node.js node06 Node.js ruby18 Ruby1.8 OK redis> mset ruby19 Ruby1.9 java Java6 mode9 temp OK redis> keys node* 1) "node06" 2) "node" redis> keys ?ode* 1) "mode9" 2) "node06" 3) "node" ※ Most command's time complexity is O(1), except ‘keys’ : O(N) ※ On desktop environment : 1million keys in 40ms
  • 12. Supports a Blocking Queue ※ Client 1 ※ Client 2 redis> lpush job-list batch01 redis> brpop job-list 10 1) "job-list" 2) "batch01" redis> brpop job-list 10 0 (nil) (10.28s) redis> brpop job-list 0 redis> lpush job-list batch02 1) "job-list" 2) "batch02" (5.82s)
  • 13. Supports a Publish/Subscribe(PSubscribe) ※ Client 1 ※ Client 2 redis> publish public-notice redis> psubscribe public* 'test message' Reading messages... (press Ctrl-C (integer) 1 to quit) 1) "psubscribe" 2) "public*" 3) (integer) 1 redis> publish public-alert 1) "pmessage" 'server will shutdon‘ 2) "public*" (integer) 1 3) "public-notice" 4) "test message" 1) "pmessage" 2) "public*" 3) "public-alert" 4) "server will shutdon"
  • 14. Test ENV ◦ Server : 10.x.x.xx/10.x.x.xx(dual node v2.4.14) ◦ Client : Local PC(Thread 100/100M Lan) ◦ Command : get/set Master/Slave Snapshot on Redis Server(Master) set Jedis Client Real time replication get 16,000~ Redis Server(Slave) 20,000 TPS Redis의 TPS는 대부분 Network/CPU 성능에 좌우되며 설정에 따라서 더 빨라질 수 있음. 공식 사이트의 측정치는 80000 TPS.
  • 15. Master Snapshot off Write Slave Slave Snapshot on Snapshot on Read Read
  • 16. 모든 데이터가 Memory에 적재되므로 적절한 용량산정 필요.(천만 Key일때 약 500MB메모리 소요)  Redis서버의 구현이 Single Thread로 구성되어 있으므로 물리 Core개수 만큼의 Instance 설치.  현재 release version 2.4.14에서는 Serverside Cluster(Sharding) 가 구현되어 있지 않음.(Sharding을 사용하기 위해서는 별도의 구현 필요)  Persistence지원을 위하여 Snapshot 또는 AOP설정을 사용하여야 함.(Disk IO overhead 불가피) ◦ 실제 Field에서는 Master(Snapshot off) slave(on), slave(on)의 구성을 사용하고 있으며 Write는 Master, Read는 Slave에서 처리(성능 향상을 위함.)  Redis Server 재 시작시 최종 Snapshot/AOF의 데이터가 로드됨.  A common convention is to use “obj-type:id:field”
  • 17. Amazon EC2 Server에서 서비스중인 사례. ◦ 40000~100000 TPS처리중임. ◦ 20GB의 데이터 셋 ◦ Amazon EC2 Server의 Virtualize 특성 때문에 Snapshot 사용 문제  원인 fork() 시간이 너무 길게 걸림.) ◦ 위의 문제로 인하여 Snapshot을 off하고 AOF(Append Only File)기능을 사용함. ◦ 위와 같은 설정에서 서비스 이상없이 운영중임.  사용사례 Posting(1억2천만 사용자 대상 실시간 로그인 통계) ◦ http://blog.getspool.com/2011/11/29/fast-easy-realtime- metrics-using-redis-bitmaps/ ◦ Unique방문자수 집계  일간 : 50ms, 주간 : 392ms, 월간 : 1624ms