SlideShare a Scribd company logo
ARE YOU REDIS TO GO ?
MAXIME LEMAITRE – 10/04/2014
1
> GET agenda
> GET introduction
> SMEMBERS datatypes
> INFO commands
> CLIENT LIST
> PSUBSCRIBE performance?
> LRANGE features 0 3
persitence
transaction
replication
pubsub
> ZREVRANGE usecases 0 -1
> SEGFAULT
> ?
I see Redis definitely more as a flexible tool
that as a solution specialized to solve a
specific problem: his mixed soul of cache,
store, and messaging server shows this
very well - Salvatore Sanfilippo (antirez),
creator of Redis
2
Brief Introduction
• Redis is an open source (since March 2009), advanced key-value
store. It is often referred to as a data structure server since keys
can contain strings, hashes, lists, sets and sorted sets.
• Originally written in order to help address the scaling needs of
http://lloogg.com/, a web analytics startup, by Salvatore (antirez)
Sanfilippo.
• Redis is written in ANSI C and works in most POSIX systems like
Linux, *BSD, OS X and Solaris without external dependencies. Redis
project does not directly support Windows, however MSOpenTech
develops and maintains an Windows port targeting Win64.
3
Command Processing
http://redis.io/commands
• Protocol RESP
– clients communicate with the Redis using REdis Serialization Protocol
• Simple, Fast & Human readable
– Commands are processed in serial in a single thread (like Node.js)
• Superfast processing of commands (a few ms, sometimes less)
• If you want to use more CPUs, shard your data client-side
• Command groups
– Request/response
– Pipelined: Several requests / responses
– Transactions:
• Traditional: Several requests processed in order atomically
• Check-And-Set: Request(s), data manipulation in client, more
requests
– Scripts (>v2.6): execute client-defined Lua scripts in the server for
more complex actions 4
What is a Command ?
http://redis.io/commands
Command name + parameters >
Version >
Complexity (really important) >
Description >
Result/return value >
Example >
Approx. 160 available
commands 5
Data Types
List Set Sorted Set Hash
[A, B, C, D]
“A”
“B”
“C”
“D”
D
C
B
A
A:3
C:1
D:2
B:4
{A, B, C, D} {C:1, D:2, A:3, D:4}
“A”
“B”
“C”
“D”
field1
field2
field3
field4
{field1:“A”, field2:“B”…}
{value:score} {key:value}
Basically maps keys to values (Strings), but also contains more advanced data
structures here :
* New Data Structure since April, 1st : HyperLogLog 6
Popular .net clients
Many clients for nearly all languages
• ActionScript
• C / C++
• C#
• Clojure
• Lisp
• Dart
• Erlang
• Fancy
• Go
• Haskell
• haXe
• Io
• Java
• Lua
• Node.js
• Objective-C
• Perl
• PHP
• Python
• Ruby
• Scala
• Smalltalk
• Tcl
7
How fast is Redis ?
(note : it’s common a manage millions of keys)
Redis includes the redis-benchmark utility that simulates running commands done by
N clients at the same time sending M total queries.
• Example on Intel(R) Xeon(R) CPU E5520 @ 2.27GHz (without pipelining)
Commands are generally processed in a few ms. Network
bandwidth and latency usually have a direct impact on the
performance. CPU is another very important factor. 8
Redis Feature : Persistence
http://redis.io/topics/persistence
Redis provides a different range of persistence options: RDB, AOF and None.
• RDB
– Periodic, asynchronous dump to disk
– Can be every N changes or every N seconds
– Written to file in “dbfilename”.rdb (could be backup elsewhere)
– may loss several minutes during a crash
• AOF
– Copies incoming commands as it happens
– Log-based, redo whole steps since startup
– Still fast enough, but often limited by disk performance
– may loss a few seconds during a crash
• None
– Keep data only in Memory.
9
Redis Feature : Transaction
http://redis.io/topics/transactions
• Multiple actions can be put into a transaction
– execute multiple command in a single step.
– Either all of the commands or none are processed
• Command MULTI to start transaction
– EXEC to execute
– DISCARD to discard
– WATCH for Optimistic locking
• Guarantees:
– Executed in the defined order
– Atomic (all or nothing)
– No isolation
– Can use optimistic locking
> MULTI
OK
> INCR pageviews:count
QUEUED
> EXPIRE pageviews:count 60
QUEUED
> SADD pageviews http://google.fr
QUEUED
> EXPIRE pageviews 60
QUEUED
> EXEC
1) (integer) 4660294
2) (integer) 1
3) (integer) 569023
4) (integer) 1 10
Redis Feature : Replication
http://redis.io/topics/replication
• Redis uses classic master / slave replication
• Slaves can replicate to other slaves (in a graph-like structure)
• Replication does not block the master/slave (async)
• Boost scalability & allow redundancy
 Scaling performance by using the replicas for intensive read
operations.
 Making data redundant in multiple locations.
 Offloading data persistency costs from the master by
