SlideShare a Scribd company logo
Introduction to Redis   Byeongweon Moon / Redduck
Ready to Redis

• Document-oriented Database

• Key-Value Data Store Program

• Key can contain strings, hashes, lists, sets and
  sorted sets

• Value can contain strings, lists, sets, sorted set

• Redis use RAM for data store
Key-Value Data Store

• Insert data with specific key

• Get data with key by O(1) compexity

• Value can contain structured strings like as JSON,
  XML
List Control

• SET : LINSERT, LPUSH, RPUSH, LSET

• GET : LPOP, LRANGE, RPOP

• DEL : LREM

• ETC : LTRIM, LLEN
Pushing IDs instead of the actual data

$ redis-cli incr next.news.id
(integer) 1
$ redis-cli set news:1:title "Redis is simple"
OK
$ redis-cli set news:1:url
"http://code.google.com/p/redis"
OK
$ redis-cli lpush submitted.news 1
OK
$ redis-cli lrange submitted.news 0 -1
1) “1”
Set Control

• SET : SADD,

• GET : SPOP, SRANDMEMBER, SMEMBERS

• DEL : SREM

• ETC : SINTER, SUNION, SCARD, SDIFF, SMOVE,
  SISMEMBER
Redis Sets

$ redis-cli sadd news:1000:tags 1
(integer) 1
$ redis-cli sadd news:1000:tags 2
(integer) 1
$ redis-cli sadd news:1000:tags 5
(integer) 1
$ redis-cli sadd tag:1:objects 1000
(integer) 1
$ redis-cli sadd tag:2:objects 1000
(integer) 1
$ redis-cli sadd tag:5:objects 1000
(integer) 1
$ redis-cli sinter tag:1:objects tag:2:objects tag:5:objects
1000
1) “1000”
Sorted Set Control

• SET : ZADD, ZINCRBY

• GET : ZRANGE, ZRANGEBYSCORE, ZSCORE,
  ZCARD, ZRANK, ZCOUNT

• DEL : ZREM, ZREMRANGEBYRANK,
  ZREMRANGEBYSCORE

• ETC : ZINTERSTORE, Z UNIONSTORE
Sorted sets

$ redis-cli zadd hackers 1940 "Alan Kay"
(integer) 1
$ redis-cli zadd hackers 1953 "Richard Stallman"
(integer) 1
$ redis-cli zadd hackers 1969 "Linus Torvalds"
(integer) 1
$ redis-cli zadd hackers 1912 "Alan Turing"
(integer) 1
$ redis-cli zrange hackers 0 -1
1. Alan Turing
2. Alan Kay
3. Richard Stallman
4. Linus Torvalds
Replication

• Master-Slave replication

• Master can have multiple slaves

• Slaves are able to accept other slaves
  connections

• Slaves can also be connected to other slaves in
  graph-like structure

• Redis replication is non-blocking on the master
  side. but blocking on the slave side.
How replication works

• To configure add below line to slave's
  configuration file slaveof IP PORT

• After configuration done. when upon connection
  slave sends a SYNC command

• Master start background data saving and collect
  all new commands received that will modify
  dataset

• When background saving complete, transfers the
  dataset to slave, then send saved commands
Publish / Subcribe

• Messaging pattern where senders of messages
  do not program the messages to be sent directly
  to specific receiver.

• SUBCRIBE [channel] command create channel or
  subscribe channel

• PUBLISH [channel] [message] command send
  message via

• Support pattern matching subscribe with
  PSUBSCRIBE
Pipelining

• Whatever network speed fast or slow, there's
  always latency.

• To avoid network latency. Redis support multi
  commands send with one request.

• Send commands with new line delemiter
        echo -en "PINGrnPINGrnPINGrn" | nc
  localhost 6379

• Result wiil received after all commands processed
Benchmarks
Who's using Redis?

• Twitter

• github

• stackoverflow

• blizzard

• digg

• .....
Thanks, Any Questions?

More Related Content

What's hot

