SlideShare a Scribd company logo
REDIS Labcamp
Angelo Simone Scotto
Cluster Reply
2
• Developed by Salvatore Sanfilippo for his startup Merzia S.r.l.
• Aimed as a fast replacement of MySQL for web analytics (LLOOGG)
• Released as open source
in 2009.
• Sponsored by VMWare
since 2010.
• Sponsored by Pivotal
since 2013.
• Currently part of backend
of
An italian story
• Twitter
• Github
• Pinterest
• StackOverflow
• Flickr
• …
3
What is REDIS (REmote DIctionary Service)
Redis is a DSL (Domain Specific Language) that manipulates abstract data
types and implemented as a TCP daemon. Commands manipulate a key
space where keys are binary-safe strings and values are different kinds of
abstract data types.
REDIS Manifesto
4
Available Abstract Data Types
Key-Value Store:
• Keys
 Printable ASCII
• Values
 Primitives
 Strings
 Containers (of strings)
 Hashes
 Lists
 Sets
 Sorted Sets
Other Functionalities
 Pub/Sub
 HyperLogLog
 Bitmaps
5
Where to find Redis
• Obviosuly at redis website : http://redis.io
• Redis written in ANSI C and POSIX compliant:
• Linux (supported and recommended)
• Mac OS X (supported)
• *BSD (supported)
• Solaris (support defined «Best effort»)
• Windows is not directly supported by REDIS Project but
• Microsoft mantains and support a version at
http://msopentech.com/opentech-projects/redis/
• Used by Microsoft in Azure (Azure Redis Cache Service) therefore stable
and usable also on windows.
6
How to Install Redis
• On Windows, very simple:
• Download binaries from
https://github.com/MSOpenTech/redis/tree/2.8/bin/release, unzip and run.
• On Linux or MacOSX:
• Your preferred Package Manager (apt-get, YUM …) should have it but it’s
usually not recommended because often lagging behind current version.
• Recommended way is to recompile binaries directly:
http://redis.io/download
7
Strings
Redis Key
Value: Redis String
• Max Value Size: 512 MB
• Binary Strings
Commands:
• GET, SET
• INCR, DECR, INCRBY, DECRBY
• GETBIT, SETBIT, BITCOUNT, BITPOS, BITOP
• APPEND, GETRANGE, SETRANGE
• MGET, MSET
8
Hashes
• Max Value Size: 512 MB
• Binary Strings
Redis Key
Value: Redis Hash
Field 1 Value 1
Field 2 Value 2
Field 3 Value 3
Commands:
• HGET, HSET
• HINCRBY, HINCRBYFLOAT
• HLEN, HGETALL, HVALS, HKEYS
• HMGET, HMSET
9
Lists
• LPUSH, LPOP (Left, first)
• RPUSH, RPOP (Right, last)
• Queues are simply lists
when using LPUSH & RPOP
• Stack are simply lists when
using LPUSH & LPOP
• Index (list) operations are
obviously available
(LINDEX)
Redis Key
Value: Redis List
HEAD
Value1
Valuen
TAIL
Commands:
• LPUSH, LPOP
• RPUSH, RPOP, RPOPLPUSH
• BLPOP, BRPOP, BRPOPLPUSH
• LINDEX, LRANGE, LREM
10
Sets
• Unsorted set
• Unique Values (duplicates
are non inserted)
Redis Key
Value: Redis Set
Value 2
Value 1
Value 4
Value 5
Value 3
Commands:
• SADD, SPOP, SREM
• SCARD, SISMEMBER
• SUNION, SDIFF, SINTER
• SUNIONSTORE, SDIFFSTORE, SINTERSTORE
11
Sorted Sets
• Score is a float (double precision
floating number).
• Unique Values (duplicates are non
inserted)
• Sorted sets are sorted by their score in
ascending way
Redis Key
Value: Redis Sorted Set
Value1
Score100
Value2
Score200
Value3
Score200
Value4
Score250
Commands:
• ZADD, ZREM
• ZCARD, ZRANGE, ZREVRANGE
• ZSCORE, ZCOUNT, ZINCRBY, ZRANGEBYSCORE
• ZLEXCOUNT, ZRANGEBYLEX, ZREVRANGEBYLEX, ZREMRANGEBYLEX
• ZUNIONSTORE, ZINTERSTORE
12
Other Functionalities
Bitmaps:
 Not really a type, just a set of operators on strings.
Publish / Subscribe:
 Not a type, it implements a fire&forget publish/subscribe engine.
 PUBLISH, SUBSCRIBE, UNSUBSCRIBE
 PSUBSCRIBE, PUNSUBSCRIBE
HyperLogLog:
 Value contains an HyperLogLog algorithm implementation.
 REDIS implementation uses 12K per key with a std error of 0.81% to
count 2^64 items.
 PFADD, PFCOUNT, PFMERGE