delegating it to the slaves
> SLAVEOF PAR-REDIS01:6379
> SLAVEOF PAR-REDIS01:6379
> SLAVEOF PAR-REDIS01:6379
11
Redis Feature : PubSub
http://redis.io/topics/pubsub (my favorite)
• A client can subscribe some topics, and when someone publish topic matches the
interest (topic), redis send it to it.
• Clients can subscribe to channels (eg user:1245) or patterns (eg user:*)
• Subscribing is O(1), posting messages is O(n)
• Use cases : Think chats, real-time analytics, twitter, …
CLIENT 1
> PSUBSCRIBE user:*
psubscribe
user:*
1
…
//wait notification
…
pmessage
user:*
user:1000
themessage
EMITTER 1
> PUBLISH user:1001 themessage
1 //number of message sent
Keyspace Notifications (>2.8) allows client to receive events
affecting the Redis data set (commands affecting a given key,
expiration, any command processed, …)
2
12
Use case #1 : Who’s online ?
//cybermaxs has 3 friends
> SADD cybermaxs:friends maxs
> SADD cybermaxs:friends nicocanicola
> SADD cybermaxs:friends oinant
//cybermaxs connects
> SADD users:online cybermaxs
//maxs connects
> SADD users:online maxs
//oinant connects
> SADD users:online oinant
Who’s online ?
> SMEMBERS users:online
Maxs
oinant
cybermaxs
Are cybermaxs’s friends online ?
> SINTER users:online cybermaxs:friends
maxs
oinant
Is nicocanicola connected ?
> SISMEMBERS users:online nicocanicola
0
How many connected users ?
> SCARD users:online
3
13
Use case #2 : leaderboard
> ZADD leaderboard 1543 cybermaxs
> ZADD leaderboard 4564 nicocanicola
> ZADD leaderboard 8954 toto
> ZADD leaderboard 6164 oinant
> ZADD leaderboard 9642 cybermaxs
> ZADD leaderboard 4123 toto
> ZADD leaderboard 8713 maxs
How to get top 3 ?
> ZREVRANGE leaderboard 0 2
WITHSCORES
cybermaxs
9642
toto
8954
maxs
8713
How to get rank of player X ?
> ZREVRANK leaderboard oinant
3
How to get score of player X ?
> ZSCORE leaderboard toto
8954
How to add score to player ?
> ZINCRBY leaderboard 3000
nicocanicolas
7563
SELECT TOP 10 * FROM leaderboard
WHERE ... ORDER BY score DESC ?
14
> INCR questions:nextid
1234 //last question id was 1233
> HMSET question:1234 title “Are you Redis to go?"
asked_by “cybermaxs“ votes 0
OK //add question to redis
> LPUSH questions question:1234
1 //add to list
> SADD question:1234:tags redis nosql
2 //add to tags
// later upvote by a user
> HINCRBY question:1234 votes 1
1
> ZINCRBY tagged:redis 1 question:1
1
Use case #3 : StackExchange Clone
Lastest 200 questions for Homepage
> LRANGE questions 0 199
question:200
question:199
…
Get Votes for a question
> HMGET question:1234 votes
2
Get Tags for a question
> SMEMBERS question:1234
redis
nosql
Questions by Tags, Sorted by Votes
> ZREVRANGE tagged:redis 0 5
question:1234
question:486
…
Subscribe to all changes on a question
> SUBSCRIBE __key*question:1234
+ Socket.IO
/SignalR
15
Common uses cases
• Cache out-of-process
• Duplicate detector
• FIFO/LIFO Queue
• Priority Queue
• Distributed hashmap
– e.g. url shortener
• UID generator
• Game high scores
• Geolocation lookup
– lat & long -> city
• Real-time analytics
• Metrics DB
• API throttling (rate-
limits)
• Autocomplete
• Twitter
• digg / Hacker News
• Social activity feed
• …
16
Who is using Redis ?
17
Conclusion
18
Questions
(mine : are you Redis to Go ?)
19
References
• http://redis.io/
• http://en.wikipedia.org/wiki/Redis
• http://try.redis.io/ (online introduction)
• http://redis.io/topics/data-types-intro
• http://highscalability.com/blog/2011/7/6/11-common-web-use-cases-solved-in-
redis.html
• http://oldblog.antirez.com/post/take-advantage-of-redis-adding-it-to-your-
stack.html
• http://mono.servicestack.net/docs/redis-client/designing-nosql-database
• http://fr.slideshare.net/dvirsky/kicking-ass-with-redis
• http://fr.slideshare.net/noahd1/redis-in-practice
20
Find out more
• On https://techblog.betclicgroup.com/
21
We want our brands to be easy to use for
every gamer around the world.
Join us to make that happen.
Everything we do reflect our values
Come and work in a friendly atmosphere
based on trust & cooperation between IT
Teams.
Learn & Share with us
Friday tech trainings, BBL, Meetups,
Coding Dojo, Innovation Day & more
If you want to contribute to the success of
our group, look at all the challenges we
offer HERE
Want to be part of a great online gambling company?
Check out our Carreers account
on Stackoverflow
22
About Us
• Betclic Everest Group, one of the world leaders in online
gaming, has a unique portfolio comprising various
complementary international brands: Betclic, Everest, bet-at-
home.com, Expekt, Monte-Carlo Casino…
• Through our brands, Betclic Everest Group places expertise,
technological know-how and security at the heart of our
strategy to deliver an on-line gaming offer attuned to the
passion of our players. We want our brands to be easy to use
for every gamer around the world. We’re building our
company to make that happen.
• Active in 100 countries with more than 12 million customers
worldwide, the Group is committed to promoting secure and
responsible gaming and is a member of several international
professional associations including the EGBA (European
Gaming and Betting Association) and the ESSA (European
Sports Security Association).
23

More Related Content

What's hot

Continuous Integration with Open Source Tools - PHPUgFfm 2014-11-20
Continuous Integration with Open Source Tools - PHPUgFfm 2014-11-20Continuous Integration with Open Source Tools - PHPUgFfm 2014-11-20
Continuous Integration with Open Source Tools - PHPUgFfm 2014-11-20
Michael Lihs
 
Introduction to ansible
Introduction to ansibleIntroduction to ansible
Introduction to ansible
Krish
 
Dot Net Core
Dot Net CoreDot Net Core
Dot Net Core
Amir Barylko
 
PHP Indonesia - Nodejs Web Development
PHP Indonesia - Nodejs Web DevelopmentPHP Indonesia - Nodejs Web Development
PHP Indonesia - Nodejs Web Development
Irfan Maulana
 
Afrimadoni the power of docker
Afrimadoni   the power of dockerAfrimadoni   the power of docker
Afrimadoni the power of docker
PHP Indonesia
 
OpenNebula in a Multiuser Environment
OpenNebula in a Multiuser EnvironmentOpenNebula in a Multiuser Environment
OpenNebula in a Multiuser Environment
NETWAYS
 
Docker
DockerDocker
Docker
Michael Lihs
 
Introduction to apache maven
Introduction to apache mavenIntroduction to apache maven
Introduction to apache maven
Krish
 
Codecoon - A technical Case Study
Codecoon - A technical Case StudyCodecoon - A technical Case Study
Codecoon - A technical Case Study
Michael Lihs
 
Composer
ComposerComposer
Composer
Le Thanh Sang
 
OpenStack in action 4! Alessandro Pilotti - OpenStack, Hyper-V and Windows
OpenStack in action 4! Alessandro Pilotti - OpenStack, Hyper-V and WindowsOpenStack in action 4! Alessandro Pilotti - OpenStack, Hyper-V and Windows
OpenStack in action 4! Alessandro Pilotti - OpenStack, Hyper-V and Windows
eNovance
 
Mastering composer
Mastering composerMastering composer
Mastering composer
Adán Lobato Lorenzo
 
They why behind php frameworks
They why behind php frameworksThey why behind php frameworks
They why behind php frameworks
Kirk Madera
 
Mini Training Flyway
Mini Training FlywayMini Training Flyway
Mini Training Flyway
Betclic Everest Group Tech Team
 
Introduction to jenkins
Introduction to jenkinsIntroduction to jenkins
Introduction to jenkins
Krish
 
Vagrant and Chef on FOSSASIA 2014
Vagrant and Chef on FOSSASIA 2014Vagrant and Chef on FOSSASIA 2014
Vagrant and Chef on FOSSASIA 2014
Michael Lihs
 