Red Hat Forum Tokyo - OpenStack Architecture Design
Red Hat Forum Tokyo - OpenStack Architecture DesignRed Hat Forum Tokyo - OpenStack Architecture Design
Red Hat Forum Tokyo - OpenStack Architecture Design
Dan Radez
 
Redis in a Multi Tenant Environment–High Availability, Monitoring & Much More!
Redis in a Multi Tenant Environment–High Availability, Monitoring & Much More! Redis in a Multi Tenant Environment–High Availability, Monitoring & Much More!
Redis in a Multi Tenant Environment–High Availability, Monitoring & Much More!
Redis Labs
 
Scaling SolrCloud to a large number of Collections
Scaling SolrCloud to a large number of CollectionsScaling SolrCloud to a large number of Collections
Scaling SolrCloud to a large number of Collections
Anshum Gupta
 
Cassandra Day SV 2014: Netflix’s Astyanax Java Client Driver for Apache Cassa...
Cassandra Day SV 2014: Netflix’s Astyanax Java Client Driver for Apache Cassa...Cassandra Day SV 2014: Netflix’s Astyanax Java Client Driver for Apache Cassa...
Cassandra Day SV 2014: Netflix’s Astyanax Java Client Driver for Apache Cassa...
DataStax Academy
 
Caching solutions with Redis
Caching solutions   with RedisCaching solutions   with Redis
Caching solutions with Redis
George Platon
 
Introduction to Systems Management with SaltStack
Introduction to Systems Management with SaltStackIntroduction to Systems Management with SaltStack
Introduction to Systems Management with SaltStack
Craig Sebenik
 
Introduction to Redis
Introduction to RedisIntroduction to Redis
Introduction to Redis
Maarten Smeets
 
SolrCloud on Hadoop
SolrCloud on HadoopSolrCloud on Hadoop
SolrCloud on Hadoop
Alex Moundalexis
 
Introduction to SolrCloud
Introduction to SolrCloudIntroduction to SolrCloud
Introduction to SolrCloud
Varun Thacker
 
Redis tutoring
Redis tutoringRedis tutoring
Redis tutoring
Chen-Tien Tsai
 
Call me maybe: Jepsen and flaky networks
Call me maybe: Jepsen and flaky networksCall me maybe: Jepsen and flaky networks
Call me maybe: Jepsen and flaky networks
Shalin Shekhar Mangar
 
How to Develop OpenStack
How to Develop OpenStackHow to Develop OpenStack
How to Develop OpenStack
Mehdi Ali Soltani
 
Openstack – An introduction
Openstack – An introductionOpenstack – An introduction
Openstack – An introduction
Muddassir Nazir
 
Best practices for highly available and large scale SolrCloud
Best practices for highly available and large scale SolrCloudBest practices for highly available and large scale SolrCloud
Best practices for highly available and large scale SolrCloud
Anshum Gupta
 
Handling Redis failover with ZooKeeper
Handling Redis failover with ZooKeeperHandling Redis failover with ZooKeeper
Handling Redis failover with ZooKeeperryanlecompte
 
Lessons From Sharding Solr At Etsy: Presented by Gregg Donovan, Etsy
Lessons From Sharding Solr At Etsy: Presented by Gregg Donovan, EtsyLessons From Sharding Solr At Etsy: Presented by Gregg Donovan, Etsy
Lessons From Sharding Solr At Etsy: Presented by Gregg Donovan, Etsy
Lucidworks
 
GeoDistributed datacenter: the DNS way
GeoDistributed datacenter: the DNS wayGeoDistributed datacenter: the DNS way
GeoDistributed datacenter: the DNS way
Moyd.co LTD
 
HIgh Performance Redis- Tague Griffith, GoPro
HIgh Performance Redis- Tague Griffith, GoProHIgh Performance Redis- Tague Griffith, GoPro
HIgh Performance Redis- Tague Griffith, GoPro
Redis Labs
 

What's hot (19)

Red Hat Forum Tokyo - OpenStack Architecture Design
Red Hat Forum Tokyo - OpenStack Architecture DesignRed Hat Forum Tokyo - OpenStack Architecture Design
Red Hat Forum Tokyo - OpenStack Architecture Design
 