13
REDIS Architecture
Key points:
• Extremely Fast.
• i.e. Data is always in RAM.
14
REDIS Architecture
Key points:
• Extremely Fast.
• i.e. Data is always in RAM.
• Extremely Simple.
• i.e. REDIS is single-threaded.
15
REDIS Architecture
Key points:
• Extremely Fast.
• i.e. Data is always in RAM.
• Extremely Simple.
• i.e. REDIS is single-threaded.
• Extremely Light.
16
REDIS Architecture
Key points:
• Extremely Fast.
• i.e. Data is always in RAM.
• Extremely Simple.
• i.e. REDIS is single-threaded.
• Extremely Light.
• Extremely Robust.
17
REDIS Architecture
Security:
«Redis is not optimized for maximum
security but for maximum performance
and simplicity»
• AUTH with password.
• BIND to specific network interface.
• No encryption (use SSL proxy)
• No ACS (each connection is admin)
• Possible to RENAME sensible
commands…
18
REDIS Architecture
Persistence:
• None.
• RDB (Redis DB) single-file dump.
• AOF (Append Only File), a log file.
• No fsync (fast, not safe).
• Fsync each second.
• Fsync each query (slow but safe).
• Both
Memory Usage:
• Data is always in memory, you cannot have more data than RAM in REDIS.
• Virtual Memory deprecated.
• Disk Store abandoned.
• Several policies to manage overflow:
• noeviction: no action, just error.
• allkeys-lru: remove older data
• allkeys-random: remove rnd data
• volatile-lru: remove expirable
• volatile-random: remove expirable
• volatile-ttl: remove expirable
19
REDIS Architecture
Transactions:
• Not an ACID Transactions.
• All commands are serialized and
executed sequentially (MULTI).
• Either all commands or no commands
are processed (EXEC – DISCARD).
• Keys must be explicitely specified in
Redis transactions (WATCH)
• Less useful since lua scripting appeared.
• Commands Available:
• WATCH / UNWATCH
• MULTI
• EXEC / DISCARD
20
REDIS Architecture
Lua Scripting:
• Lua is a small, fast, simple embeddable
scripting language.
• EVAL command takes script, keys and
arguments:
• Redis calls are done through
redis.call or redis.pcall functions:
• Scripts are executed sequentially on the
server in atomic way
21
A Swiss Army Knife for Programmers
Redis gives you a small, light, efficient
remote datastore with persistence, high-
availability, scalability and publish/subscribe
functionalities.
Use is limited just by your imagination:
• Shared Configuration.
• Distributed Lock.
• Caching.
• Work Queues.
• Load Balancers.
• Service Discovery.
• …
Workgroup and Contest
23
A super-simple blog platform
• Use the frontend and the language you prefer:
• Frontend:
• Console Application
• Web Application
• Form Application
• Language:
• List of supported clients: http://redis.io/clients
• 5 Levels of features (10 points):
1. User Management (2 points)
2. Post Management (2 points)
3. Tags / Categories (2 points)
4. Votes (2 points)
5. New posts notification (2 points)
24
User Management
• System should be able to register new users, login existing users and
show registered users.
• Each user should have a unique id (number), a username, a password
• Conventions:
• A common convention is to use hierarchical names for keys
separated by ‘:’ such as blog:users:1 or blog:users:1:posts
• Tip:
• Use String and INCR to manage unique ids.
• Use Hashes to manage user objects
• Use Set to guarantee uniqueness of usernames
25
Post Management
• A logged in user should be able to add a blog post.
• Each post will have a unique id (number), a content, a timestamp and a
subject.
• Given a user the system should return the list of items posted by the
user.
• Tip:
• Use String and INCR to manage unique ids.
• Use Hashes to manage post objects.
• Use Lists to relate posts with owners
26
Tags / Categories
• Modify the previous post structure to keep also a set of tag for each
post.
• Given a tag the system should return all posts tagged with it.
• Given multiple tags the system should return all posts, if any, tagged
with them.
• Tip:
• Add Tags field to post Hash.
• Use Sets to manage categories, and SINTER to search for multiple
tags.
27
Votes
• A logged in user should be able to vote posts.
• Each user must be able to vote just once for a post.
• System should be able to show posts ordered by votes.
• Tip:
• Use Sorted Sets to manage post ranks.
• Use Sets to enforce one vote per user per post.
28
Push Notifications
• A user could express interest for a category (tag) or another user activity.
• System should notify user if an article is posted in a category he
expressed interest into.
• System should notify user if an article is posted by a user he expressed
interest into.
• Tip:
• Use PubSub engine to manage notifications.
• Use one channel per category and one channel per user.
Thanks
Angelo Simone Scotto
a.scotto@reply.eu
Ad

More Related Content

What's hot (19)

Plugging the Holes: Security and Compatability in Hadoop
Plugging the Holes: Security and Compatability in HadoopPlugging the Holes: Security and Compatability in Hadoop
Plugging the Holes: Security and Compatability in Hadoop
Owen O'Malley
 
Contributing To Fedora Project
Contributing To Fedora ProjectContributing To Fedora Project
Contributing To Fedora Project
Parag
 
Redis in 20 minutes
Redis in 20 minutesRedis in 20 minutes
Redis in 20 minutes
András Fehér
 
Deployment Strategies: Managing Code, Content, and Configurations
Deployment Strategies: Managing Code, Content, and ConfigurationsDeployment Strategies: Managing Code, Content, and Configurations
Deployment Strategies: Managing Code, Content, and Configurations
nyccamp
 
SQL on linux
SQL on linuxSQL on linux
SQL on linux
Maximiliano Accotto
 
Fernando Gont - The Hack Summit 2021 - State of the Art in IPv6 Security
Fernando Gont - The Hack Summit 2021 - State of the Art in IPv6 SecurityFernando Gont - The Hack Summit 2021 - State of the Art in IPv6 Security
Fernando Gont - The Hack Summit 2021 - State of the Art in IPv6 Security
EdgeUno
 
The Bundle Dilemma - Richard S. Hall, Researcher, Laboratoire d’Informatique ...
The Bundle Dilemma - Richard S. Hall, Researcher, Laboratoire d’Informatique ...The Bundle Dilemma - Richard S. Hall, Researcher, Laboratoire d’Informatique ...
The Bundle Dilemma - Richard S. Hall, Researcher, Laboratoire d’Informatique ...
mfrancis
 