CodeIgniter For Project : Lesson 103 - Introduction to Codeigniter
CodeIgniter For Project : Lesson 103 - Introduction to CodeigniterCodeIgniter For Project : Lesson 103 - Introduction to Codeigniter
CodeIgniter For Project : Lesson 103 - Introduction to Codeigniter
Weerayut Hongsa
 
Hacking on WildFly 9
Hacking on WildFly 9Hacking on WildFly 9
Hacking on WildFly 9
Virtual JBoss User Group
 
Untangling - fall2017 - week 8
Untangling - fall2017 - week 8Untangling - fall2017 - week 8
Untangling - fall2017 - week 8
Derek Jacoby
 
Introduction to docker
Introduction to dockerIntroduction to docker
Introduction to docker
Krish
 

What's hot (20)

Continuous Integration with Open Source Tools - PHPUgFfm 2014-11-20
Continuous Integration with Open Source Tools - PHPUgFfm 2014-11-20Continuous Integration with Open Source Tools - PHPUgFfm 2014-11-20
Continuous Integration with Open Source Tools - PHPUgFfm 2014-11-20
 
Introduction to ansible
Introduction to ansibleIntroduction to ansible
Introduction to ansible
 
Dot Net Core
Dot Net CoreDot Net Core
Dot Net Core
 
PHP Indonesia - Nodejs Web Development
PHP Indonesia - Nodejs Web DevelopmentPHP Indonesia - Nodejs Web Development
PHP Indonesia - Nodejs Web Development
 
Afrimadoni the power of docker
Afrimadoni   the power of dockerAfrimadoni   the power of docker
Afrimadoni the power of docker
 
OpenNebula in a Multiuser Environment
OpenNebula in a Multiuser EnvironmentOpenNebula in a Multiuser Environment
OpenNebula in a Multiuser Environment
 
Docker
DockerDocker
Docker
 
Introduction to apache maven
Introduction to apache mavenIntroduction to apache maven
Introduction to apache maven
 
Codecoon - A technical Case Study
Codecoon - A technical Case StudyCodecoon - A technical Case Study
Codecoon - A technical Case Study
 
Composer
ComposerComposer
Composer
 
OpenStack in action 4! Alessandro Pilotti - OpenStack, Hyper-V and Windows
OpenStack in action 4! Alessandro Pilotti - OpenStack, Hyper-V and WindowsOpenStack in action 4! Alessandro Pilotti - OpenStack, Hyper-V and Windows
OpenStack in action 4! Alessandro Pilotti - OpenStack, Hyper-V and Windows
 
Mastering composer
Mastering composerMastering composer
Mastering composer
 
They why behind php frameworks
They why behind php frameworksThey why behind php frameworks
They why behind php frameworks
 
Mini Training Flyway
Mini Training FlywayMini Training Flyway
Mini Training Flyway
 
Introduction to jenkins
Introduction to jenkinsIntroduction to jenkins
Introduction to jenkins
 
Vagrant and Chef on FOSSASIA 2014
Vagrant and Chef on FOSSASIA 2014Vagrant and Chef on FOSSASIA 2014
Vagrant and Chef on FOSSASIA 2014
 
CodeIgniter For Project : Lesson 103 - Introduction to Codeigniter
CodeIgniter For Project : Lesson 103 - Introduction to CodeigniterCodeIgniter For Project : Lesson 103 - Introduction to Codeigniter
CodeIgniter For Project : Lesson 103 - Introduction to Codeigniter
 
Hacking on WildFly 9
Hacking on WildFly 9Hacking on WildFly 9
Hacking on WildFly 9
 
Untangling - fall2017 - week 8
Untangling - fall2017 - week 8Untangling - fall2017 - week 8
Untangling - fall2017 - week 8
 
Introduction to docker
Introduction to dockerIntroduction to docker
Introduction to docker
 

Similar to Mini-Training: Redis

REDIS327
REDIS327REDIS327
REDIS327
Rajan Bhatt
 
Lessons learned while building Omroep.nl
Lessons learned while building Omroep.nlLessons learned while building Omroep.nl
Lessons learned while building Omroep.nl
tieleman
 
Lessons learned while building Omroep.nl
Lessons learned while building Omroep.nlLessons learned while building Omroep.nl
Lessons learned while building Omroep.nl
bartzon
 
Managing Your Security Logs with Elasticsearch
Managing Your Security Logs with ElasticsearchManaging Your Security Logs with Elasticsearch
Managing Your Security Logs with Elasticsearch
Vic Hargrave
 
Redispresentation apac2012
Redispresentation apac2012Redispresentation apac2012
Redispresentation apac2012
Ankur Gupta
 
10 Ways to Scale Your Website Silicon Valley Code Camp 2019
10 Ways to Scale Your Website Silicon Valley Code Camp 201910 Ways to Scale Your Website Silicon Valley Code Camp 2019
10 Ways to Scale Your Website Silicon Valley Code Camp 2019
Dave Nielsen
 
Redis everywhere - PHP London
Redis everywhere - PHP LondonRedis everywhere - PHP London
Redis everywhere - PHP London
Ricard Clau
 
6 tips for improving ruby performance
6 tips for improving ruby performance6 tips for improving ruby performance
6 tips for improving ruby performance
Engine Yard
 
Big Data analytics with Nginx, Logstash, Redis, Google Bigquery and Neo4j, ja...
Big Data analytics with Nginx, Logstash, Redis, Google Bigquery and Neo4j, ja...Big Data analytics with Nginx, Logstash, Redis, Google Bigquery and Neo4j, ja...
Big Data analytics with Nginx, Logstash, Redis, Google Bigquery and Neo4j, ja...
javier ramirez
 
Drupal Efficiency - Coding, Deployment, Scaling
Drupal Efficiency - Coding, Deployment, ScalingDrupal Efficiency - Coding, Deployment, Scaling
Drupal Efficiency - Coding, Deployment, Scaling
smattoon
 
Developing a Redis Module - Hackathon Kickoff
 Developing a Redis Module - Hackathon Kickoff Developing a Redis Module - Hackathon Kickoff
Developing a Redis Module - Hackathon Kickoff
Itamar Haber
 
Drupal Efficiency using open source technologies from Sun
Drupal Efficiency using open source technologies from SunDrupal Efficiency using open source technologies from Sun
Drupal Efficiency using open source technologies from Sun
smattoon
 
Hotsos Advanced Linux Tools
Hotsos Advanced Linux ToolsHotsos Advanced Linux Tools
Hotsos Advanced Linux Tools
Kellyn Pot'Vin-Gorman
 
Performance & Scalability Improvements in Perforce
Performance & Scalability Improvements in PerforcePerformance & Scalability Improvements in Perforce
Performance & Scalability Improvements in Perforce
Perforce
 