Redis in a Multi Tenant Environment–High Availability, Monitoring & Much More!
Redis in a Multi Tenant Environment–High Availability, Monitoring & Much More! Redis in a Multi Tenant Environment–High Availability, Monitoring & Much More!
Redis in a Multi Tenant Environment–High Availability, Monitoring & Much More!
 
Scaling SolrCloud to a large number of Collections
Scaling SolrCloud to a large number of CollectionsScaling SolrCloud to a large number of Collections
Scaling SolrCloud to a large number of Collections
 
Cassandra Day SV 2014: Netflix’s Astyanax Java Client Driver for Apache Cassa...
Cassandra Day SV 2014: Netflix’s Astyanax Java Client Driver for Apache Cassa...Cassandra Day SV 2014: Netflix’s Astyanax Java Client Driver for Apache Cassa...
Cassandra Day SV 2014: Netflix’s Astyanax Java Client Driver for Apache Cassa...
 
Caching solutions with Redis
Caching solutions   with RedisCaching solutions   with Redis
Caching solutions with Redis
 
Introduction to Systems Management with SaltStack
Introduction to Systems Management with SaltStackIntroduction to Systems Management with SaltStack
Introduction to Systems Management with SaltStack
 
Introduction to Redis
Introduction to RedisIntroduction to Redis
Introduction to Redis
 
SolrCloud on Hadoop
SolrCloud on HadoopSolrCloud on Hadoop
SolrCloud on Hadoop
 
Introduction to SolrCloud
Introduction to SolrCloudIntroduction to SolrCloud
Introduction to SolrCloud
 
Redis tutoring
Redis tutoringRedis tutoring
Redis tutoring
 
Call me maybe: Jepsen and flaky networks
Call me maybe: Jepsen and flaky networksCall me maybe: Jepsen and flaky networks
Call me maybe: Jepsen and flaky networks
 
How to Develop OpenStack
How to Develop OpenStackHow to Develop OpenStack
How to Develop OpenStack
 
Openstack – An introduction
Openstack – An introductionOpenstack – An introduction
Openstack – An introduction
 
Best practices for highly available and large scale SolrCloud
Best practices for highly available and large scale SolrCloudBest practices for highly available and large scale SolrCloud
Best practices for highly available and large scale SolrCloud
 
Handling Redis failover with ZooKeeper
Handling Redis failover with ZooKeeperHandling Redis failover with ZooKeeper
Handling Redis failover with ZooKeeper
 
Lessons From Sharding Solr At Etsy: Presented by Gregg Donovan, Etsy
Lessons From Sharding Solr At Etsy: Presented by Gregg Donovan, EtsyLessons From Sharding Solr At Etsy: Presented by Gregg Donovan, Etsy
Lessons From Sharding Solr At Etsy: Presented by Gregg Donovan, Etsy
 
GeoDistributed datacenter: the DNS way
GeoDistributed datacenter: the DNS wayGeoDistributed datacenter: the DNS way
GeoDistributed datacenter: the DNS way
 
Raid
RaidRaid
Raid
 
HIgh Performance Redis- Tague Griffith, GoPro
HIgh Performance Redis- Tague Griffith, GoProHIgh Performance Redis- Tague Griffith, GoPro
HIgh Performance Redis- Tague Griffith, GoPro
 

Viewers also liked

3GPP UICC Spec. differences
3GPP UICC Spec. differences3GPP UICC Spec. differences
3GPP UICC Spec. differencesByeongweon Moon
 
미스터리쇼핑 발표
미스터리쇼핑 발표미스터리쇼핑 발표
미스터리쇼핑 발표Byeongweon Moon
 
실시간 인벤트 처리
실시간 인벤트 처리실시간 인벤트 처리
실시간 인벤트 처리Byeongweon Moon
 
No sql solutions - 공개용
No sql solutions - 공개용No sql solutions - 공개용
No sql solutions - 공개용Byeongweon Moon
 
