SlideShare a Scribd company logo
1 of 20
Download to read offline
A Brief Introduction to
Redis
Charles Anderson	

!

Salem Dynamic Languages User Group	

January 2014
Overview
• Redis is a networked “data structure
server”	


• Fast, powerful, simple
Abstract Data Types
• In the Before Time, we didn’t have classes
and objects - we had abstract data types	


•

and, we liked it!	


• Procedural interface	

• First (or last) parameter is the ADT
Example: Stack
• push(stack, item)	

• pop(stack): item	

• size(stack): int	

• etc.
Stack ADT
• We had a single, global name space. So:	

• stack_push(stack, item)	

• stack_pop(stack)	

• stack_size(stack)	

• This is what the Redis API looks like
Redis Types
• String - scalar value	

• List	

• Set	

• Sorted Set	

• Hash
Redis List
• A small subset of the operations:	

• LPUSH key value	

• LPOP key	

• LLEN key	

• LRANGE key start stop
Redis API
• Every object has a name/key	

• First parameter to each call	

• Every object has a type	

• Operation must match the type of object
Using API via CLI
$ redis-cli	
redis 127.0.0.1:6379> lpush mylist 1	
(integer) 1	
redis 127.0.0.1:6379> lpush mylist cat	
(integer) 2	
redis 127.0.0.1:6379> lpush mylist 3.14	
(integer) 3	
redis 127.0.0.1:6379> llen mylist	
(integer) 3	
redis 127.0.0.1:6379> lrange mylist 0 1	
1) "3.14"	
2) "cat"	
redis 127.0.0.1:6379> lrange mylist 0 -1	
1) "3.14"	
2) "cat"	
3) "1"
Redis Clients
• The wire protocol for Redis is dead-simple	

• Therefore, lots of clients for lots of
languages
Ruby Client Demo
irb(main):015:0> r.lpush('mylist', 1)	
=> 1	
irb(main):016:0> r.lpush('mylist', 'cat')	
=> 2	
irb(main):017:0> r.lpush('mylist', 3.14)	
=> 3	
irb(main):019:0> r.lrange('mylist', 0, -1)	
=> ["3.14", "cat", "1"]
Complete Redis API
• http://redis.io/commands	

• Each command includes the time

complexity of the operation - unique
Set
• SADD key member, SREM key member	

• SCARD key	

• SISMEMEBER key member	

• SINTER, SUNION
Sorted Set
• ZADD key score member	

• ZSCORE key member	

• ZRANK key member	

• ZRANGE key start stop	

• Use case: leader board
Hash
• HSET key field value	

• HGET key field	

• HEXISTS key field, HKEYS, HLEN	

• Use case: a structured record like User
Other Stuff
• Key Expiration	

• Transactions/batches	

• Publish-Subscribe	

• Server-side scripting via Lua	

• Replication	

• Clustering
Implementation Details
• Everything is stored in memory	

•
•

Hella fast	

Not memcache - expiration is not LRU	


• Persistent - tunable disk storage	

• Single-threaded - simple, fast, single CPU	

• Support (@antirez) is awesome
But, is it Web
Scale?
• NoSQL key/value store	

• Kickass benchmarks	

• Simpler (smaller scope) than HBase or
Cassandra	


• Sharding done by clients	

• Not usually a system of record	

• I already work on a farm
More Information
• http://redis.io	

• “The Little Redis Book” Seguin	

• “Redis in Action” Carlson	

• “Redis Cookbook” Macedo and Oliveira
Questions

•?

More Related Content

What's hot

Introduction to redis
Introduction to redisIntroduction to redis
Introduction to redisTanu Siwag
 
Introduction to redis - version 2
Introduction to redis - version 2Introduction to redis - version 2
Introduction to redis - version 2Dvir Volk
 
Redis Introduction
Redis IntroductionRedis Introduction
Redis IntroductionAlex Su
 
Redis modules 101
Redis modules 101Redis modules 101
Redis modules 101Dvir Volk
 
Redis 101 Data Structure
Redis 101 Data StructureRedis 101 Data Structure
Redis 101 Data StructureIsmaeel Enjreny
 