(DAT407) Amazon ElastiCache: Deep Dive
(DAT407) Amazon ElastiCache: Deep Dive(DAT407) Amazon ElastiCache: Deep Dive
(DAT407) Amazon ElastiCache: Deep Dive
Amazon Web Services
 
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
Redis Labs
 
Important work-arounds for making ASS multi-lingual
Important work-arounds for making ASS multi-lingualImportant work-arounds for making ASS multi-lingual
Important work-arounds for making ASS multi-lingual
Axel Faust
 
Hadoop & no sql new generation database systems
Hadoop & no sql   new generation database systemsHadoop & no sql   new generation database systems
Hadoop & no sql new generation database systems
ramazan fırın
 
Drilling into Data with Apache Drill
Drilling into Data with Apache DrillDrilling into Data with Apache Drill
Drilling into Data with Apache Drill
MapR Technologies
 
10 Ways to Scale with Redis - LA Redis Meetup 2019
10 Ways to Scale with Redis - LA Redis Meetup 201910 Ways to Scale with Redis - LA Redis Meetup 2019
10 Ways to Scale with Redis - LA Redis Meetup 2019
Dave Nielsen
 

Similar to Mini-Training: Redis (20)

REDIS327
REDIS327REDIS327
REDIS327
 
Lessons learned while building Omroep.nl
Lessons learned while building Omroep.nlLessons learned while building Omroep.nl
Lessons learned while building Omroep.nl
 
Lessons learned while building Omroep.nl
Lessons learned while building Omroep.nlLessons learned while building Omroep.nl
Lessons learned while building Omroep.nl
 
Managing Your Security Logs with Elasticsearch
Managing Your Security Logs with ElasticsearchManaging Your Security Logs with Elasticsearch
Managing Your Security Logs with Elasticsearch
 
Redispresentation apac2012
Redispresentation apac2012Redispresentation apac2012
Redispresentation apac2012
 
10 Ways to Scale Your Website Silicon Valley Code Camp 2019
10 Ways to Scale Your Website Silicon Valley Code Camp 201910 Ways to Scale Your Website Silicon Valley Code Camp 2019
10 Ways to Scale Your Website Silicon Valley Code Camp 2019
 
Redis everywhere - PHP London
Redis everywhere - PHP LondonRedis everywhere - PHP London
Redis everywhere - PHP London
 
6 tips for improving ruby performance
6 tips for improving ruby performance6 tips for improving ruby performance
6 tips for improving ruby performance
 
Big Data analytics with Nginx, Logstash, Redis, Google Bigquery and Neo4j, ja...
Big Data analytics with Nginx, Logstash, Redis, Google Bigquery and Neo4j, ja...Big Data analytics with Nginx, Logstash, Redis, Google Bigquery and Neo4j, ja...
Big Data analytics with Nginx, Logstash, Redis, Google Bigquery and Neo4j, ja...
 
Drupal Efficiency - Coding, Deployment, Scaling
Drupal Efficiency - Coding, Deployment, ScalingDrupal Efficiency - Coding, Deployment, Scaling
Drupal Efficiency - Coding, Deployment, Scaling
 
Developing a Redis Module - Hackathon Kickoff
 Developing a Redis Module - Hackathon Kickoff Developing a Redis Module - Hackathon Kickoff
Developing a Redis Module - Hackathon Kickoff
 
Drupal Efficiency using open source technologies from Sun
Drupal Efficiency using open source technologies from SunDrupal Efficiency using open source technologies from Sun
Drupal Efficiency using open source technologies from Sun
 
Hotsos Advanced Linux Tools
Hotsos Advanced Linux ToolsHotsos Advanced Linux Tools
Hotsos Advanced Linux Tools
 
Performance & Scalability Improvements in Perforce
Performance & Scalability Improvements in PerforcePerformance & Scalability Improvements in Perforce
Performance & Scalability Improvements in Perforce
 
(DAT407) Amazon ElastiCache: Deep Dive
(DAT407) Amazon ElastiCache: Deep Dive(DAT407) Amazon ElastiCache: Deep Dive
(DAT407) Amazon ElastiCache: Deep Dive
 
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
 
Important work-arounds for making ASS multi-lingual
Important work-arounds for making ASS multi-lingualImportant work-arounds for making ASS multi-lingual
Important work-arounds for making ASS multi-lingual
 
Hadoop & no sql new generation database systems
Hadoop & no sql   new generation database systemsHadoop & no sql   new generation database systems
Hadoop & no sql new generation database systems
 
Drilling into Data with Apache Drill
Drilling into Data with Apache DrillDrilling into Data with Apache Drill
Drilling into Data with Apache Drill
 
10 Ways to Scale with Redis - LA Redis Meetup 2019
10 Ways to Scale with Redis - LA Redis Meetup 201910 Ways to Scale with Redis - LA Redis Meetup 2019
10 Ways to Scale with Redis - LA Redis Meetup 2019
 

More from Betclic Everest Group Tech Team

Mini training - Reactive Extensions (Rx)
Mini training - Reactive Extensions (Rx)Mini training - Reactive Extensions (Rx)
Mini training - Reactive Extensions (Rx)
Betclic Everest Group Tech Team
 
Mini training - Moving to xUnit.net
Mini training - Moving to xUnit.netMini training - Moving to xUnit.net
Mini training - Moving to xUnit.net
Betclic Everest Group Tech Team
 
Mini training - Introduction to Microsoft Azure Storage
Mini training - Introduction to Microsoft Azure StorageMini training - Introduction to Microsoft Azure Storage
Mini training - Introduction to Microsoft Azure Storage
Betclic Everest Group Tech Team
 
Akka.Net
Akka.NetAkka.Net
Mini training- Scenario Driven Design
Mini training- Scenario Driven DesignMini training- Scenario Driven Design
Mini training- Scenario Driven Design
Betclic Everest Group Tech Team
 
Email Management in Outlook
Email Management in OutlookEmail Management in Outlook
Email Management in Outlook
Betclic Everest Group Tech Team
 
Mini-Training: SSO with Windows Identity Foundation
Mini-Training: SSO with Windows Identity FoundationMini-Training: SSO with Windows Identity Foundation
Mini-Training: SSO with Windows Identity Foundation
Betclic Everest Group Tech Team
 
Training - What is Performance ?
Training  - What is Performance ?Training  - What is Performance ?
Training - What is Performance ?
Betclic Everest Group Tech Team
 
Mini-Training: Docker
Mini-Training: DockerMini-Training: Docker
Mini-Training: Docker
Betclic Everest Group Tech Team
 
Mini-Training: NDepend
Mini-Training: NDependMini-Training: NDepend
Mini-Training: NDepend
Betclic Everest Group Tech Team
 
Management 3.0 Workout
Management 3.0 WorkoutManagement 3.0 Workout
Management 3.0 Workout
Betclic Everest Group Tech Team
 