USAT : USIM Application Toolkit
USAT : USIM Application ToolkitUSAT : USIM Application Toolkit
USAT : USIM Application ToolkitByeongweon Moon
 

Viewers also liked (8)

Refactoring Seminar
Refactoring SeminarRefactoring Seminar
Refactoring Seminar
 
3GPP UICC Spec. differences
3GPP UICC Spec. differences3GPP UICC Spec. differences
3GPP UICC Spec. differences
 
SIM Initialization
SIM InitializationSIM Initialization
SIM Initialization
 
미스터리쇼핑 발표
미스터리쇼핑 발표미스터리쇼핑 발표
미스터리쇼핑 발표
 
실시간 인벤트 처리
실시간 인벤트 처리실시간 인벤트 처리
실시간 인벤트 처리
 
No sql solutions - 공개용
No sql solutions - 공개용No sql solutions - 공개용
No sql solutions - 공개용
 
USAT : USIM Application Toolkit
USAT : USIM Application ToolkitUSAT : USIM Application Toolkit
USAT : USIM Application Toolkit
 
Introduction to HBase
Introduction to HBaseIntroduction to HBase
Introduction to HBase
 

Similar to Redis

Speed up your Symfony2 application and build awesome features with Redis
Speed up your Symfony2 application and build awesome features with RedisSpeed up your Symfony2 application and build awesome features with Redis
Speed up your Symfony2 application and build awesome features with Redis
Ricard Clau
 
Redis Everywhere - Sunshine PHP
Redis Everywhere - Sunshine PHPRedis Everywhere - Sunshine PHP
Redis Everywhere - Sunshine PHPRicard Clau
 
Introduction to Redis
Introduction to RedisIntroduction to Redis
Introduction to Redis
Ofer Zelig
 
Redis - The Universal NoSQL Tool
Redis - The Universal NoSQL ToolRedis - The Universal NoSQL Tool
Redis - The Universal NoSQL Tool
Eberhard Wolff
 
Redis everywhere - PHP London
Redis everywhere - PHP LondonRedis everywhere - PHP London
Redis everywhere - PHP LondonRicard Clau
 
Azure Redis Cache - Cache on Steroids!
Azure Redis Cache - Cache on Steroids!Azure Redis Cache - Cache on Steroids!
Azure Redis Cache - Cache on Steroids!
François Boucher
 
Redis Modules - Redis India Tour - 2017
Redis Modules - Redis India Tour - 2017Redis Modules - Redis India Tour - 2017
Redis Modules - Redis India Tour - 2017
HashedIn Technologies
 
Cassandra
CassandraCassandra
Cassandraexsuns
 
Redis Labcamp
Redis LabcampRedis Labcamp
Redis Labcamp
Angelo Simone Scotto
 
MySQL Guide for Beginners
MySQL Guide for BeginnersMySQL Guide for Beginners
MySQL Guide for Beginners
Dainis Graveris
 
Spark Summit EU talk by Shay Nativ and Dvir Volk
Spark Summit EU talk by Shay Nativ and Dvir VolkSpark Summit EU talk by Shay Nativ and Dvir Volk
Spark Summit EU talk by Shay Nativ and Dvir Volk
Spark Summit
 
深入了解Redis
深入了解Redis深入了解Redis
深入了解Redis
iammutex
 
Vijfhart thema-avond-oracle-12c-new-features
Vijfhart thema-avond-oracle-12c-new-featuresVijfhart thema-avond-oracle-12c-new-features
Vijfhart thema-avond-oracle-12c-new-features
mkorremans
 
(BDT401) Amazon Redshift Deep Dive: Tuning and Best Practices
(BDT401) Amazon Redshift Deep Dive: Tuning and Best Practices(BDT401) Amazon Redshift Deep Dive: Tuning and Best Practices
(BDT401) Amazon Redshift Deep Dive: Tuning and Best Practices
Amazon Web Services
 
(DAT407) Amazon ElastiCache: Deep Dive
(DAT407) Amazon ElastiCache: Deep Dive(DAT407) Amazon ElastiCache: Deep Dive
(DAT407) Amazon ElastiCache: Deep Dive
Amazon Web Services
 