Redis Indices (#RedisTLV)
Redis Indices (#RedisTLV)Redis Indices (#RedisTLV)
Redis Indices (#RedisTLV)Itamar Haber
 
Introduction to Redis
Introduction to RedisIntroduction to Redis
Introduction to RedisArnab Mitra
 
This is redis - feature and usecase
This is redis - feature and usecaseThis is redis - feature and usecase
This is redis - feature and usecaseKris Jeong
 
Boosting Machine Learning with Redis Modules and Spark
Boosting Machine Learning with Redis Modules and SparkBoosting Machine Learning with Redis Modules and Spark
Boosting Machine Learning with Redis Modules and SparkDvir Volk
 
Real time fulltext search with sphinx
Real time fulltext search with sphinxReal time fulltext search with sphinx
Real time fulltext search with sphinxAdrian Nuta
 
Redis in Practice: Scenarios, Performance and Practice with PHP
Redis in Practice: Scenarios, Performance and Practice with PHPRedis in Practice: Scenarios, Performance and Practice with PHP
Redis in Practice: Scenarios, Performance and Practice with PHPChen Huang
 
Introduction to Redis
Introduction to RedisIntroduction to Redis
Introduction to RedisKnoldus Inc.
 
Sharding
ShardingSharding
ShardingMongoDB
 

What's hot (20)

Introduction to redis
Introduction to redisIntroduction to redis
Introduction to redis
 
Introduction to redis - version 2
Introduction to redis - version 2Introduction to redis - version 2
Introduction to redis - version 2
 
Redis 101
Redis 101Redis 101
Redis 101
 
Introduction to redis
Introduction to redisIntroduction to redis
Introduction to redis
 
Redis Introduction
Redis IntroductionRedis Introduction
Redis Introduction
 
Redis modules 101
Redis modules 101Redis modules 101
Redis modules 101
 
Introduction to Redis
Introduction to RedisIntroduction to Redis
Introduction to Redis
 
Redis 101 Data Structure
Redis 101 Data StructureRedis 101 Data Structure
Redis 101 Data Structure
 
Redis Indices (#RedisTLV)
Redis Indices (#RedisTLV)Redis Indices (#RedisTLV)
Redis Indices (#RedisTLV)
 
Introduction to Redis
Introduction to RedisIntroduction to Redis
Introduction to Redis
 
Redis basics
Redis basicsRedis basics
Redis basics
 
This is redis - feature and usecase
This is redis - feature and usecaseThis is redis - feature and usecase
This is redis - feature and usecase
 
Boosting Machine Learning with Redis Modules and Spark
Boosting Machine Learning with Redis Modules and SparkBoosting Machine Learning with Redis Modules and Spark
Boosting Machine Learning with Redis Modules and Spark
 
Redis database
Redis databaseRedis database
Redis database
 
Real time fulltext search with sphinx
Real time fulltext search with sphinxReal time fulltext search with sphinx
Real time fulltext search with sphinx
 
Redis in Practice: Scenarios, Performance and Practice with PHP
Redis in Practice: Scenarios, Performance and Practice with PHPRedis in Practice: Scenarios, Performance and Practice with PHP
Redis in Practice: Scenarios, Performance and Practice with PHP
 
Introduction to Redis
Introduction to RedisIntroduction to Redis
Introduction to Redis
 
redis basics
redis basicsredis basics
redis basics
 
Sharding
ShardingSharding
Sharding
 
Introduction to Redis
Introduction to RedisIntroduction to Redis
Introduction to Redis
 

Viewers also liked

工程实战
工程实战工程实战
工程实战20004
 
How to get a Software Job w/o Experience
How to get a Software Job w/o ExperienceHow to get a Software Job w/o Experience
How to get a Software Job w/o ExperienceCharles Anderson
 
November 18 General Meeting
November 18 General MeetingNovember 18 General Meeting
November 18 General MeetingMSU PRSSA
 
New era of stakeholder engagement
New era of stakeholder engagementNew era of stakeholder engagement
New era of stakeholder engagementBen Lowndes
 
How To Protect Yourself and Your Computer Online
How To Protect Yourself and Your Computer OnlineHow To Protect Yourself and Your Computer Online
How To Protect Yourself and Your Computer OnlineCharles Anderson
 
A Shallow Survey of Alternative Languages on the JVM
A Shallow Survey of Alternative Languages on the JVMA Shallow Survey of Alternative Languages on the JVM
A Shallow Survey of Alternative Languages on the JVMCharles Anderson
 
September 2 General Meeting
September 2 General MeetingSeptember 2 General Meeting
September 2 General MeetingMSU PRSSA
 
20040430162931
2004043016293120040430162931
2004043016293120004
 
积极的心态
积极的心态积极的心态
积极的心态20004
 
8020法则.
8020法则.8020法则.
8020法则.20004
 
West of England Joint Spatial Plan - what the media is saying
West of England Joint Spatial Plan - what the media is sayingWest of England Joint Spatial Plan - what the media is saying
West of England Joint Spatial Plan - what the media is sayingBen Lowndes
 
员工日常行为扣分条例
员工日常行为扣分条例员工日常行为扣分条例
员工日常行为扣分条例20004
 
高级销售技巧
高级销售技巧高级销售技巧
高级销售技巧20004
 
Above quiz prelims with answers nov 2010
Above quiz prelims with answers nov 2010Above quiz prelims with answers nov 2010
Above quiz prelims with answers nov 2010Venkatesh Srinivasan
 
卓越销售
卓越销售卓越销售
卓越销售20004
 
2009 年的祝福1
2009 年的祝福12009 年的祝福1
2009 年的祝福1jimmy wei
 
September 16 General Meeting
September 16 General MeetingSeptember 16 General Meeting
September 16 General MeetingMSU PRSSA
 

Viewers also liked (20)

工程实战
工程实战工程实战
工程实战
 
How to get a Software Job w/o Experience
How to get a Software Job w/o ExperienceHow to get a Software Job w/o Experience
How to get a Software Job w/o Experience
 
November 18 General Meeting
November 18 General MeetingNovember 18 General Meeting
November 18 General Meeting
 
New era of stakeholder engagement
New era of stakeholder engagementNew era of stakeholder engagement
New era of stakeholder engagement
 
How To Protect Yourself and Your Computer Online
How To Protect Yourself and Your Computer OnlineHow To Protect Yourself and Your Computer Online
How To Protect Yourself and Your Computer Online
 
A Shallow Survey of Alternative Languages on the JVM
A Shallow Survey of Alternative Languages on the JVMA Shallow Survey of Alternative Languages on the JVM
A Shallow Survey of Alternative Languages on the JVM
 
September 2 General Meeting
September 2 General MeetingSeptember 2 General Meeting
September 2 General Meeting
 
7
77
7
 
20040430162931
2004043016293120040430162931
20040430162931
 
积极的心态
积极的心态积极的心态
积极的心态
 
8020法则.
8020法则.8020法则.
8020法则.
 
West of England Joint Spatial Plan - what the media is saying
West of England Joint Spatial Plan - what the media is sayingWest of England Joint Spatial Plan - what the media is saying
West of England Joint Spatial Plan - what the media is saying
 
Psychotactics Uniqueness
Psychotactics UniquenessPsychotactics Uniqueness
Psychotactics Uniqueness
 
员工日常行为扣分条例
员工日常行为扣分条例员工日常行为扣分条例
员工日常行为扣分条例
 
1
11
1
 
高级销售技巧
高级销售技巧高级销售技巧
高级销售技巧
 
Above quiz prelims with answers nov 2010
Above quiz prelims with answers nov 2010Above quiz prelims with answers nov 2010
Above quiz prelims with answers nov 2010
 
卓越销售
卓越销售卓越销售
卓越销售
 
2009 年的祝福1
2009 年的祝福12009 年的祝福1
2009 年的祝福1
 
September 16 General Meeting
September 16 General MeetingSeptember 16 General Meeting
September 16 General Meeting
 

Similar to A Brief Introduction to Redis

Redis Use Patterns (DevconTLV June 2014)
Redis Use Patterns (DevconTLV June 2014)Redis Use Patterns (DevconTLV June 2014)
Redis Use Patterns (DevconTLV June 2014)Itamar Haber
 
Introduction to Redis
Introduction to RedisIntroduction to Redis
Introduction to RedisItamar Haber
 
05 integrate redis
05 integrate redis05 integrate redis
05 integrate redisErhwen Kuo
 
Redis Everywhere - Sunshine PHP
Redis Everywhere - Sunshine PHPRedis Everywhere - Sunshine PHP
Redis Everywhere - Sunshine PHPRicard Clau
 
Ruby on Rails & PostgreSQL - v2
Ruby on Rails & PostgreSQL - v2Ruby on Rails & PostgreSQL - v2
Ruby on Rails & PostgreSQL - v2John Ashmead
 
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: REmote DIctionary Server
Redis: REmote DIctionary ServerRedis: REmote DIctionary Server
Redis: REmote DIctionary ServerEzra Zygmuntowicz
 
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 VolkSpark Summit
 
Modern, Scalable, Ambitious apps with Ember.js
Modern, Scalable, Ambitious apps with Ember.jsModern, Scalable, Ambitious apps with Ember.js
Modern, Scalable, Ambitious apps with Ember.jsMike North
 
Hadoop M/R Pig Hive
Hadoop M/R Pig HiveHadoop M/R Pig Hive
Hadoop M/R Pig Hivezahid-mian
 
An introduction to Rails 3
An introduction to Rails 3An introduction to Rails 3
An introduction to Rails 3Blazing Cloud
 
Building Scalable, Distributed Job Queues with Redis and Redis::Client
Building Scalable, Distributed Job Queues with Redis and Redis::ClientBuilding Scalable, Distributed Job Queues with Redis and Redis::Client
Building Scalable, Distributed Job Queues with Redis and Redis::ClientMike Friedman
 
Redis Modules - Redis India Tour - 2017
Redis Modules - Redis India Tour - 2017Redis Modules - Redis India Tour - 2017
Redis Modules - Redis India Tour - 2017HashedIn Technologies
 

Similar to A Brief Introduction to Redis (20)

Redis Use Patterns (DevconTLV June 2014)
Redis Use Patterns (DevconTLV June 2014)Redis Use Patterns (DevconTLV June 2014)
Redis Use Patterns (DevconTLV June 2014)
 
Python redis talk
Python redis talkPython redis talk
Python redis talk
 
Introduction to Redis
Introduction to RedisIntroduction to Redis
Introduction to Redis
 
05 integrate redis
05 integrate redis05 integrate redis
05 integrate redis
 
REDIS327
REDIS327REDIS327
REDIS327
 
Redis Everywhere - Sunshine PHP
Redis Everywhere - Sunshine PHPRedis Everywhere - Sunshine PHP
Redis Everywhere - Sunshine PHP
 
Ruby on Rails & PostgreSQL - v2
Ruby on Rails & PostgreSQL - v2Ruby on Rails & PostgreSQL - v2
Ruby on Rails & PostgreSQL - v2
 
Azure Redis Cache - Cache on Steroids!
Azure Redis Cache - Cache on Steroids!Azure Redis Cache - Cache on Steroids!
Azure Redis Cache - Cache on Steroids!
 
Wider than rails
Wider than railsWider than rails
Wider than rails
 
Redis: REmote DIctionary Server
Redis: REmote DIctionary ServerRedis: REmote DIctionary Server
Redis: REmote DIctionary Server
 
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 Labcamp
Redis LabcampRedis Labcamp
Redis Labcamp
 
Modern, Scalable, Ambitious apps with Ember.js
Modern, Scalable, Ambitious apps with Ember.jsModern, Scalable, Ambitious apps with Ember.js
Modern, Scalable, Ambitious apps with Ember.js
 
Hadoop M/R Pig Hive
Hadoop M/R Pig HiveHadoop M/R Pig Hive
Hadoop M/R Pig Hive
 
KeyValue Stores
KeyValue StoresKeyValue Stores
KeyValue Stores
 
An introduction to Rails 3
An introduction to Rails 3An introduction to Rails 3
An introduction to Rails 3
 
Building Scalable, Distributed Job Queues with Redis and Redis::Client
Building Scalable, Distributed Job Queues with Redis and Redis::ClientBuilding Scalable, Distributed Job Queues with Redis and Redis::Client
Building Scalable, Distributed Job Queues with Redis and Redis::Client
 
Osd ctw spark
Osd ctw sparkOsd ctw spark
Osd ctw spark
 
Rack
RackRack
Rack
 
Redis Modules - Redis India Tour - 2017
Redis Modules - Redis India Tour - 2017Redis Modules - Redis India Tour - 2017
Redis Modules - Redis India Tour - 2017
 

More from Charles Anderson

Docker - Hack Salem! - November 2014
Docker - Hack Salem! - November 2014Docker - Hack Salem! - November 2014
Docker - Hack Salem! - November 2014Charles Anderson
 
How to Get a Software Job w/o Experience
How to Get a Software Job w/o ExperienceHow to Get a Software Job w/o Experience
How to Get a Software Job w/o ExperienceCharles Anderson
 
Jython: Integrating Python and Java
Jython: Integrating Python and JavaJython: Integrating Python and Java
Jython: Integrating Python and JavaCharles Anderson
 
Groovy a Scripting Language for Java
Groovy a Scripting Language for JavaGroovy a Scripting Language for Java
Groovy a Scripting Language for JavaCharles Anderson
 

More from Charles Anderson (7)

Modern php
Modern phpModern php
Modern php
 
Literate Programming
Literate ProgrammingLiterate Programming
Literate Programming
 
Inrastructure as Code
Inrastructure as CodeInrastructure as Code
Inrastructure as Code
 
Docker - Hack Salem! - November 2014
Docker - Hack Salem! - November 2014Docker - Hack Salem! - November 2014
Docker - Hack Salem! - November 2014
 
How to Get a Software Job w/o Experience
How to Get a Software Job w/o ExperienceHow to Get a Software Job w/o Experience
How to Get a Software Job w/o Experience
 
Jython: Integrating Python and Java
Jython: Integrating Python and JavaJython: Integrating Python and Java
Jython: Integrating Python and Java
 
Groovy a Scripting Language for Java
Groovy a Scripting Language for JavaGroovy a Scripting Language for Java
Groovy a Scripting Language for Java
 

Recently uploaded

The Importance of Indoor Air Quality (English)
The Importance of Indoor Air Quality (English)The Importance of Indoor Air Quality (English)
The Importance of Indoor Air Quality (English)IES VE
 
LF Energy Webinar - Unveiling OpenEEMeter 4.0
LF Energy Webinar - Unveiling OpenEEMeter 4.0LF Energy Webinar - Unveiling OpenEEMeter 4.0
LF Energy Webinar - Unveiling OpenEEMeter 4.0DanBrown980551
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfCheryl Hung
 
2024.03.12 Cost drivers of cultivated meat production.pdf
2024.03.12 Cost drivers of cultivated meat production.pdf2024.03.12 Cost drivers of cultivated meat production.pdf
2024.03.12 Cost drivers of cultivated meat production.pdfThe Good Food Institute
 
March Patch Tuesday
March Patch TuesdayMarch Patch Tuesday
March Patch TuesdayIvanti
 
CyberSecurity - Computers In Libraries 2024
CyberSecurity - Computers In Libraries 2024CyberSecurity - Computers In Libraries 2024
CyberSecurity - Computers In Libraries 2024Brian Pichman
 
20140402 - Smart house demo kit
20140402 - Smart house demo kit20140402 - Smart house demo kit
20140402 - Smart house demo kitJamie (Taka) Wang
 
Extra-120324-Visite-Entreprise-icare.pdf
Extra-120324-Visite-Entreprise-icare.pdfExtra-120324-Visite-Entreprise-icare.pdf
Extra-120324-Visite-Entreprise-icare.pdfInfopole1
 
EMEA What is ThousandEyes? Webinar
EMEA What is ThousandEyes? WebinarEMEA What is ThousandEyes? Webinar
EMEA What is ThousandEyes? WebinarThousandEyes
 
Design and Modeling for MySQL SCALE 21X Pasadena, CA Mar 2024
Design and Modeling for MySQL SCALE 21X Pasadena, CA Mar 2024Design and Modeling for MySQL SCALE 21X Pasadena, CA Mar 2024
Design and Modeling for MySQL SCALE 21X Pasadena, CA Mar 2024Alkin Tezuysal
 
Introduction - IPLOOK NETWORKS CO., LTD.
Introduction - IPLOOK NETWORKS CO., LTD.Introduction - IPLOOK NETWORKS CO., LTD.
Introduction - IPLOOK NETWORKS CO., LTD.IPLOOK Networks
 
TrustArc Webinar - How to Live in a Post Third-Party Cookie World
TrustArc Webinar - How to Live in a Post Third-Party Cookie WorldTrustArc Webinar - How to Live in a Post Third-Party Cookie World
TrustArc Webinar - How to Live in a Post Third-Party Cookie WorldTrustArc
 
UiPath Studio Web workshop series - Day 1
UiPath Studio Web workshop series  - Day 1UiPath Studio Web workshop series  - Day 1
UiPath Studio Web workshop series - Day 1DianaGray10
 
Technical SEO for Improved Accessibility WTS FEST
Technical SEO for Improved Accessibility  WTS FESTTechnical SEO for Improved Accessibility  WTS FEST
Technical SEO for Improved Accessibility WTS FESTBillieHyde
 
GraphSummit Copenhagen 2024 - Neo4j Vision and Roadmap.pptx
GraphSummit Copenhagen 2024 - Neo4j Vision and Roadmap.pptxGraphSummit Copenhagen 2024 - Neo4j Vision and Roadmap.pptx
GraphSummit Copenhagen 2024 - Neo4j Vision and Roadmap.pptxNeo4j
 
Outage Analysis: March 5th/6th 2024 Meta, Comcast, and LinkedIn
Outage Analysis: March 5th/6th 2024 Meta, Comcast, and LinkedInOutage Analysis: March 5th/6th 2024 Meta, Comcast, and LinkedIn
Outage Analysis: March 5th/6th 2024 Meta, Comcast, and LinkedInThousandEyes
 
Emil Eifrem at GraphSummit Copenhagen 2024 - The Art of the Possible.pptx
Emil Eifrem at GraphSummit Copenhagen 2024 - The Art of the Possible.pptxEmil Eifrem at GraphSummit Copenhagen 2024 - The Art of the Possible.pptx
Emil Eifrem at GraphSummit Copenhagen 2024 - The Art of the Possible.pptxNeo4j
 
How to become a GDSC Lead GDSC MI AOE.pptx
How to become a GDSC Lead GDSC MI AOE.pptxHow to become a GDSC Lead GDSC MI AOE.pptx
How to become a GDSC Lead GDSC MI AOE.pptxKaustubhBhavsar6
 
SIM INFORMATION SYSTEM: REVOLUTIONIZING DATA MANAGEMENT
SIM INFORMATION SYSTEM: REVOLUTIONIZING DATA MANAGEMENTSIM INFORMATION SYSTEM: REVOLUTIONIZING DATA MANAGEMENT
SIM INFORMATION SYSTEM: REVOLUTIONIZING DATA MANAGEMENTxtailishbaloch
 
Q4 2023 Quarterly Investor Presentation - FINAL - v1.pdf
Q4 2023 Quarterly Investor Presentation - FINAL - v1.pdfQ4 2023 Quarterly Investor Presentation - FINAL - v1.pdf
Q4 2023 Quarterly Investor Presentation - FINAL - v1.pdfTejal81
 

Recently uploaded (20)

The Importance of Indoor Air Quality (English)
The Importance of Indoor Air Quality (English)The Importance of Indoor Air Quality (English)
The Importance of Indoor Air Quality (English)
 
LF Energy Webinar - Unveiling OpenEEMeter 4.0
LF Energy Webinar - Unveiling OpenEEMeter 4.0LF Energy Webinar - Unveiling OpenEEMeter 4.0
LF Energy Webinar - Unveiling OpenEEMeter 4.0
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
2024.03.12 Cost drivers of cultivated meat production.pdf
2024.03.12 Cost drivers of cultivated meat production.pdf2024.03.12 Cost drivers of cultivated meat production.pdf
2024.03.12 Cost drivers of cultivated meat production.pdf
 
March Patch Tuesday
March Patch TuesdayMarch Patch Tuesday
March Patch Tuesday
 
CyberSecurity - Computers In Libraries 2024
CyberSecurity - Computers In Libraries 2024CyberSecurity - Computers In Libraries 2024
CyberSecurity - Computers In Libraries 2024
 
20140402 - Smart house demo kit
20140402 - Smart house demo kit20140402 - Smart house demo kit
20140402 - Smart house demo kit
 
Extra-120324-Visite-Entreprise-icare.pdf
Extra-120324-Visite-Entreprise-icare.pdfExtra-120324-Visite-Entreprise-icare.pdf
Extra-120324-Visite-Entreprise-icare.pdf
 
EMEA What is ThousandEyes? Webinar
EMEA What is ThousandEyes? WebinarEMEA What is ThousandEyes? Webinar
EMEA What is ThousandEyes? Webinar
 
Design and Modeling for MySQL SCALE 21X Pasadena, CA Mar 2024
Design and Modeling for MySQL SCALE 21X Pasadena, CA Mar 2024Design and Modeling for MySQL SCALE 21X Pasadena, CA Mar 2024
Design and Modeling for MySQL SCALE 21X Pasadena, CA Mar 2024
 
Introduction - IPLOOK NETWORKS CO., LTD.
Introduction - IPLOOK NETWORKS CO., LTD.Introduction - IPLOOK NETWORKS CO., LTD.
Introduction - IPLOOK NETWORKS CO., LTD.
 
TrustArc Webinar - How to Live in a Post Third-Party Cookie World
TrustArc Webinar - How to Live in a Post Third-Party Cookie WorldTrustArc Webinar - How to Live in a Post Third-Party Cookie World
TrustArc Webinar - How to Live in a Post Third-Party Cookie World
 
UiPath Studio Web workshop series - Day 1
UiPath Studio Web workshop series  - Day 1UiPath Studio Web workshop series  - Day 1
UiPath Studio Web workshop series - Day 1
 
Technical SEO for Improved Accessibility WTS FEST
Technical SEO for Improved Accessibility  WTS FESTTechnical SEO for Improved Accessibility  WTS FEST
Technical SEO for Improved Accessibility WTS FEST
 
GraphSummit Copenhagen 2024 - Neo4j Vision and Roadmap.pptx
GraphSummit Copenhagen 2024 - Neo4j Vision and Roadmap.pptxGraphSummit Copenhagen 2024 - Neo4j Vision and Roadmap.pptx
GraphSummit Copenhagen 2024 - Neo4j Vision and Roadmap.pptx
 
Outage Analysis: March 5th/6th 2024 Meta, Comcast, and LinkedIn
Outage Analysis: March 5th/6th 2024 Meta, Comcast, and LinkedInOutage Analysis: March 5th/6th 2024 Meta, Comcast, and LinkedIn
Outage Analysis: March 5th/6th 2024 Meta, Comcast, and LinkedIn
 
Emil Eifrem at GraphSummit Copenhagen 2024 - The Art of the Possible.pptx
Emil Eifrem at GraphSummit Copenhagen 2024 - The Art of the Possible.pptxEmil Eifrem at GraphSummit Copenhagen 2024 - The Art of the Possible.pptx
Emil Eifrem at GraphSummit Copenhagen 2024 - The Art of the Possible.pptx
 
How to become a GDSC Lead GDSC MI AOE.pptx
How to become a GDSC Lead GDSC MI AOE.pptxHow to become a GDSC Lead GDSC MI AOE.pptx
How to become a GDSC Lead GDSC MI AOE.pptx
 
SIM INFORMATION SYSTEM: REVOLUTIONIZING DATA MANAGEMENT
SIM INFORMATION SYSTEM: REVOLUTIONIZING DATA MANAGEMENTSIM INFORMATION SYSTEM: REVOLUTIONIZING DATA MANAGEMENT
SIM INFORMATION SYSTEM: REVOLUTIONIZING DATA MANAGEMENT
 
Q4 2023 Quarterly Investor Presentation - FINAL - v1.pdf
Q4 2023 Quarterly Investor Presentation - FINAL - v1.pdfQ4 2023 Quarterly Investor Presentation - FINAL - v1.pdf
Q4 2023 Quarterly Investor Presentation - FINAL - v1.pdf
 

A Brief Introduction to Redis

  • 1. A Brief Introduction to Redis Charles Anderson ! Salem Dynamic Languages User Group January 2014
  • 2. Overview • Redis is a networked “data structure server” • Fast, powerful, simple
  • 3. Abstract Data Types • In the Before Time, we didn’t have classes and objects - we had abstract data types • and, we liked it! • Procedural interface • First (or last) parameter is the ADT
  • 4. Example: Stack • push(stack, item) • pop(stack): item • size(stack): int • etc.
  • 5. Stack ADT • We had a single, global name space. So: • stack_push(stack, item) • stack_pop(stack) • stack_size(stack) • This is what the Redis API looks like
  • 6. Redis Types • String - scalar value • List • Set • Sorted Set • Hash
  • 7. Redis List • A small subset of the operations: • LPUSH key value • LPOP key • LLEN key • LRANGE key start stop
  • 8. Redis API • Every object has a name/key • First parameter to each call • Every object has a type • Operation must match the type of object
  • 9. Using API via CLI $ redis-cli redis 127.0.0.1:6379> lpush mylist 1 (integer) 1 redis 127.0.0.1:6379> lpush mylist cat (integer) 2 redis 127.0.0.1:6379> lpush mylist 3.14 (integer) 3 redis 127.0.0.1:6379> llen mylist (integer) 3 redis 127.0.0.1:6379> lrange mylist 0 1 1) "3.14" 2) "cat" redis 127.0.0.1:6379> lrange mylist 0 -1 1) "3.14" 2) "cat" 3) "1"
  • 10. Redis Clients • The wire protocol for Redis is dead-simple • Therefore, lots of clients for lots of languages
  • 11. Ruby Client Demo irb(main):015:0> r.lpush('mylist', 1) => 1 irb(main):016:0> r.lpush('mylist', 'cat') => 2 irb(main):017:0> r.lpush('mylist', 3.14) => 3 irb(main):019:0> r.lrange('mylist', 0, -1) => ["3.14", "cat", "1"]
  • 12. Complete Redis API • http://redis.io/commands • Each command includes the time complexity of the operation - unique
  • 13. Set • SADD key member, SREM key member • SCARD key • SISMEMEBER key member • SINTER, SUNION
  • 14. Sorted Set • ZADD key score member • ZSCORE key member • ZRANK key member • ZRANGE key start stop • Use case: leader board
  • 15. Hash • HSET key field value • HGET key field • HEXISTS key field, HKEYS, HLEN • Use case: a structured record like User
  • 16. Other Stuff • Key Expiration • Transactions/batches • Publish-Subscribe • Server-side scripting via Lua • Replication • Clustering
  • 17. Implementation Details • Everything is stored in memory • • Hella fast Not memcache - expiration is not LRU • Persistent - tunable disk storage • Single-threaded - simple, fast, single CPU • Support (@antirez) is awesome
  • 18. But, is it Web Scale? • NoSQL key/value store • Kickass benchmarks • Simpler (smaller scope) than HBase or Cassandra • Sharding done by clients • Not usually a system of record • I already work on a farm
  • 19. More Information • http://redis.io • “The Little Redis Book” Seguin • “Redis in Action” Carlson • “Redis Cookbook” Macedo and Oliveira