Lean for Business
Lean for BusinessLean for Business
Training – Going Async
Training – Going AsyncTraining – Going Async
Training – Going Async
Betclic Everest Group Tech Team
 
Mini-Training: Mobile UX Trends
Mini-Training: Mobile UX TrendsMini-Training: Mobile UX Trends
Mini-Training: Mobile UX Trends
Betclic Everest Group Tech Team
 
Training: MVVM Pattern
Training: MVVM PatternTraining: MVVM Pattern
Training: MVVM Pattern
Betclic Everest Group Tech Team
 
Mini-training: Personalization & Recommendation Demystified
Mini-training: Personalization & Recommendation DemystifiedMini-training: Personalization & Recommendation Demystified
Mini-training: Personalization & Recommendation Demystified
Betclic Everest Group Tech Team
 
AngularJS Best Practices
AngularJS Best PracticesAngularJS Best Practices
AngularJS Best Practices
Betclic Everest Group Tech Team
 
Mini-Training: Roslyn
Mini-Training: RoslynMini-Training: Roslyn
Mini-Training: Roslyn
Betclic Everest Group Tech Team
 
Mini-Training: Netflix Simian Army
Mini-Training: Netflix Simian ArmyMini-Training: Netflix Simian Army
Mini-Training: Netflix Simian Army
Betclic Everest Group Tech Team
 
WCF Configuration - The basics
WCF Configuration - The basicsWCF Configuration - The basics
WCF Configuration - The basics
Betclic Everest Group Tech Team
 

More from Betclic Everest Group Tech Team (20)

Mini training - Reactive Extensions (Rx)
Mini training - Reactive Extensions (Rx)Mini training - Reactive Extensions (Rx)
Mini training - Reactive Extensions (Rx)
 
Mini training - Moving to xUnit.net
Mini training - Moving to xUnit.netMini training - Moving to xUnit.net
Mini training - Moving to xUnit.net
 
Mini training - Introduction to Microsoft Azure Storage
Mini training - Introduction to Microsoft Azure StorageMini training - Introduction to Microsoft Azure Storage
Mini training - Introduction to Microsoft Azure Storage
 
Akka.Net
Akka.NetAkka.Net
Akka.Net
 
Mini training- Scenario Driven Design
Mini training- Scenario Driven DesignMini training- Scenario Driven Design
Mini training- Scenario Driven Design
 
Email Management in Outlook
Email Management in OutlookEmail Management in Outlook
Email Management in Outlook
 
Mini-Training: SSO with Windows Identity Foundation
Mini-Training: SSO with Windows Identity FoundationMini-Training: SSO with Windows Identity Foundation
Mini-Training: SSO with Windows Identity Foundation
 
Training - What is Performance ?
Training  - What is Performance ?Training  - What is Performance ?
Training - What is Performance ?
 
Mini-Training: Docker
Mini-Training: DockerMini-Training: Docker
Mini-Training: Docker
 
Mini-Training: NDepend
Mini-Training: NDependMini-Training: NDepend
Mini-Training: NDepend
 
Management 3.0 Workout
Management 3.0 WorkoutManagement 3.0 Workout
Management 3.0 Workout
 
Lean for Business
Lean for BusinessLean for Business
Lean for Business
 
Training – Going Async
Training – Going AsyncTraining – Going Async
Training – Going Async
 
Mini-Training: Mobile UX Trends
Mini-Training: Mobile UX TrendsMini-Training: Mobile UX Trends
Mini-Training: Mobile UX Trends
 
Training: MVVM Pattern
Training: MVVM PatternTraining: MVVM Pattern
Training: MVVM Pattern
 
Mini-training: Personalization & Recommendation Demystified
Mini-training: Personalization & Recommendation DemystifiedMini-training: Personalization & Recommendation Demystified
Mini-training: Personalization & Recommendation Demystified
 
AngularJS Best Practices
AngularJS Best PracticesAngularJS Best Practices
AngularJS Best Practices
 
Mini-Training: Roslyn
Mini-Training: RoslynMini-Training: Roslyn
Mini-Training: Roslyn
 
Mini-Training: Netflix Simian Army
Mini-Training: Netflix Simian ArmyMini-Training: Netflix Simian Army
Mini-Training: Netflix Simian Army
 
WCF Configuration - The basics
WCF Configuration - The basicsWCF Configuration - The basics
WCF Configuration - The basics
 

Recently uploaded

GT degree offer diploma Transcript
GT degree offer diploma TranscriptGT degree offer diploma Transcript
GT degree offer diploma Transcript
attueb
 
Unleashing the Future: Building a Scalable and Up-to-Date GenAI Chatbot with ...
Unleashing the Future: Building a Scalable and Up-to-Date GenAI Chatbot with ...Unleashing the Future: Building a Scalable and Up-to-Date GenAI Chatbot with ...
Unleashing the Future: Building a Scalable and Up-to-Date GenAI Chatbot with ...
confluent
 
IoT In Manufacturing_ Use Cases, Benefits, and Challenges.pdf
IoT In Manufacturing_ Use Cases, Benefits, and Challenges.pdfIoT In Manufacturing_ Use Cases, Benefits, and Challenges.pdf
IoT In Manufacturing_ Use Cases, Benefits, and Challenges.pdf
mohitd6
 
ThaiPy meetup - Indexes and Django
ThaiPy meetup - Indexes and DjangoThaiPy meetup - Indexes and Django
ThaiPy meetup - Indexes and Django
akshesh doshi
 
Vip Girls Call ServiCe Hyderabad 0000000000 Pooja Best High Class Hyderabad A...
Vip Girls Call ServiCe Hyderabad 0000000000 Pooja Best High Class Hyderabad A...Vip Girls Call ServiCe Hyderabad 0000000000 Pooja Best High Class Hyderabad A...
Vip Girls Call ServiCe Hyderabad 0000000000 Pooja Best High Class Hyderabad A...
ashiklo9823
 
NYGGS 360: A Complete ERP for Construction Innovation
NYGGS 360: A Complete ERP for Construction InnovationNYGGS 360: A Complete ERP for Construction Innovation
NYGGS 360: A Complete ERP for Construction Innovation
NYGGS Construction ERP Software
 
Introduction to Cloud computing for Internet of Things
Introduction to Cloud computing for Internet of ThingsIntroduction to Cloud computing for Internet of Things
Introduction to Cloud computing for Internet of Things
NachuSubramanian1
 
TEQnation 2024: Sustainable Software: May the Green Code Be with You
TEQnation 2024: Sustainable Software: May the Green Code Be with YouTEQnation 2024: Sustainable Software: May the Green Code Be with You
TEQnation 2024: Sustainable Software: May the Green Code Be with You
marcofolio
 