Solr Recipes
Solr RecipesSolr Recipes
Solr Recipes
Erik Hatcher
 
Redis in 20 minutes
Redis in 20 minutesRedis in 20 minutes
Redis in 20 minutes
András Fehér
 
Redshift overview
Redshift overviewRedshift overview
Redshift overview
Amazon Web Services LATAM
 
Introduction to Hadoop and Big Data
Introduction to Hadoop and Big DataIntroduction to Hadoop and Big Data
Introduction to Hadoop and Big Data
Joe Alex
 

Similar to Redis (20)

Speed up your Symfony2 application and build awesome features with Redis
Speed up your Symfony2 application and build awesome features with RedisSpeed up your Symfony2 application and build awesome features with Redis
Speed up your Symfony2 application and build awesome features with Redis
 
REDIS327
REDIS327REDIS327
REDIS327
 
Redis Everywhere - Sunshine PHP
Redis Everywhere - Sunshine PHPRedis Everywhere - Sunshine PHP
Redis Everywhere - Sunshine PHP
 
Introduction to Redis
Introduction to RedisIntroduction to Redis
Introduction to Redis
 
Redis - The Universal NoSQL Tool
Redis - The Universal NoSQL ToolRedis - The Universal NoSQL Tool
Redis - The Universal NoSQL Tool
 
Redis everywhere - PHP London
Redis everywhere - PHP LondonRedis everywhere - PHP London
Redis everywhere - PHP London
 
Azure Redis Cache - Cache on Steroids!
Azure Redis Cache - Cache on Steroids!Azure Redis Cache - Cache on Steroids!
Azure Redis Cache - Cache on Steroids!
 
Redis Modules - Redis India Tour - 2017
Redis Modules - Redis India Tour - 2017Redis Modules - Redis India Tour - 2017
Redis Modules - Redis India Tour - 2017
 
Cassandra
CassandraCassandra
Cassandra
 
Redis Labcamp
Redis LabcampRedis Labcamp
Redis Labcamp
 
MySQL Guide for Beginners
MySQL Guide for BeginnersMySQL Guide for Beginners
MySQL Guide for Beginners
 
Spark Summit EU talk by Shay Nativ and Dvir Volk
Spark Summit EU talk by Shay Nativ and Dvir VolkSpark Summit EU talk by Shay Nativ and Dvir Volk
Spark Summit EU talk by Shay Nativ and Dvir Volk
 
深入了解Redis
深入了解Redis深入了解Redis
深入了解Redis
 
Vijfhart thema-avond-oracle-12c-new-features
Vijfhart thema-avond-oracle-12c-new-featuresVijfhart thema-avond-oracle-12c-new-features
Vijfhart thema-avond-oracle-12c-new-features
 
(BDT401) Amazon Redshift Deep Dive: Tuning and Best Practices
(BDT401) Amazon Redshift Deep Dive: Tuning and Best Practices(BDT401) Amazon Redshift Deep Dive: Tuning and Best Practices
(BDT401) Amazon Redshift Deep Dive: Tuning and Best Practices
 
(DAT407) Amazon ElastiCache: Deep Dive
(DAT407) Amazon ElastiCache: Deep Dive(DAT407) Amazon ElastiCache: Deep Dive
(DAT407) Amazon ElastiCache: Deep Dive
 
Solr Recipes
Solr RecipesSolr Recipes
Solr Recipes
 
Redis in 20 minutes
Redis in 20 minutesRedis in 20 minutes
Redis in 20 minutes
 
Redshift overview
Redshift overviewRedshift overview
Redshift overview
 
Introduction to Hadoop and Big Data
Introduction to Hadoop and Big DataIntroduction to Hadoop and Big Data
Introduction to Hadoop and Big Data
 