BuilHigh Performance Weibo Platform-Qcon2011
BuilHigh Performance Weibo Platform-Qcon2011BuilHigh Performance Weibo Platform-Qcon2011
BuilHigh Performance Weibo Platform-Qcon2011
Yiwei Ma
 
Linux again
Linux againLinux again
Linux again
YoungChoonTae
 
Pulsar
PulsarPulsar
Pulsar
Eugene Lazutkin
 
Embedded Systems: Lecture 1: Course Overview
Embedded Systems: Lecture 1: Course OverviewEmbedded Systems: Lecture 1: Course Overview
Embedded Systems: Lecture 1: Course Overview
Ahmed El-Arabawy
 
Introduce iRedMail Open Source Mail Server Solution
Introduce iRedMail Open Source Mail Server SolutionIntroduce iRedMail Open Source Mail Server Solution
Introduce iRedMail Open Source Mail Server Solution
ZhangHuangbin
 
Hpux graduate enginnering trainning
Hpux graduate enginnering trainningHpux graduate enginnering trainning
Hpux graduate enginnering trainning
Radhe Garg
 
GPLS/PINES GenaSYS Presentation - EG2012
GPLS/PINES GenaSYS Presentation - EG2012GPLS/PINES GenaSYS Presentation - EG2012
GPLS/PINES GenaSYS Presentation - EG2012
pines
 
The OpenWMS.org IDE (Tool Chain)
The OpenWMS.org IDE (Tool Chain)The OpenWMS.org IDE (Tool Chain)
The OpenWMS.org IDE (Tool Chain)
Heiko Scherrer
 
Java SE 7 New Features and Enhancements
Java SE 7 New Features and EnhancementsJava SE 7 New Features and Enhancements
Java SE 7 New Features and Enhancements
Fu Cheng
 
SF Bay Area OpenStack Meetup Stacki Presentation
SF Bay Area OpenStack Meetup Stacki Presentation SF Bay Area OpenStack Meetup Stacki Presentation
SF Bay Area OpenStack Meetup Stacki Presentation
StackIQ
 
Ruby on rails toolbox
Ruby on rails toolboxRuby on rails toolbox
Ruby on rails toolbox
Blazing Cloud
 
David buksbaum a-briefintroductiontocsharp
David buksbaum a-briefintroductiontocsharpDavid buksbaum a-briefintroductiontocsharp
David buksbaum a-briefintroductiontocsharp
Jorge Antonio Contre Vargas
 
Plugging the Holes: Security and Compatability in Hadoop
Plugging the Holes: Security and Compatability in HadoopPlugging the Holes: Security and Compatability in Hadoop
Plugging the Holes: Security and Compatability in Hadoop
Owen O'Malley
 
Contributing To Fedora Project
Contributing To Fedora ProjectContributing To Fedora Project
Contributing To Fedora Project
Parag
 
Deployment Strategies: Managing Code, Content, and Configurations
Deployment Strategies: Managing Code, Content, and ConfigurationsDeployment Strategies: Managing Code, Content, and Configurations
Deployment Strategies: Managing Code, Content, and Configurations
nyccamp
 
Fernando Gont - The Hack Summit 2021 - State of the Art in IPv6 Security
Fernando Gont - The Hack Summit 2021 - State of the Art in IPv6 SecurityFernando Gont - The Hack Summit 2021 - State of the Art in IPv6 Security
Fernando Gont - The Hack Summit 2021 - State of the Art in IPv6 Security
EdgeUno
 
The Bundle Dilemma - Richard S. Hall, Researcher, Laboratoire d’Informatique ...
The Bundle Dilemma - Richard S. Hall, Researcher, Laboratoire d’Informatique ...The Bundle Dilemma - Richard S. Hall, Researcher, Laboratoire d’Informatique ...
The Bundle Dilemma - Richard S. Hall, Researcher, Laboratoire d’Informatique ...
mfrancis
 
BuilHigh Performance Weibo Platform-Qcon2011
BuilHigh Performance Weibo Platform-Qcon2011BuilHigh Performance Weibo Platform-Qcon2011
BuilHigh Performance Weibo Platform-Qcon2011
Yiwei Ma
 
Embedded Systems: Lecture 1: Course Overview
Embedded Systems: Lecture 1: Course OverviewEmbedded Systems: Lecture 1: Course Overview
Embedded Systems: Lecture 1: Course Overview
Ahmed El-Arabawy
 
Introduce iRedMail Open Source Mail Server Solution
Introduce iRedMail Open Source Mail Server SolutionIntroduce iRedMail Open Source Mail Server Solution
Introduce iRedMail Open Source Mail Server Solution
ZhangHuangbin
 
Hpux graduate enginnering trainning
Hpux graduate enginnering trainningHpux graduate enginnering trainning
Hpux graduate enginnering trainning
Radhe Garg
 
GPLS/PINES GenaSYS Presentation - EG2012
GPLS/PINES GenaSYS Presentation - EG2012GPLS/PINES GenaSYS Presentation - EG2012
GPLS/PINES GenaSYS Presentation - EG2012
pines
 
The OpenWMS.org IDE (Tool Chain)
The OpenWMS.org IDE (Tool Chain)The OpenWMS.org IDE (Tool Chain)
The OpenWMS.org IDE (Tool Chain)
Heiko Scherrer
 
Java SE 7 New Features and Enhancements
Java SE 7 New Features and EnhancementsJava SE 7 New Features and Enhancements
Java SE 7 New Features and Enhancements
Fu Cheng
 