Amadeus Travel API, Amadeus Booking API, Amadeus GDS
Amadeus Travel API, Amadeus Booking API, Amadeus GDSAmadeus Travel API, Amadeus Booking API, Amadeus GDS
Amadeus Travel API, Amadeus Booking API, Amadeus GDS
aadhiyaeliza
 
🚂🚘 Premium Girls Call Ranchi 🛵🚡000XX00000 💃 Choose Best And Top Girl Service...
🚂🚘 Premium Girls Call Ranchi  🛵🚡000XX00000 💃 Choose Best And Top Girl Service...🚂🚘 Premium Girls Call Ranchi  🛵🚡000XX00000 💃 Choose Best And Top Girl Service...
🚂🚘 Premium Girls Call Ranchi 🛵🚡000XX00000 💃 Choose Best And Top Girl Service...
bahubalikumar09988
 
Cisco Live Announcements: New ThousandEyes Release Highlights - July 2024
Cisco Live Announcements: New ThousandEyes Release Highlights - July 2024Cisco Live Announcements: New ThousandEyes Release Highlights - July 2024
Cisco Live Announcements: New ThousandEyes Release Highlights - July 2024
ThousandEyes
 
Top Chinese Government-backed APT Groups
Top Chinese Government-backed APT GroupsTop Chinese Government-backed APT Groups
Top Chinese Government-backed APT Groups
SOCRadar
 
To Avoid Mistakes When Using Online Attendance Sheets
To Avoid Mistakes When Using Online Attendance SheetsTo Avoid Mistakes When Using Online Attendance Sheets
To Avoid Mistakes When Using Online Attendance Sheets
Task Tracker
 
Software development... for all? (keynote at ICSOFT'2024)
Software development... for all? (keynote at ICSOFT'2024)Software development... for all? (keynote at ICSOFT'2024)
Software development... for all? (keynote at ICSOFT'2024)
miso_uam
 
AI - Your Startup Sidekick (Leveraging AI to Bootstrap a Lean Startup).pdf
AI - Your Startup Sidekick (Leveraging AI to Bootstrap a Lean Startup).pdfAI - Your Startup Sidekick (Leveraging AI to Bootstrap a Lean Startup).pdf
AI - Your Startup Sidekick (Leveraging AI to Bootstrap a Lean Startup).pdf
Daniel Zivkovic
 
Mumbai Girls Call Mumbai 🎈🔥9930687706 🔥💋🎈 Provide Best And Top Girl Service A...
Mumbai Girls Call Mumbai 🎈🔥9930687706 🔥💋🎈 Provide Best And Top Girl Service A...Mumbai Girls Call Mumbai 🎈🔥9930687706 🔥💋🎈 Provide Best And Top Girl Service A...
Mumbai Girls Call Mumbai 🎈🔥9930687706 🔥💋🎈 Provide Best And Top Girl Service A...
3610stuck
 
HIRE A HACKER FOR CHEATING HUSBAND/WIFE)
HIRE A HACKER FOR CHEATING HUSBAND/WIFE)HIRE A HACKER FOR CHEATING HUSBAND/WIFE)
HIRE A HACKER FOR CHEATING HUSBAND/WIFE)
josephinedrea942
 
Private Girls Call Navi Mumbai 🛵🚡9820252231 💃 Choose Best And Top Girl Servic...
Private Girls Call Navi Mumbai 🛵🚡9820252231 💃 Choose Best And Top Girl Servic...Private Girls Call Navi Mumbai 🛵🚡9820252231 💃 Choose Best And Top Girl Servic...
Private Girls Call Navi Mumbai 🛵🚡9820252231 💃 Choose Best And Top Girl Servic...
902basic
 
welcome to presentation on Google Apps
welcome to   presentation on Google Appswelcome to   presentation on Google Apps
welcome to presentation on Google Apps
AsifKarimJim
 
ERP Software Solutions Provider in Coimbatore
ERP Software Solutions Provider in CoimbatoreERP Software Solutions Provider in Coimbatore
ERP Software Solutions Provider in Coimbatore
Nextskill Technologies
 

Recently uploaded (20)

GT degree offer diploma Transcript
GT degree offer diploma TranscriptGT degree offer diploma Transcript
GT degree offer diploma Transcript
 
Unleashing the Future: Building a Scalable and Up-to-Date GenAI Chatbot with ...
Unleashing the Future: Building a Scalable and Up-to-Date GenAI Chatbot with ...Unleashing the Future: Building a Scalable and Up-to-Date GenAI Chatbot with ...
Unleashing the Future: Building a Scalable and Up-to-Date GenAI Chatbot with ...
 
IoT In Manufacturing_ Use Cases, Benefits, and Challenges.pdf
IoT In Manufacturing_ Use Cases, Benefits, and Challenges.pdfIoT In Manufacturing_ Use Cases, Benefits, and Challenges.pdf
IoT In Manufacturing_ Use Cases, Benefits, and Challenges.pdf
 
ThaiPy meetup - Indexes and Django
ThaiPy meetup - Indexes and DjangoThaiPy meetup - Indexes and Django
ThaiPy meetup - Indexes and Django
 
Vip Girls Call ServiCe Hyderabad 0000000000 Pooja Best High Class Hyderabad A...
Vip Girls Call ServiCe Hyderabad 0000000000 Pooja Best High Class Hyderabad A...Vip Girls Call ServiCe Hyderabad 0000000000 Pooja Best High Class Hyderabad A...
Vip Girls Call ServiCe Hyderabad 0000000000 Pooja Best High Class Hyderabad A...
 
NYGGS 360: A Complete ERP for Construction Innovation
NYGGS 360: A Complete ERP for Construction InnovationNYGGS 360: A Complete ERP for Construction Innovation
NYGGS 360: A Complete ERP for Construction Innovation
 
Introduction to Cloud computing for Internet of Things
Introduction to Cloud computing for Internet of ThingsIntroduction to Cloud computing for Internet of Things
Introduction to Cloud computing for Internet of Things
 
TEQnation 2024: Sustainable Software: May the Green Code Be with You
TEQnation 2024: Sustainable Software: May the Green Code Be with YouTEQnation 2024: Sustainable Software: May the Green Code Be with You
TEQnation 2024: Sustainable Software: May the Green Code Be with You
 
Amadeus Travel API, Amadeus Booking API, Amadeus GDS
Amadeus Travel API, Amadeus Booking API, Amadeus GDSAmadeus Travel API, Amadeus Booking API, Amadeus GDS
Amadeus Travel API, Amadeus Booking API, Amadeus GDS
 