Redis

  • 1. Introduction to Redis Byeongweon Moon / Redduck
  • 2. Ready to Redis • Document-oriented Database • Key-Value Data Store Program • Key can contain strings, hashes, lists, sets and sorted sets • Value can contain strings, lists, sets, sorted set • Redis use RAM for data store
  • 3. Key-Value Data Store • Insert data with specific key • Get data with key by O(1) compexity • Value can contain structured strings like as JSON, XML
  • 4. List Control • SET : LINSERT, LPUSH, RPUSH, LSET • GET : LPOP, LRANGE, RPOP • DEL : LREM • ETC : LTRIM, LLEN
  • 5. Pushing IDs instead of the actual data $ redis-cli incr next.news.id (integer) 1 $ redis-cli set news:1:title "Redis is simple" OK $ redis-cli set news:1:url "http://code.google.com/p/redis" OK $ redis-cli lpush submitted.news 1 OK $ redis-cli lrange submitted.news 0 -1 1) “1”
  • 6. Set Control • SET : SADD, • GET : SPOP, SRANDMEMBER, SMEMBERS • DEL : SREM • ETC : SINTER, SUNION, SCARD, SDIFF, SMOVE, SISMEMBER
  • 7. Redis Sets $ redis-cli sadd news:1000:tags 1 (integer) 1 $ redis-cli sadd news:1000:tags 2 (integer) 1 $ redis-cli sadd news:1000:tags 5 (integer) 1 $ redis-cli sadd tag:1:objects 1000 (integer) 1 $ redis-cli sadd tag:2:objects 1000 (integer) 1 $ redis-cli sadd tag:5:objects 1000 (integer) 1 $ redis-cli sinter tag:1:objects tag:2:objects tag:5:objects 1000 1) “1000”
  • 8. Sorted Set Control • SET : ZADD, ZINCRBY • GET : ZRANGE, ZRANGEBYSCORE, ZSCORE, ZCARD, ZRANK, ZCOUNT • DEL : ZREM, ZREMRANGEBYRANK, ZREMRANGEBYSCORE • ETC : ZINTERSTORE, Z UNIONSTORE
  • 9. Sorted sets $ redis-cli zadd hackers 1940 "Alan Kay" (integer) 1 $ redis-cli zadd hackers 1953 "Richard Stallman" (integer) 1 $ redis-cli zadd hackers 1969 "Linus Torvalds" (integer) 1 $ redis-cli zadd hackers 1912 "Alan Turing" (integer) 1 $ redis-cli zrange hackers 0 -1 1. Alan Turing 2. Alan Kay 3. Richard Stallman 4. Linus Torvalds
  • 10. Replication • Master-Slave replication • Master can have multiple slaves • Slaves are able to accept other slaves connections • Slaves can also be connected to other slaves in graph-like structure • Redis replication is non-blocking on the master side. but blocking on the slave side.
  • 11. How replication works • To configure add below line to slave's configuration file slaveof IP PORT • After configuration done. when upon connection slave sends a SYNC command • Master start background data saving and collect all new commands received that will modify dataset • When background saving complete, transfers the dataset to slave, then send saved commands
  • 12. Publish / Subcribe • Messaging pattern where senders of messages do not program the messages to be sent directly to specific receiver. • SUBCRIBE [channel] command create channel or subscribe channel • PUBLISH [channel] [message] command send message via • Support pattern matching subscribe with PSUBSCRIBE
  • 13. Pipelining • Whatever network speed fast or slow, there's always latency. • To avoid network latency. Redis support multi commands send with one request. • Send commands with new line delemiter echo -en "PINGrnPINGrnPINGrn" | nc localhost 6379 • Result wiil received after all commands processed
  • 15. Who's using Redis? • Twitter • github • stackoverflow • blizzard • digg • .....

Editor's Notes

  1. 리스트 형태로 이루어져 있으며 , index 를 통한 접근이 가능하고 , 중간에 데이터를 추가할 수 있다 .
  2. 데이터를 중간에 추가하거나 인덱스를 이용한 접근이 불가능 . Set 간의 집합 연산을 이용할 수 있다 .
  3. 데이터를 중간에 추가하거나 인덱스를 이용한 접근이 불가능 . Set 간의 집합 연산을 이용할 수 있다 .