SF Bay Area OpenStack Meetup Stacki Presentation
SF Bay Area OpenStack Meetup Stacki Presentation SF Bay Area OpenStack Meetup Stacki Presentation
SF Bay Area OpenStack Meetup Stacki Presentation
StackIQ
 
Ruby on rails toolbox
Ruby on rails toolboxRuby on rails toolbox
Ruby on rails toolbox
Blazing Cloud
 

Similar to Redis Labcamp (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
Ricard Clau
 
Redis everywhere - PHP London
Redis everywhere - PHP LondonRedis everywhere - PHP London
Redis everywhere - PHP London
Ricard Clau
 
Exploiting NoSQL Like Never Before
Exploiting NoSQL Like Never BeforeExploiting NoSQL Like Never Before
Exploiting NoSQL Like Never Before
Francis Alexander
 
Redis Everywhere - Sunshine PHP
Redis Everywhere - Sunshine PHPRedis Everywhere - Sunshine PHP
Redis Everywhere - Sunshine PHP
Ricard Clau
 
Introduction to Redis
Introduction to RedisIntroduction to Redis
Introduction to Redis
Ofer Zelig
 
New York REDIS Meetup Welcome Session
New York REDIS Meetup Welcome SessionNew York REDIS Meetup Welcome Session
New York REDIS Meetup Welcome Session
Aleksandr Yampolskiy
 
Redis - Your Magical superfast database
Redis - Your Magical superfast databaseRedis - Your Magical superfast database
Redis - Your Magical superfast database
the100rabh
 
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
 
05 integrate redis
05 integrate redis05 integrate redis
05 integrate redis
Erhwen Kuo
 
KeyValue Stores
KeyValue StoresKeyValue Stores
KeyValue Stores
Mauro Pompilio
 
Introduction to Redis
Introduction to RedisIntroduction to Redis
Introduction to Redis
TO THE NEW | Technology
 
Why ruby and rails
Why ruby and railsWhy ruby and rails
Why ruby and rails
Reuven Lerner
 
Redis - The Universal NoSQL Tool
Redis - The Universal NoSQL ToolRedis - The Universal NoSQL Tool
Redis - The Universal NoSQL Tool
Eberhard Wolff
 
Intro to Big Data and NoSQL
Intro to Big Data and NoSQLIntro to Big Data and NoSQL
Intro to Big Data and NoSQL
Don Demcsak
 
Redis and it's data types
Redis and it's data typesRedis and it's data types
Redis and it's data types
Aniruddha Chakrabarti
 
Redis Streams - Fiverr Tech5 meetup
Redis Streams - Fiverr Tech5 meetupRedis Streams - Fiverr Tech5 meetup
Redis Streams - Fiverr Tech5 meetup
Itamar Haber
 
DynomiteDB - No spof High-availability Redis cluster solution
DynomiteDB -  No spof High-availability Redis cluster solutionDynomiteDB -  No spof High-availability Redis cluster solution
DynomiteDB - No spof High-availability Redis cluster solution
Leandro Totino Pereira
 
7. Key-Value Databases: In Depth
7. Key-Value Databases: In Depth7. Key-Value Databases: In Depth
7. Key-Value Databases: In Depth
Fabio Fumarola
 
Mini-Training: Redis
Mini-Training: RedisMini-Training: Redis
Mini-Training: Redis
Betclic Everest Group Tech Team
 
The Complete MariaDB Server tutorial
The Complete MariaDB Server tutorialThe Complete MariaDB Server tutorial
The Complete MariaDB Server tutorial
Colin Charles
 
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 - PHP London
Redis everywhere - PHP LondonRedis everywhere - PHP London
Redis everywhere - PHP London
Ricard Clau
 
Exploiting NoSQL Like Never Before
Exploiting NoSQL Like Never BeforeExploiting NoSQL Like Never Before
Exploiting NoSQL Like Never Before
Francis Alexander
 
Redis Everywhere - Sunshine PHP
Redis Everywhere - Sunshine PHPRedis Everywhere - Sunshine PHP
Redis Everywhere - Sunshine PHP
Ricard Clau
 
Introduction to Redis
Introduction to RedisIntroduction to Redis
Introduction to Redis
Ofer Zelig
 
New York REDIS Meetup Welcome Session
New York REDIS Meetup Welcome SessionNew York REDIS Meetup Welcome Session
New York REDIS Meetup Welcome Session
Aleksandr Yampolskiy
 
Redis - Your Magical superfast database
Redis - Your Magical superfast databaseRedis - Your Magical superfast database
Redis - Your Magical superfast database
the100rabh
 
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
 
05 integrate redis
05 integrate redis05 integrate redis
05 integrate redis
Erhwen Kuo
 
Redis - The Universal NoSQL Tool
Redis - The Universal NoSQL ToolRedis - The Universal NoSQL Tool
Redis - The Universal NoSQL Tool
Eberhard Wolff
 
Intro to Big Data and NoSQL
Intro to Big Data and NoSQLIntro to Big Data and NoSQL
Intro to Big Data and NoSQL
Don Demcsak
 
Redis Streams - Fiverr Tech5 meetup
Redis Streams - Fiverr Tech5 meetupRedis Streams - Fiverr Tech5 meetup
Redis Streams - Fiverr Tech5 meetup
Itamar Haber
 
DynomiteDB - No spof High-availability Redis cluster solution
DynomiteDB -  No spof High-availability Redis cluster solutionDynomiteDB -  No spof High-availability Redis cluster solution
DynomiteDB - No spof High-availability Redis cluster solution
Leandro Totino Pereira
 
7. Key-Value Databases: In Depth
7. Key-Value Databases: In Depth7. Key-Value Databases: In Depth
7. Key-Value Databases: In Depth
Fabio Fumarola
 
The Complete MariaDB Server tutorial
The Complete MariaDB Server tutorialThe Complete MariaDB Server tutorial
The Complete MariaDB Server tutorial
Colin Charles
 
Ad

More from Angelo Simone Scotto (10)

Keep Calm and Distributed Tracing
Keep Calm and Distributed TracingKeep Calm and Distributed Tracing
Keep Calm and Distributed Tracing
Angelo Simone Scotto
 
Rective Programming with Actor Model in .NET
Rective Programming with Actor Model in .NETRective Programming with Actor Model in .NET
Rective Programming with Actor Model in .NET
Angelo Simone Scotto
 
DevOps, Lean and You
DevOps, Lean and YouDevOps, Lean and You
DevOps, Lean and You
Angelo Simone Scotto
 
Agile, DevOps, X-Teams: Is software a social science?
Agile, DevOps, X-Teams: Is software a social science?Agile, DevOps, X-Teams: Is software a social science?
Agile, DevOps, X-Teams: Is software a social science?
Angelo Simone Scotto
 
Adapt or Go extinct
Adapt or Go extinctAdapt or Go extinct
Adapt or Go extinct
Angelo Simone Scotto
 
Discovering RxJS - MilanoJS Meeting in May 2016
Discovering RxJS - MilanoJS Meeting in May 2016Discovering RxJS - MilanoJS Meeting in May 2016
Discovering RxJS - MilanoJS Meeting in May 2016
Angelo Simone Scotto
 
Taming Asynchrony using RxJS
Taming Asynchrony using RxJSTaming Asynchrony using RxJS
Taming Asynchrony using RxJS
Angelo Simone Scotto
 
Are Microservices our future?
Are Microservices our future?Are Microservices our future?
Are Microservices our future?
Angelo Simone Scotto
 
An Introduction to Machine Learning
An Introduction to Machine LearningAn Introduction to Machine Learning
An Introduction to Machine Learning
Angelo Simone Scotto
 
Actor Model & Reactive Manifesto
Actor Model & Reactive ManifestoActor Model & Reactive Manifesto
Actor Model & Reactive Manifesto
Angelo Simone Scotto
 
Rective Programming with Actor Model in .NET
Rective Programming with Actor Model in .NETRective Programming with Actor Model in .NET
Rective Programming with Actor Model in .NET
Angelo Simone Scotto
 
Agile, DevOps, X-Teams: Is software a social science?
Agile, DevOps, X-Teams: Is software a social science?Agile, DevOps, X-Teams: Is software a social science?
Agile, DevOps, X-Teams: Is software a social science?
Angelo Simone Scotto
 
Discovering RxJS - MilanoJS Meeting in May 2016
Discovering RxJS - MilanoJS Meeting in May 2016Discovering RxJS - MilanoJS Meeting in May 2016
Discovering RxJS - MilanoJS Meeting in May 2016
Angelo Simone Scotto
 
An Introduction to Machine Learning
An Introduction to Machine LearningAn Introduction to Machine Learning
An Introduction to Machine Learning
Angelo Simone Scotto
 
Ad

Recently uploaded (20)

Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Eric D. Schabell
 
Adobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage Dashboards
Adobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage DashboardsAdobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage Dashboards
Adobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage Dashboards
BradBedford3
 
Kubernetes_101_Zero_to_Platform_Engineer.pptx
Kubernetes_101_Zero_to_Platform_Engineer.pptxKubernetes_101_Zero_to_Platform_Engineer.pptx
Kubernetes_101_Zero_to_Platform_Engineer.pptx
CloudScouts
 
Download Wondershare Filmora Crack [2025] With Latest
Download Wondershare Filmora Crack [2025] With LatestDownload Wondershare Filmora Crack [2025] With Latest
Download Wondershare Filmora Crack [2025] With Latest
tahirabibi60507
 
Revolutionizing Residential Wi-Fi PPT.pptx
Revolutionizing Residential Wi-Fi PPT.pptxRevolutionizing Residential Wi-Fi PPT.pptx
Revolutionizing Residential Wi-Fi PPT.pptx
nidhisingh691197
 
Adobe Master Collection CC Crack Advance Version 2025
Adobe Master Collection CC Crack Advance Version 2025Adobe Master Collection CC Crack Advance Version 2025
Adobe Master Collection CC Crack Advance Version 2025
kashifyounis067
 
Top 10 Client Portal Software Solutions for 2025.docx
Top 10 Client Portal Software Solutions for 2025.docxTop 10 Client Portal Software Solutions for 2025.docx
Top 10 Client Portal Software Solutions for 2025.docx
Portli
 
Download YouTube By Click 2025 Free Full Activated
Download YouTube By Click 2025 Free Full ActivatedDownload YouTube By Click 2025 Free Full Activated
Download YouTube By Click 2025 Free Full Activated
saniamalik72555
 
Scaling GraphRAG: Efficient Knowledge Retrieval for Enterprise AI
Scaling GraphRAG:  Efficient Knowledge Retrieval for Enterprise AIScaling GraphRAG:  Efficient Knowledge Retrieval for Enterprise AI
Scaling GraphRAG: Efficient Knowledge Retrieval for Enterprise AI
danshalev
 
Maxon CINEMA 4D 2025 Crack FREE Download LINK
Maxon CINEMA 4D 2025 Crack FREE Download LINKMaxon CINEMA 4D 2025 Crack FREE Download LINK
Maxon CINEMA 4D 2025 Crack FREE Download LINK
younisnoman75
 
F-Secure Freedome VPN 2025 Crack Plus Activation New Version
F-Secure Freedome VPN 2025 Crack Plus Activation  New VersionF-Secure Freedome VPN 2025 Crack Plus Activation  New Version
F-Secure Freedome VPN 2025 Crack Plus Activation New Version
saimabibi60507
 
Designing AI-Powered APIs on Azure: Best Practices& Considerations
Designing AI-Powered APIs on Azure: Best Practices& ConsiderationsDesigning AI-Powered APIs on Azure: Best Practices& Considerations
Designing AI-Powered APIs on Azure: Best Practices& Considerations
Dinusha Kumarasiri
 
EASEUS Partition Master Crack + License Code
EASEUS Partition Master Crack + License CodeEASEUS Partition Master Crack + License Code
EASEUS Partition Master Crack + License Code
aneelaramzan63
 
Douwan Crack 2025 new verson+ License code
Douwan Crack 2025 new verson+ License codeDouwan Crack 2025 new verson+ License code
Douwan Crack 2025 new verson+ License code
aneelaramzan63
 
Societal challenges of AI: biases, multilinguism and sustainability
Societal challenges of AI: biases, multilinguism and sustainabilitySocietal challenges of AI: biases, multilinguism and sustainability
Societal challenges of AI: biases, multilinguism and sustainability
Jordi Cabot
 
LEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRY
LEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRYLEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRY
LEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRY
NidaFarooq10
 
Landscape of Requirements Engineering for/by AI through Literature Review
Landscape of Requirements Engineering for/by AI through Literature ReviewLandscape of Requirements Engineering for/by AI through Literature Review
Landscape of Requirements Engineering for/by AI through Literature Review
Hironori Washizaki
 
FL Studio Producer Edition Crack 2025 Full Version
FL Studio Producer Edition Crack 2025 Full VersionFL Studio Producer Edition Crack 2025 Full Version
FL Studio Producer Edition Crack 2025 Full Version
tahirabibi60507
 
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Andre Hora
 
PDF Reader Pro Crack Latest Version FREE Download 2025
PDF Reader Pro Crack Latest Version FREE Download 2025PDF Reader Pro Crack Latest Version FREE Download 2025
PDF Reader Pro Crack Latest Version FREE Download 2025
mu394968
 
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Eric D. Schabell
 
Adobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage Dashboards
Adobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage DashboardsAdobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage Dashboards
Adobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage Dashboards
BradBedford3
 
Kubernetes_101_Zero_to_Platform_Engineer.pptx
Kubernetes_101_Zero_to_Platform_Engineer.pptxKubernetes_101_Zero_to_Platform_Engineer.pptx
Kubernetes_101_Zero_to_Platform_Engineer.pptx
CloudScouts
 
Download Wondershare Filmora Crack [2025] With Latest
Download Wondershare Filmora Crack [2025] With LatestDownload Wondershare Filmora Crack [2025] With Latest
Download Wondershare Filmora Crack [2025] With Latest
tahirabibi60507
 
Revolutionizing Residential Wi-Fi PPT.pptx
Revolutionizing Residential Wi-Fi PPT.pptxRevolutionizing Residential Wi-Fi PPT.pptx
Revolutionizing Residential Wi-Fi PPT.pptx
nidhisingh691197
 
Adobe Master Collection CC Crack Advance Version 2025
Adobe Master Collection CC Crack Advance Version 2025Adobe Master Collection CC Crack Advance Version 2025
Adobe Master Collection CC Crack Advance Version 2025
kashifyounis067
 
Top 10 Client Portal Software Solutions for 2025.docx
Top 10 Client Portal Software Solutions for 2025.docxTop 10 Client Portal Software Solutions for 2025.docx
Top 10 Client Portal Software Solutions for 2025.docx
Portli
 
Download YouTube By Click 2025 Free Full Activated
Download YouTube By Click 2025 Free Full ActivatedDownload YouTube By Click 2025 Free Full Activated
Download YouTube By Click 2025 Free Full Activated
saniamalik72555
 
Scaling GraphRAG: Efficient Knowledge Retrieval for Enterprise AI
Scaling GraphRAG:  Efficient Knowledge Retrieval for Enterprise AIScaling GraphRAG:  Efficient Knowledge Retrieval for Enterprise AI
Scaling GraphRAG: Efficient Knowledge Retrieval for Enterprise AI
danshalev
 
Maxon CINEMA 4D 2025 Crack FREE Download LINK
Maxon CINEMA 4D 2025 Crack FREE Download LINKMaxon CINEMA 4D 2025 Crack FREE Download LINK
Maxon CINEMA 4D 2025 Crack FREE Download LINK
younisnoman75
 
F-Secure Freedome VPN 2025 Crack Plus Activation New Version
F-Secure Freedome VPN 2025 Crack Plus Activation  New VersionF-Secure Freedome VPN 2025 Crack Plus Activation  New Version
F-Secure Freedome VPN 2025 Crack Plus Activation New Version
saimabibi60507
 
Designing AI-Powered APIs on Azure: Best Practices& Considerations
Designing AI-Powered APIs on Azure: Best Practices& ConsiderationsDesigning AI-Powered APIs on Azure: Best Practices& Considerations
Designing AI-Powered APIs on Azure: Best Practices& Considerations
Dinusha Kumarasiri
 
EASEUS Partition Master Crack + License Code
EASEUS Partition Master Crack + License CodeEASEUS Partition Master Crack + License Code
EASEUS Partition Master Crack + License Code
aneelaramzan63
 
Douwan Crack 2025 new verson+ License code
Douwan Crack 2025 new verson+ License codeDouwan Crack 2025 new verson+ License code
Douwan Crack 2025 new verson+ License code
aneelaramzan63
 
Societal challenges of AI: biases, multilinguism and sustainability
Societal challenges of AI: biases, multilinguism and sustainabilitySocietal challenges of AI: biases, multilinguism and sustainability
Societal challenges of AI: biases, multilinguism and sustainability
Jordi Cabot
 
LEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRY
LEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRYLEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRY
LEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRY
NidaFarooq10
 
Landscape of Requirements Engineering for/by AI through Literature Review
Landscape of Requirements Engineering for/by AI through Literature ReviewLandscape of Requirements Engineering for/by AI through Literature Review
Landscape of Requirements Engineering for/by AI through Literature Review
Hironori Washizaki
 
FL Studio Producer Edition Crack 2025 Full Version
FL Studio Producer Edition Crack 2025 Full VersionFL Studio Producer Edition Crack 2025 Full Version
FL Studio Producer Edition Crack 2025 Full Version
tahirabibi60507
 
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Andre Hora
 
PDF Reader Pro Crack Latest Version FREE Download 2025
PDF Reader Pro Crack Latest Version FREE Download 2025PDF Reader Pro Crack Latest Version FREE Download 2025
PDF Reader Pro Crack Latest Version FREE Download 2025
mu394968
 

Redis Labcamp

  • 1. REDIS Labcamp Angelo Simone Scotto Cluster Reply
  • 2. 2 • Developed by Salvatore Sanfilippo for his startup Merzia S.r.l. • Aimed as a fast replacement of MySQL for web analytics (LLOOGG) • Released as open source in 2009. • Sponsored by VMWare since 2010. • Sponsored by Pivotal since 2013. • Currently part of backend of An italian story • Twitter • Github • Pinterest • StackOverflow • Flickr • …
  • 3. 3 What is REDIS (REmote DIctionary Service) Redis is a DSL (Domain Specific Language) that manipulates abstract data types and implemented as a TCP daemon. Commands manipulate a key space where keys are binary-safe strings and values are different kinds of abstract data types. REDIS Manifesto
  • 4. 4 Available Abstract Data Types Key-Value Store: • Keys  Printable ASCII • Values  Primitives  Strings  Containers (of strings)  Hashes  Lists  Sets  Sorted Sets Other Functionalities  Pub/Sub  HyperLogLog  Bitmaps
  • 5. 5 Where to find Redis • Obviosuly at redis website : http://redis.io • Redis written in ANSI C and POSIX compliant: • Linux (supported and recommended) • Mac OS X (supported) • *BSD (supported) • Solaris (support defined «Best effort») • Windows is not directly supported by REDIS Project but • Microsoft mantains and support a version at http://msopentech.com/opentech-projects/redis/ • Used by Microsoft in Azure (Azure Redis Cache Service) therefore stable and usable also on windows.
  • 6. 6 How to Install Redis • On Windows, very simple: • Download binaries from https://github.com/MSOpenTech/redis/tree/2.8/bin/release, unzip and run. • On Linux or MacOSX: • Your preferred Package Manager (apt-get, YUM …) should have it but it’s usually not recommended because often lagging behind current version. • Recommended way is to recompile binaries directly: http://redis.io/download
  • 7. 7 Strings Redis Key Value: Redis String • Max Value Size: 512 MB • Binary Strings Commands: • GET, SET • INCR, DECR, INCRBY, DECRBY • GETBIT, SETBIT, BITCOUNT, BITPOS, BITOP • APPEND, GETRANGE, SETRANGE • MGET, MSET
  • 8. 8 Hashes • Max Value Size: 512 MB • Binary Strings Redis Key Value: Redis Hash Field 1 Value 1 Field 2 Value 2 Field 3 Value 3 Commands: • HGET, HSET • HINCRBY, HINCRBYFLOAT • HLEN, HGETALL, HVALS, HKEYS • HMGET, HMSET
  • 9. 9 Lists • LPUSH, LPOP (Left, first) • RPUSH, RPOP (Right, last) • Queues are simply lists when using LPUSH & RPOP • Stack are simply lists when using LPUSH & LPOP • Index (list) operations are obviously available (LINDEX) Redis Key Value: Redis List HEAD Value1 Valuen TAIL Commands: • LPUSH, LPOP • RPUSH, RPOP, RPOPLPUSH • BLPOP, BRPOP, BRPOPLPUSH • LINDEX, LRANGE, LREM
  • 10. 10 Sets • Unsorted set • Unique Values (duplicates are non inserted) Redis Key Value: Redis Set Value 2 Value 1 Value 4 Value 5 Value 3 Commands: • SADD, SPOP, SREM • SCARD, SISMEMBER • SUNION, SDIFF, SINTER • SUNIONSTORE, SDIFFSTORE, SINTERSTORE
  • 11. 11 Sorted Sets • Score is a float (double precision floating number). • Unique Values (duplicates are non inserted) • Sorted sets are sorted by their score in ascending way Redis Key Value: Redis Sorted Set Value1 Score100 Value2 Score200 Value3 Score200 Value4 Score250 Commands: • ZADD, ZREM • ZCARD, ZRANGE, ZREVRANGE • ZSCORE, ZCOUNT, ZINCRBY, ZRANGEBYSCORE • ZLEXCOUNT, ZRANGEBYLEX, ZREVRANGEBYLEX, ZREMRANGEBYLEX • ZUNIONSTORE, ZINTERSTORE
  • 12. 12 Other Functionalities Bitmaps:  Not really a type, just a set of operators on strings. Publish / Subscribe:  Not a type, it implements a fire&forget publish/subscribe engine.  PUBLISH, SUBSCRIBE, UNSUBSCRIBE  PSUBSCRIBE, PUNSUBSCRIBE HyperLogLog:  Value contains an HyperLogLog algorithm implementation.  REDIS implementation uses 12K per key with a std error of 0.81% to count 2^64 items.  PFADD, PFCOUNT, PFMERGE
  • 13. 13 REDIS Architecture Key points: • Extremely Fast. • i.e. Data is always in RAM.
  • 14. 14 REDIS Architecture Key points: • Extremely Fast. • i.e. Data is always in RAM. • Extremely Simple. • i.e. REDIS is single-threaded.
  • 15. 15 REDIS Architecture Key points: • Extremely Fast. • i.e. Data is always in RAM. • Extremely Simple. • i.e. REDIS is single-threaded. • Extremely Light.
  • 16. 16 REDIS Architecture Key points: • Extremely Fast. • i.e. Data is always in RAM. • Extremely Simple. • i.e. REDIS is single-threaded. • Extremely Light. • Extremely Robust.
  • 17. 17 REDIS Architecture Security: «Redis is not optimized for maximum security but for maximum performance and simplicity» • AUTH with password. • BIND to specific network interface. • No encryption (use SSL proxy) • No ACS (each connection is admin) • Possible to RENAME sensible commands…
  • 18. 18 REDIS Architecture Persistence: • None. • RDB (Redis DB) single-file dump. • AOF (Append Only File), a log file. • No fsync (fast, not safe). • Fsync each second. • Fsync each query (slow but safe). • Both Memory Usage: • Data is always in memory, you cannot have more data than RAM in REDIS. • Virtual Memory deprecated. • Disk Store abandoned. • Several policies to manage overflow: • noeviction: no action, just error. • allkeys-lru: remove older data • allkeys-random: remove rnd data • volatile-lru: remove expirable • volatile-random: remove expirable • volatile-ttl: remove expirable
  • 19. 19 REDIS Architecture Transactions: • Not an ACID Transactions. • All commands are serialized and executed sequentially (MULTI). • Either all commands or no commands are processed (EXEC – DISCARD). • Keys must be explicitely specified in Redis transactions (WATCH) • Less useful since lua scripting appeared. • Commands Available: • WATCH / UNWATCH • MULTI • EXEC / DISCARD
  • 20. 20 REDIS Architecture Lua Scripting: • Lua is a small, fast, simple embeddable scripting language. • EVAL command takes script, keys and arguments: • Redis calls are done through redis.call or redis.pcall functions: • Scripts are executed sequentially on the server in atomic way
  • 21. 21 A Swiss Army Knife for Programmers Redis gives you a small, light, efficient remote datastore with persistence, high- availability, scalability and publish/subscribe functionalities. Use is limited just by your imagination: • Shared Configuration. • Distributed Lock. • Caching. • Work Queues. • Load Balancers. • Service Discovery. • …
  • 23. 23 A super-simple blog platform • Use the frontend and the language you prefer: • Frontend: • Console Application • Web Application • Form Application • Language: • List of supported clients: http://redis.io/clients • 5 Levels of features (10 points): 1. User Management (2 points) 2. Post Management (2 points) 3. Tags / Categories (2 points) 4. Votes (2 points) 5. New posts notification (2 points)
  • 24. 24 User Management • System should be able to register new users, login existing users and show registered users. • Each user should have a unique id (number), a username, a password • Conventions: • A common convention is to use hierarchical names for keys separated by ‘:’ such as blog:users:1 or blog:users:1:posts • Tip: • Use String and INCR to manage unique ids. • Use Hashes to manage user objects • Use Set to guarantee uniqueness of usernames
  • 25. 25 Post Management • A logged in user should be able to add a blog post. • Each post will have a unique id (number), a content, a timestamp and a subject. • Given a user the system should return the list of items posted by the user. • Tip: • Use String and INCR to manage unique ids. • Use Hashes to manage post objects. • Use Lists to relate posts with owners
  • 26. 26 Tags / Categories • Modify the previous post structure to keep also a set of tag for each post. • Given a tag the system should return all posts tagged with it. • Given multiple tags the system should return all posts, if any, tagged with them. • Tip: • Add Tags field to post Hash. • Use Sets to manage categories, and SINTER to search for multiple tags.
  • 27. 27 Votes • A logged in user should be able to vote posts. • Each user must be able to vote just once for a post. • System should be able to show posts ordered by votes. • Tip: • Use Sorted Sets to manage post ranks. • Use Sets to enforce one vote per user per post.
  • 28. 28 Push Notifications • A user could express interest for a category (tag) or another user activity. • System should notify user if an article is posted in a category he expressed interest into. • System should notify user if an article is posted by a user he expressed interest into. • Tip: • Use PubSub engine to manage notifications. • Use one channel per category and one channel per user.

Editor's Notes

  • #3: 1308 Dante Alighieri started writing Divina Commedia. 1508 Michelangelo Buonarroti started painting Sistine Chapel 2009 Salvatore Sanfilippo started writing REDIS (really bad tempism…)
  • #16: Update 7/2014 StackOverflow As a network #54 site for traffic in the world 2600-3000 requests/sec 2 Dell R610 Redis servers: 2x Intel Xeon Processor E5640 @ 2.66 GHz 16 GB RAM CentOS