🚂🚘 Premium Girls Call Ranchi 🛵🚡000XX00000 💃 Choose Best And Top Girl Service...
🚂🚘 Premium Girls Call Ranchi  🛵🚡000XX00000 💃 Choose Best And Top Girl Service...🚂🚘 Premium Girls Call Ranchi  🛵🚡000XX00000 💃 Choose Best And Top Girl Service...
🚂🚘 Premium Girls Call Ranchi 🛵🚡000XX00000 💃 Choose Best And Top Girl Service...
 
Cisco Live Announcements: New ThousandEyes Release Highlights - July 2024
Cisco Live Announcements: New ThousandEyes Release Highlights - July 2024Cisco Live Announcements: New ThousandEyes Release Highlights - July 2024
Cisco Live Announcements: New ThousandEyes Release Highlights - July 2024
 
Top Chinese Government-backed APT Groups
Top Chinese Government-backed APT GroupsTop Chinese Government-backed APT Groups
Top Chinese Government-backed APT Groups
 
To Avoid Mistakes When Using Online Attendance Sheets
To Avoid Mistakes When Using Online Attendance SheetsTo Avoid Mistakes When Using Online Attendance Sheets
To Avoid Mistakes When Using Online Attendance Sheets
 
Software development... for all? (keynote at ICSOFT'2024)
Software development... for all? (keynote at ICSOFT'2024)Software development... for all? (keynote at ICSOFT'2024)
Software development... for all? (keynote at ICSOFT'2024)
 
AI - Your Startup Sidekick (Leveraging AI to Bootstrap a Lean Startup).pdf
AI - Your Startup Sidekick (Leveraging AI to Bootstrap a Lean Startup).pdfAI - Your Startup Sidekick (Leveraging AI to Bootstrap a Lean Startup).pdf
AI - Your Startup Sidekick (Leveraging AI to Bootstrap a Lean Startup).pdf
 
Mumbai Girls Call Mumbai 🎈🔥9930687706 🔥💋🎈 Provide Best And Top Girl Service A...
Mumbai Girls Call Mumbai 🎈🔥9930687706 🔥💋🎈 Provide Best And Top Girl Service A...Mumbai Girls Call Mumbai 🎈🔥9930687706 🔥💋🎈 Provide Best And Top Girl Service A...
Mumbai Girls Call Mumbai 🎈🔥9930687706 🔥💋🎈 Provide Best And Top Girl Service A...
 
HIRE A HACKER FOR CHEATING HUSBAND/WIFE)
HIRE A HACKER FOR CHEATING HUSBAND/WIFE)HIRE A HACKER FOR CHEATING HUSBAND/WIFE)
HIRE A HACKER FOR CHEATING HUSBAND/WIFE)
 
Private Girls Call Navi Mumbai 🛵🚡9820252231 💃 Choose Best And Top Girl Servic...
Private Girls Call Navi Mumbai 🛵🚡9820252231 💃 Choose Best And Top Girl Servic...Private Girls Call Navi Mumbai 🛵🚡9820252231 💃 Choose Best And Top Girl Servic...
Private Girls Call Navi Mumbai 🛵🚡9820252231 💃 Choose Best And Top Girl Servic...
 
welcome to presentation on Google Apps
welcome to   presentation on Google Appswelcome to   presentation on Google Apps
welcome to presentation on Google Apps
 
ERP Software Solutions Provider in Coimbatore
ERP Software Solutions Provider in CoimbatoreERP Software Solutions Provider in Coimbatore
ERP Software Solutions Provider in Coimbatore
 

Mini-Training: Redis

  • 1. ARE YOU REDIS TO GO ? MAXIME LEMAITRE – 10/04/2014 1
  • 2. > GET agenda > GET introduction > SMEMBERS datatypes > INFO commands > CLIENT LIST > PSUBSCRIBE performance? > LRANGE features 0 3 persitence transaction replication pubsub > ZREVRANGE usecases 0 -1 > SEGFAULT > ? I see Redis definitely more as a flexible tool that as a solution specialized to solve a specific problem: his mixed soul of cache, store, and messaging server shows this very well - Salvatore Sanfilippo (antirez), creator of Redis 2
  • 3. Brief Introduction • Redis is an open source (since March 2009), advanced key-value store. It is often referred to as a data structure server since keys can contain strings, hashes, lists, sets and sorted sets. • Originally written in order to help address the scaling needs of http://lloogg.com/, a web analytics startup, by Salvatore (antirez) Sanfilippo. • Redis is written in ANSI C and works in most POSIX systems like Linux, *BSD, OS X and Solaris without external dependencies. Redis project does not directly support Windows, however MSOpenTech develops and maintains an Windows port targeting Win64. 3
  • 4. Command Processing http://redis.io/commands • Protocol RESP – clients communicate with the Redis using REdis Serialization Protocol • Simple, Fast & Human readable – Commands are processed in serial in a single thread (like Node.js) • Superfast processing of commands (a few ms, sometimes less) • If you want to use more CPUs, shard your data client-side • Command groups – Request/response – Pipelined: Several requests / responses – Transactions: • Traditional: Several requests processed in order atomically • Check-And-Set: Request(s), data manipulation in client, more requests – Scripts (>v2.6): execute client-defined Lua scripts in the server for more complex actions 4
  • 5. What is a Command ? http://redis.io/commands Command name + parameters > Version > Complexity (really important) > Description > Result/return value > Example > Approx. 160 available commands 5
  • 6. Data Types List Set Sorted Set Hash [A, B, C, D] “A” “B” “C” “D” D C B A A:3 C:1 D:2 B:4 {A, B, C, D} {C:1, D:2, A:3, D:4} “A” “B” “C” “D” field1 field2 field3 field4 {field1:“A”, field2:“B”…} {value:score} {key:value} Basically maps keys to values (Strings), but also contains more advanced data structures here : * New Data Structure since April, 1st : HyperLogLog 6
  • 7. Popular .net clients Many clients for nearly all languages • ActionScript • C / C++ • C# • Clojure • Lisp • Dart • Erlang • Fancy • Go • Haskell • haXe • Io • Java • Lua • Node.js • Objective-C • Perl • PHP • Python • Ruby • Scala • Smalltalk • Tcl 7
  • 8. How fast is Redis ? (note : it’s common a manage millions of keys) Redis includes the redis-benchmark utility that simulates running commands done by N clients at the same time sending M total queries. • Example on Intel(R) Xeon(R) CPU E5520 @ 2.27GHz (without pipelining) Commands are generally processed in a few ms. Network bandwidth and latency usually have a direct impact on the performance. CPU is another very important factor. 8
  • 9. Redis Feature : Persistence http://redis.io/topics/persistence Redis provides a different range of persistence options: RDB, AOF and None. • RDB – Periodic, asynchronous dump to disk – Can be every N changes or every N seconds – Written to file in “dbfilename”.rdb (could be backup elsewhere) – may loss several minutes during a crash • AOF – Copies incoming commands as it happens – Log-based, redo whole steps since startup – Still fast enough, but often limited by disk performance – may loss a few seconds during a crash • None – Keep data only in Memory. 9
  • 10. Redis Feature : Transaction http://redis.io/topics/transactions • Multiple actions can be put into a transaction – execute multiple command in a single step. – Either all of the commands or none are processed • Command MULTI to start transaction – EXEC to execute – DISCARD to discard – WATCH for Optimistic locking • Guarantees: – Executed in the defined order – Atomic (all or nothing) – No isolation – Can use optimistic locking > MULTI OK > INCR pageviews:count QUEUED > EXPIRE pageviews:count 60 QUEUED > SADD pageviews http://google.fr QUEUED > EXPIRE pageviews 60 QUEUED > EXEC 1) (integer) 4660294 2) (integer) 1 3) (integer) 569023 4) (integer) 1 10
  • 11. Redis Feature : Replication http://redis.io/topics/replication • Redis uses classic master / slave replication • Slaves can replicate to other slaves (in a graph-like structure) • Replication does not block the master/slave (async) • Boost scalability & allow redundancy  Scaling performance by using the replicas for intensive read operations.  Making data redundant in multiple locations.  Offloading data persistency costs from the master by delegating it to the slaves > SLAVEOF PAR-REDIS01:6379 > SLAVEOF PAR-REDIS01:6379 > SLAVEOF PAR-REDIS01:6379 11
  • 12. Redis Feature : PubSub http://redis.io/topics/pubsub (my favorite) • A client can subscribe some topics, and when someone publish topic matches the interest (topic), redis send it to it. • Clients can subscribe to channels (eg user:1245) or patterns (eg user:*) • Subscribing is O(1), posting messages is O(n) • Use cases : Think chats, real-time analytics, twitter, … CLIENT 1 > PSUBSCRIBE user:* psubscribe user:* 1 … //wait notification … pmessage user:* user:1000 themessage EMITTER 1 > PUBLISH user:1001 themessage 1 //number of message sent Keyspace Notifications (>2.8) allows client to receive events affecting the Redis data set (commands affecting a given key, expiration, any command processed, …) 2 12
  • 13. Use case #1 : Who’s online ? //cybermaxs has 3 friends > SADD cybermaxs:friends maxs > SADD cybermaxs:friends nicocanicola > SADD cybermaxs:friends oinant //cybermaxs connects > SADD users:online cybermaxs //maxs connects > SADD users:online maxs //oinant connects > SADD users:online oinant Who’s online ? > SMEMBERS users:online Maxs oinant cybermaxs Are cybermaxs’s friends online ? > SINTER users:online cybermaxs:friends maxs oinant Is nicocanicola connected ? > SISMEMBERS users:online nicocanicola 0 How many connected users ? > SCARD users:online 3 13
  • 14. Use case #2 : leaderboard > ZADD leaderboard 1543 cybermaxs > ZADD leaderboard 4564 nicocanicola > ZADD leaderboard 8954 toto > ZADD leaderboard 6164 oinant > ZADD leaderboard 9642 cybermaxs > ZADD leaderboard 4123 toto > ZADD leaderboard 8713 maxs How to get top 3 ? > ZREVRANGE leaderboard 0 2 WITHSCORES cybermaxs 9642 toto 8954 maxs 8713 How to get rank of player X ? > ZREVRANK leaderboard oinant 3 How to get score of player X ? > ZSCORE leaderboard toto 8954 How to add score to player ? > ZINCRBY leaderboard 3000 nicocanicolas 7563 SELECT TOP 10 * FROM leaderboard WHERE ... ORDER BY score DESC ? 14
  • 15. > INCR questions:nextid 1234 //last question id was 1233 > HMSET question:1234 title “Are you Redis to go?" asked_by “cybermaxs“ votes 0 OK //add question to redis > LPUSH questions question:1234 1 //add to list > SADD question:1234:tags redis nosql 2 //add to tags // later upvote by a user > HINCRBY question:1234 votes 1 1 > ZINCRBY tagged:redis 1 question:1 1 Use case #3 : StackExchange Clone Lastest 200 questions for Homepage > LRANGE questions 0 199 question:200 question:199 … Get Votes for a question > HMGET question:1234 votes 2 Get Tags for a question > SMEMBERS question:1234 redis nosql Questions by Tags, Sorted by Votes > ZREVRANGE tagged:redis 0 5 question:1234 question:486 … Subscribe to all changes on a question > SUBSCRIBE __key*question:1234 + Socket.IO /SignalR 15
  • 16. Common uses cases • Cache out-of-process • Duplicate detector • FIFO/LIFO Queue • Priority Queue • Distributed hashmap – e.g. url shortener • UID generator • Game high scores • Geolocation lookup – lat & long -> city • Real-time analytics • Metrics DB • API throttling (rate- limits) • Autocomplete • Twitter • digg / Hacker News • Social activity feed • … 16
  • 17. Who is using Redis ? 17
  • 19. Questions (mine : are you Redis to Go ?) 19
  • 20. References • http://redis.io/ • http://en.wikipedia.org/wiki/Redis • http://try.redis.io/ (online introduction) • http://redis.io/topics/data-types-intro • http://highscalability.com/blog/2011/7/6/11-common-web-use-cases-solved-in- redis.html • http://oldblog.antirez.com/post/take-advantage-of-redis-adding-it-to-your- stack.html • http://mono.servicestack.net/docs/redis-client/designing-nosql-database • http://fr.slideshare.net/dvirsky/kicking-ass-with-redis • http://fr.slideshare.net/noahd1/redis-in-practice 20
  • 21. Find out more • On https://techblog.betclicgroup.com/ 21
  • 22. We want our brands to be easy to use for every gamer around the world. Join us to make that happen. Everything we do reflect our values Come and work in a friendly atmosphere based on trust & cooperation between IT Teams. Learn & Share with us Friday tech trainings, BBL, Meetups, Coding Dojo, Innovation Day & more If you want to contribute to the success of our group, look at all the challenges we offer HERE Want to be part of a great online gambling company? Check out our Carreers account on Stackoverflow 22
  • 23. About Us • Betclic Everest Group, one of the world leaders in online gaming, has a unique portfolio comprising various complementary international brands: Betclic, Everest, bet-at- home.com, Expekt, Monte-Carlo Casino… • Through our brands, Betclic Everest Group places expertise, technological know-how and security at the heart of our strategy to deliver an on-line gaming offer attuned to the passion of our players. We want our brands to be easy to use for every gamer around the world. We’re building our company to make that happen. • Active in 100 countries with more than 12 million customers worldwide, the Group is committed to promoting secure and responsible gaming and is a member of several international professional associations including the EGBA (European Gaming and Betting Association) and the ESSA (European Sports Security Association). 23