SlideShare a Scribd company logo
Fabrizio Farinacci
!!!!i!
i iiiiii i iii iii
i i i i sssss
1
1. What is Redis?
REmote DIctionary Server
2
“ is an in-memory data
structure store, that
can be served as a
database, cache or
message broker
(Pub/Sub).
3
?!?i?
eii!i?!i?ei!
4
… a ‘‘data structure server’’?
Redis is essentially a key-value database… but it’s NOT
a plain key-value database: it’s not limited to string values,
but can also hold complex data structures.
5
2. Supported Data Types
6
Strings
Command line:
> set mystr foo
OK
> set myint 1
OK
> get mystr
"foo"
> append mystr foo
(integer) 6
> incr myint
(integer) 2
> mget mystr myint
1) "foofoo"
2) "2"
Are key-value pairs, to store strings or integers, with:
□Common operations on strings (APPEND, STRLEN, exc.);
□Atomic increment/decrement (INCR/DECR) on integers;
□Get multiple values at once (MGET).
Python:
>>> import redis
>>> r = redis.StrictRedis(
host='localhost',
port=6379, db=0
)
>>> r.set('mystr', 'foo')
True
>>> r.set('myint', 1)
True
>>> r.get('mystr')
'foo'
>>> r.append('mystr', 'foo')
6L
>>> r.incr('myint')
2
>>> r.mget('mystr', 'myint')
['foofoo', '2']
7
Lists
Are linked-lists of strings:
□Index-based access to the entries;
□Insertion and deletion at head/tail,
in constant-time (push/pop);
□Trim/Range operations available.
8
Interacting
with Lists
Command line:
> rpush mylist A
(integer) 1
> rpush mylist B
(integer) 2
> lpush mylist first
(integer) 3
> lrange mylist 0 ‐1
1) "first"
2) "A"
3) "B"
> lrange mylist 1 3
1) "A"
2) "B"
Python:
>>> import redis
>>> r = redis.StrictRedis(
host='localhost',
port=6379, db=0
)
>>> r.rpush('mylist', 'A')
1L
>>> r.rpush('mylist', 'B')
2L
>>> r.lpush('mylist', 'first')
3L
>>> r.lrange('mylist', 0, ‐1)
['first', 'A', 'B']
>>> r.lrange('mylist', 1, 3)
['A', 'B']
9
Sets
Are sets of strings:
□Unordered collection of non-
repeating elements;
□Intersection/Union/Difference
between multiple sets;
□Membership test available.
10
Interacting
with Sets
Command line:
> sadd myset A
(integer) 1
> sadd myset B
(integer) 1
> sadd myset2 C
(integer) 1
> sismember myset C
(integer) 0
> smembers myset
1) "A"
2) "B"
> sunion myset myset2
1) "A"
2) "B"
3) "C"
Python:
>>> import redis
>>> r = redis.StrictRedis(
host='localhost',
port=6379, db=0
)
>>> r.sadd('myset', 'A')
1
>>> r.sadd('myset', 'B')
1
>>> r.sadd('myset2', 'C')
1
>>> r.sismember('myset', 'C')
False
>>> r.smembers('myset')
set(['A', 'B']) 
>>> r.sunion('myset', 'myset2')
set(['A', 'C', 'B'])
11
Sorted Set
(ZSET)
12
Are sorted sets of strings:
□Collection of non-repeating elements
sorted by floating-point numbers
(the score) and lexicographically;
□Range operations on score/lexicon;
□Intersection/Union between sets.
Interacting
with ZSETs
Command line:
> zadd myzset 2 C
(integer) 1
> zadd myzset 3 D
(integer) 1
> zadd myzset 1 A
(integer) 1
> zadd myzset 2 B
(integer) 1
> zrange myzset 0 ‐1
1) "A" 2) "B" 3) "C" 4) "D"
> zrangebyscore myzset 1 2
1) "A" 2) "B" 3) "C"
> zrangebylex myzset (A [D 
1) "B" 2) "C" 3) "D"
Python:
>>> import redis
>>> r = redis.StrictRedis(
host='localhost',
port=6379, db=0
)
>>> r.zadd('myzset', 2, 'C')
1
>>> r.zadd('myzset', 3, 'D') 
1
>>> r.zadd('myzset', A=1) 
1
>>> r.zadd('myzset', B=2) 
1
>>> r.zrange('myzset', 0, ‐1) 
['A', 'B', 'C', 'D']
>>> r.zrangebyscore('myzset', 1, 2) 
['A', 'B', 'C'] 
>>> r.zrangebylex('myzset', '(A', '[D') 
['B', 'C', 'D']
13
Hash
A map of field-value pairs:
□Key-based access, specifying
selected field or fields;
□To implement objects, specifying
the name of the field and its value.
14
Interacting
with Hashes
Command line:
> hset myhash key1 A
(integer) 1
> hmset myhash key2 B key3 C
OK
> hget myhash key2
"B"
> hmget myhash key1 key3
1) "A"
2) "C"
> hgetall myhash
1) "key1"
2) "A"
3) "key2"
4) "B"
5) "key3"
6) "C"
Python:
>>> import redis
>>> r = redis.StrictRedis(
host='localhost',
port=6379, db=0
)
>>> r.hset('myhash', 'key1', 'A') 
1L
>>> r.hmset('myhash',
{'key2':'B', 'key3':'C'}
) 
True
>>> r.hget('myhash', 'key2')
'B'
>>> r.hmget('myhash', 'key1', 'key3') 
['A', 'C']
>>> r.hgetall('myhash')
{'key3': 'C', 'key2': 'B', 'key1': 'A'}
15
Additional
Data
Structures
Bitmap: A set of
bit-oriented
operations (e.g.
GETBIT/SETBIT)
to manipulate string
values as blobs of
size up to 512 MB.
HyperLogLog: A
probabilistic data
structure structure
to estimate size of
sets (i.e. counting
unique elements)
efficiently and in
constant-space.
Geo: Geospatial
items, stored as
geospatial
indexes (in sorted
indexes). Support
for distance based
operations (eg.
GEODIST) and
radius queries
(GEORADIUS).
Available only in
the BETA testing
version (3.2.0).
16
3. Personal Project
17
Redis
Pub/Sub
18
To implement the Publish/Subscribe paradigm:
□Published messages (PUBLISH) are categorized
into channels and pushed to all the subscribers
(SUBSCRIBE).
□Publisher and subscriber are completely
decoupled: advantages are high scalability and
dynamic network features.
Place your screenshot here
□ Redis Pub/Sub channels are exploited as thematic channels
(EG. Sport, Tv Shows, exc.).
□ Users subscribe to the channels they’re interested in.
□ Once the web-chat session is started the user can:
■ Receive messages published on the channels of interest;
■ Publish messages onto selected channels.
Redis SubsChat:
A multi-thematic
web-chat
19
How it has
been done?
import redis
# At the beginning, to setup the Redis interface object
r = redis.StrictRedis(host='localhost', port=6379, db=0)
...
# When start is pressed, the session starts
def on_start():
pubsub = r.pubsub() 
# Disable Widgets and manage subscriptions
...
ui.checkBox.setEnabled(False)
if ui.checkBox.isChecked():
# Setup the the handler for the subscriber tasks
pubsub.subscribe(**{str(ui.checkBox.text()): 
mess_handler}) ... 
# This is done for all the checklists
...
# Run the receiver tasks into a parallel thread ... 
thread = pubsub.run_in_thread(sleep_time=0.001)
...
20
How it has
been done? (2)
...
# Handler that pushes the received message onto the web‐chat
def mess_handler(message):
QtCore.QMetaObject.invokeMethod(ui.textEdit, 
"append",QtCore.Q_ARG(str, str(message['data'])+'n')) 
... 
# To send a message when send is pressed
def on_send(): 
# Get the info about the message from the UI
msg = str(ui.textEdit_2.toPlainText()) 
if len(msg) > 0:
usrname = str(ui.lineEdit.text())
if len(usrname) == 0:
usrname = '<Anonymous>' 
channel = str(ui.comboBox.currentText())
ui.textEdit_2.clear() 
message = ‘%s [%s]: %s' % (usrname, channel, msg) 
# Publish the message onto the specified channel
r.publish(channel, message)
...
21
How it has
been done? (3)
...
def on_stop(): 
# Re‐enable the disabled widgets
...
ui.checkBox_2.setEnabled(True)
... 
# This is done for all the checklists
...
pubsub.close() 
... 
if __name__ == "__main__": 
# To setup the UI and make the application run
import sys
app = QtGui.QApplication(sys.argv) 
MainWindow = QtGui.QMainWindow() 
ui = Ui_MainWindow() ui.setupUi(MainWindow) 
MainWindow.show() 
sys.exit(app.exec_())
22
Live Demo
Let’s see how it works!!
23
4. Use cases
When should we use it?
24
Performances
and usability
Redis is an in-memory database, persistent on disk.
PROs:
□Faster reads and writes: all
happens in memory. A
transaction is considered
committed without the need of
writing on the disk.
□Simple complex data
structure manipulation: all
is in memory; lower complexity.
□Efficient persistency
management: snapshotting or
journal mode.
CONs:
□Suitable for small datasets,
of size up to memory capacity.
□Not suitable for application
where durability is a crucial
aspect.
25
When it
should be
used? We Should use it if:
□Small datasets that
fits in memory: very
high performance,
similar to a cache.
□Assumptions on
data structures and
queries: to take
advantage of the
supported data types.
□Realize a cache
layer: for example, to
speedup a conventional
RDBMS.
We Shouldn’t use it if:
□Frequent schema
changes: a traditional
key-value approach, with
the schema managed by
the application, would be
preferred.
□Prototyping: don’t
want to waste loads of
time in the design of the
database and have the
application soon ready.
□Durability critical
applications: like seat
booking mechanism.
26
Who’s using
Redis?
And many others!
27
thanks!
Any questions?
You can find me at:
https://it.linkedin.com/in/fabrizio-farinacci-496679116
https://github.com/FabFari/redis-subschat
?
28

More Related Content

What's hot

Introduction to Redis
Introduction to RedisIntroduction to Redis
Introduction to Redis
Arnab Mitra
 
Introduction to Redis
Introduction to RedisIntroduction to Redis
Introduction to Redis
Maarten Smeets
 
Introduction to redis
Introduction to redisIntroduction to redis
Introduction to redis
NexThoughts Technologies
 
Salvatore Sanfilippo – How Redis Cluster works, and why - NoSQL matters Barce...
Salvatore Sanfilippo – How Redis Cluster works, and why - NoSQL matters Barce...Salvatore Sanfilippo – How Redis Cluster works, and why - NoSQL matters Barce...
Salvatore Sanfilippo – How Redis Cluster works, and why - NoSQL matters Barce...
NoSQLmatters
 
An Introduction to REDIS NoSQL database
An Introduction to REDIS NoSQL databaseAn Introduction to REDIS NoSQL database
An Introduction to REDIS NoSQL database
Ali MasudianPour
 
An Introduction to Redis for Developers.pdf
An Introduction to Redis for Developers.pdfAn Introduction to Redis for Developers.pdf
An Introduction to Redis for Developers.pdf
Stephen Lorello
 
Redis introduction
Redis introductionRedis introduction
Best Practices for Managing MongoDB with Ops Manager
Best Practices for Managing MongoDB with Ops ManagerBest Practices for Managing MongoDB with Ops Manager
Best Practices for Managing MongoDB with Ops Manager
MongoDB
 
Redpanda and ClickHouse
Redpanda and ClickHouseRedpanda and ClickHouse
Redpanda and ClickHouse
Altinity Ltd
 
Redis cluster
Redis clusterRedis cluster
Redis cluster
iammutex
 
redis basics
redis basicsredis basics
redis basics
Manoj Kumar
 
Introduction to redis - version 2
Introduction to redis - version 2Introduction to redis - version 2
Introduction to redis - version 2
Dvir Volk
 
Kicking ass with redis
Kicking ass with redisKicking ass with redis
Kicking ass with redisDvir Volk
 
High Performance, High Reliability Data Loading on ClickHouse
High Performance, High Reliability Data Loading on ClickHouseHigh Performance, High Reliability Data Loading on ClickHouse
High Performance, High Reliability Data Loading on ClickHouse
Altinity Ltd
 
Rancher 2.0 Technical Deep Dive
Rancher 2.0 Technical Deep DiveRancher 2.0 Technical Deep Dive
Rancher 2.0 Technical Deep Dive
LINE Corporation
 
ClickHouse Data Warehouse 101: The First Billion Rows, by Alexander Zaitsev a...
ClickHouse Data Warehouse 101: The First Billion Rows, by Alexander Zaitsev a...ClickHouse Data Warehouse 101: The First Billion Rows, by Alexander Zaitsev a...
ClickHouse Data Warehouse 101: The First Billion Rows, by Alexander Zaitsev a...
Altinity Ltd
 
The basics of fluentd
The basics of fluentdThe basics of fluentd
The basics of fluentd
Treasure Data, Inc.
 
Data Warehouses in Kubernetes Visualized: the ClickHouse Kubernetes Operator UI
Data Warehouses in Kubernetes Visualized: the ClickHouse Kubernetes Operator UIData Warehouses in Kubernetes Visualized: the ClickHouse Kubernetes Operator UI
Data Warehouses in Kubernetes Visualized: the ClickHouse Kubernetes Operator UI
Altinity Ltd
 
Introduction to memcached
Introduction to memcachedIntroduction to memcached
Introduction to memcached
Jurriaan Persyn
 
Paris Redis Meetup Introduction
Paris Redis Meetup IntroductionParis Redis Meetup Introduction
Paris Redis Meetup Introduction
Gregory Boissinot
 

What's hot (20)

Introduction to Redis
Introduction to RedisIntroduction to Redis
Introduction to Redis
 
Introduction to Redis
Introduction to RedisIntroduction to Redis
Introduction to Redis
 
Introduction to redis
Introduction to redisIntroduction to redis
Introduction to redis
 
Salvatore Sanfilippo – How Redis Cluster works, and why - NoSQL matters Barce...
Salvatore Sanfilippo – How Redis Cluster works, and why - NoSQL matters Barce...Salvatore Sanfilippo – How Redis Cluster works, and why - NoSQL matters Barce...
Salvatore Sanfilippo – How Redis Cluster works, and why - NoSQL matters Barce...
 
An Introduction to REDIS NoSQL database
An Introduction to REDIS NoSQL databaseAn Introduction to REDIS NoSQL database
An Introduction to REDIS NoSQL database
 
An Introduction to Redis for Developers.pdf
An Introduction to Redis for Developers.pdfAn Introduction to Redis for Developers.pdf
An Introduction to Redis for Developers.pdf
 
Redis introduction
Redis introductionRedis introduction
Redis introduction
 
Best Practices for Managing MongoDB with Ops Manager
Best Practices for Managing MongoDB with Ops ManagerBest Practices for Managing MongoDB with Ops Manager
Best Practices for Managing MongoDB with Ops Manager
 
Redpanda and ClickHouse
Redpanda and ClickHouseRedpanda and ClickHouse
Redpanda and ClickHouse
 
Redis cluster
Redis clusterRedis cluster
Redis cluster
 
redis basics
redis basicsredis basics
redis basics
 
Introduction to redis - version 2
Introduction to redis - version 2Introduction to redis - version 2
Introduction to redis - version 2
 
Kicking ass with redis
Kicking ass with redisKicking ass with redis
Kicking ass with redis
 
High Performance, High Reliability Data Loading on ClickHouse
High Performance, High Reliability Data Loading on ClickHouseHigh Performance, High Reliability Data Loading on ClickHouse
High Performance, High Reliability Data Loading on ClickHouse
 
Rancher 2.0 Technical Deep Dive
Rancher 2.0 Technical Deep DiveRancher 2.0 Technical Deep Dive
Rancher 2.0 Technical Deep Dive
 
ClickHouse Data Warehouse 101: The First Billion Rows, by Alexander Zaitsev a...
ClickHouse Data Warehouse 101: The First Billion Rows, by Alexander Zaitsev a...ClickHouse Data Warehouse 101: The First Billion Rows, by Alexander Zaitsev a...
ClickHouse Data Warehouse 101: The First Billion Rows, by Alexander Zaitsev a...
 
The basics of fluentd
The basics of fluentdThe basics of fluentd
The basics of fluentd
 
Data Warehouses in Kubernetes Visualized: the ClickHouse Kubernetes Operator UI
Data Warehouses in Kubernetes Visualized: the ClickHouse Kubernetes Operator UIData Warehouses in Kubernetes Visualized: the ClickHouse Kubernetes Operator UI
Data Warehouses in Kubernetes Visualized: the ClickHouse Kubernetes Operator UI
 
Introduction to memcached
Introduction to memcachedIntroduction to memcached
Introduction to memcached
 
Paris Redis Meetup Introduction
Paris Redis Meetup IntroductionParis Redis Meetup Introduction
Paris Redis Meetup Introduction
 

Viewers also liked

Genuino and codebender
Genuino and codebenderGenuino and codebender
Genuino and codebender
Luca Mazzotti
 
AltBeacon
AltBeaconAltBeacon
AltBeacon
Sara Veterini
 
Adafruit Huzzah Esp8266 WiFi Board
Adafruit Huzzah Esp8266 WiFi BoardAdafruit Huzzah Esp8266 WiFi Board
Adafruit Huzzah Esp8266 WiFi Board
Biagio Botticelli
 
Temboo
TembooTemboo
AltBeacon
AltBeaconAltBeacon
ThingStudio Presentation
ThingStudio PresentationThingStudio Presentation
ThingStudio Presentation
Daniele Oriana
 
Intel Curie Presentation
Intel Curie PresentationIntel Curie Presentation
Intel Curie Presentation
Davide Tiriticco
 
Blynk presentation
Blynk presentationBlynk presentation
Blynk presentation
Davide Meacci
 
Elm 327 Obd
Elm 327 ObdElm 327 Obd
Elm 327 Obd
Davide Mazza
 
Presentation raspberry pi
Presentation   raspberry piPresentation   raspberry pi
Presentation raspberry pi
Marco Casini
 
BEACON AND ITS PROTOCOLS
BEACON AND ITS PROTOCOLS BEACON AND ITS PROTOCOLS
BEACON AND ITS PROTOCOLS
Andrea Bissoli
 
[Individual presentation] android fragment
[Individual presentation] android fragment[Individual presentation] android fragment
[Individual presentation] android fragment
Gabriele Vecchia
 
AWS IoT
AWS IoTAWS IoT
AWS IoT
Djordje Simic
 
Neo4j and graph databases introduction
Neo4j and graph databases introduction Neo4j and graph databases introduction
Neo4j and graph databases introduction
Stefano Conoci
 
Idea my smartrome
Idea my smartromeIdea my smartrome
Idea my smartrome
Daniele Ottaviani
 
Ecohome lab: From Monitoring to Control
Ecohome lab: From Monitoring to ControlEcohome lab: From Monitoring to Control
Ecohome lab: From Monitoring to Control
OpenEnergyMonitor
 
Presentazione resin.io
Presentazione resin.ioPresentazione resin.io
Presentazione resin.io
Gianluca Leo
 
Smart Health & Arduino
Smart Health & ArduinoSmart Health & Arduino
Smart Health & Arduino
Lorenzo Travagliati
 
InfluxDb
InfluxDbInfluxDb
InfluxDb
Guamaral Vasil
 
Arduino based health monitoring system
Arduino based health monitoring systemArduino based health monitoring system
Arduino based health monitoring system
Yousuf Shaikh
 

Viewers also liked (20)

Genuino and codebender
Genuino and codebenderGenuino and codebender
Genuino and codebender
 
AltBeacon
AltBeaconAltBeacon
AltBeacon
 
Adafruit Huzzah Esp8266 WiFi Board
Adafruit Huzzah Esp8266 WiFi BoardAdafruit Huzzah Esp8266 WiFi Board
Adafruit Huzzah Esp8266 WiFi Board
 
Temboo
TembooTemboo
Temboo
 
AltBeacon
AltBeaconAltBeacon
AltBeacon
 
ThingStudio Presentation
ThingStudio PresentationThingStudio Presentation
ThingStudio Presentation
 
Intel Curie Presentation
Intel Curie PresentationIntel Curie Presentation
Intel Curie Presentation
 
Blynk presentation
Blynk presentationBlynk presentation
Blynk presentation
 
Elm 327 Obd
Elm 327 ObdElm 327 Obd
Elm 327 Obd
 
Presentation raspberry pi
Presentation   raspberry piPresentation   raspberry pi
Presentation raspberry pi
 
BEACON AND ITS PROTOCOLS
BEACON AND ITS PROTOCOLS BEACON AND ITS PROTOCOLS
BEACON AND ITS PROTOCOLS
 
[Individual presentation] android fragment
[Individual presentation] android fragment[Individual presentation] android fragment
[Individual presentation] android fragment
 
AWS IoT
AWS IoTAWS IoT
AWS IoT
 
Neo4j and graph databases introduction
Neo4j and graph databases introduction Neo4j and graph databases introduction
Neo4j and graph databases introduction
 
Idea my smartrome
Idea my smartromeIdea my smartrome
Idea my smartrome
 
Ecohome lab: From Monitoring to Control
Ecohome lab: From Monitoring to ControlEcohome lab: From Monitoring to Control
Ecohome lab: From Monitoring to Control
 
Presentazione resin.io
Presentazione resin.ioPresentazione resin.io
Presentazione resin.io
 
Smart Health & Arduino
Smart Health & ArduinoSmart Health & Arduino
Smart Health & Arduino
 
InfluxDb
InfluxDbInfluxDb
InfluxDb
 
Arduino based health monitoring system
Arduino based health monitoring systemArduino based health monitoring system
Arduino based health monitoring system
 

Similar to Redis - Usability and Use Cases

"You shall not pass : anti-debug methodics"
"You shall not pass : anti-debug methodics""You shall not pass : anti-debug methodics"
"You shall not pass : anti-debug methodics"
ITCP Community
 
All I know about rsc.io/c2go
All I know about rsc.io/c2goAll I know about rsc.io/c2go
All I know about rsc.io/c2goMoriyoshi Koizumi
 
R-House (LSRC)
R-House (LSRC)R-House (LSRC)
R-House (LSRC)
Fernand Galiana
 
r2con 2017 r2cLEMENCy
r2con 2017 r2cLEMENCyr2con 2017 r2cLEMENCy
r2con 2017 r2cLEMENCy
Ray Song
 
From mysql to MongoDB(MongoDB2011北京交流会)
From mysql to MongoDB(MongoDB2011北京交流会)From mysql to MongoDB(MongoDB2011北京交流会)
From mysql to MongoDB(MongoDB2011北京交流会)Night Sailer
 
Sergi Álvarez & Roi Martín - Radare2 Preview [RootedCON 2010]
Sergi Álvarez & Roi Martín - Radare2 Preview [RootedCON 2010]Sergi Álvarez & Roi Martín - Radare2 Preview [RootedCON 2010]
Sergi Álvarez & Roi Martín - Radare2 Preview [RootedCON 2010]
RootedCON
 
Introduction to Redis
Introduction to RedisIntroduction to Redis
Introduction to RedisDvir Volk
 
Mongodb workshop
Mongodb workshopMongodb workshop
Mongodb workshop
Harun Yardımcı
 
REDIS intro and how to use redis
REDIS intro and how to use redisREDIS intro and how to use redis
REDIS intro and how to use redis
Kris Jeong
 
A Small Talk on Getting Big
A Small Talk on Getting BigA Small Talk on Getting Big
A Small Talk on Getting Bigbritt
 
Get expertise with mongo db
Get expertise with mongo dbGet expertise with mongo db
Get expertise with mongo db
Amit Thakkar
 
Python dictionary : past, present, future
Python dictionary: past, present, futurePython dictionary: past, present, future
Python dictionary : past, present, future
delimitry
 
Redis the better NoSQL
Redis the better NoSQLRedis the better NoSQL
Redis the better NoSQL
OpenFest team
 
Refactoring to Macros with Clojure
Refactoring to Macros with ClojureRefactoring to Macros with Clojure
Refactoring to Macros with ClojureDmitry Buzdin
 
Post Exploitation Bliss: Loading Meterpreter on a Factory iPhone, Black Hat U...
Post Exploitation Bliss: Loading Meterpreter on a Factory iPhone, Black Hat U...Post Exploitation Bliss: Loading Meterpreter on a Factory iPhone, Black Hat U...
Post Exploitation Bliss: Loading Meterpreter on a Factory iPhone, Black Hat U...
Vincenzo Iozzo
 
Python for Penetration testers
Python for Penetration testersPython for Penetration testers
Python for Penetration testers
Christian Martorella
 
Mongo db dla administratora
Mongo db dla administratoraMongo db dla administratora
Mongo db dla administratora
Łukasz Jagiełło
 
[FT-7][snowmantw] How to make a new functional language and make the world be...
[FT-7][snowmantw] How to make a new functional language and make the world be...[FT-7][snowmantw] How to make a new functional language and make the world be...
[FT-7][snowmantw] How to make a new functional language and make the world be...
Functional Thursday
 
Rootkit on linux_x86_v2.6
Rootkit on linux_x86_v2.6Rootkit on linux_x86_v2.6
Rootkit on linux_x86_v2.6
scuhurricane
 
Beware: Sharp Tools
Beware: Sharp ToolsBeware: Sharp Tools
Beware: Sharp Toolschrismdp
 

Similar to Redis - Usability and Use Cases (20)

"You shall not pass : anti-debug methodics"
"You shall not pass : anti-debug methodics""You shall not pass : anti-debug methodics"
"You shall not pass : anti-debug methodics"
 
All I know about rsc.io/c2go
All I know about rsc.io/c2goAll I know about rsc.io/c2go
All I know about rsc.io/c2go
 
R-House (LSRC)
R-House (LSRC)R-House (LSRC)
R-House (LSRC)
 
r2con 2017 r2cLEMENCy
r2con 2017 r2cLEMENCyr2con 2017 r2cLEMENCy
r2con 2017 r2cLEMENCy
 
From mysql to MongoDB(MongoDB2011北京交流会)
From mysql to MongoDB(MongoDB2011北京交流会)From mysql to MongoDB(MongoDB2011北京交流会)
From mysql to MongoDB(MongoDB2011北京交流会)
 
Sergi Álvarez & Roi Martín - Radare2 Preview [RootedCON 2010]
Sergi Álvarez & Roi Martín - Radare2 Preview [RootedCON 2010]Sergi Álvarez & Roi Martín - Radare2 Preview [RootedCON 2010]
Sergi Álvarez & Roi Martín - Radare2 Preview [RootedCON 2010]
 
Introduction to Redis
Introduction to RedisIntroduction to Redis
Introduction to Redis
 
Mongodb workshop
Mongodb workshopMongodb workshop
Mongodb workshop
 
REDIS intro and how to use redis
REDIS intro and how to use redisREDIS intro and how to use redis
REDIS intro and how to use redis
 
A Small Talk on Getting Big
A Small Talk on Getting BigA Small Talk on Getting Big
A Small Talk on Getting Big
 
Get expertise with mongo db
Get expertise with mongo dbGet expertise with mongo db
Get expertise with mongo db
 
Python dictionary : past, present, future
Python dictionary: past, present, futurePython dictionary: past, present, future
Python dictionary : past, present, future
 
Redis the better NoSQL
Redis the better NoSQLRedis the better NoSQL
Redis the better NoSQL
 
Refactoring to Macros with Clojure
Refactoring to Macros with ClojureRefactoring to Macros with Clojure
Refactoring to Macros with Clojure
 
Post Exploitation Bliss: Loading Meterpreter on a Factory iPhone, Black Hat U...
Post Exploitation Bliss: Loading Meterpreter on a Factory iPhone, Black Hat U...Post Exploitation Bliss: Loading Meterpreter on a Factory iPhone, Black Hat U...
Post Exploitation Bliss: Loading Meterpreter on a Factory iPhone, Black Hat U...
 
Python for Penetration testers
Python for Penetration testersPython for Penetration testers
Python for Penetration testers
 
Mongo db dla administratora
Mongo db dla administratoraMongo db dla administratora
Mongo db dla administratora
 
[FT-7][snowmantw] How to make a new functional language and make the world be...
[FT-7][snowmantw] How to make a new functional language and make the world be...[FT-7][snowmantw] How to make a new functional language and make the world be...
[FT-7][snowmantw] How to make a new functional language and make the world be...
 
Rootkit on linux_x86_v2.6
Rootkit on linux_x86_v2.6Rootkit on linux_x86_v2.6
Rootkit on linux_x86_v2.6
 
Beware: Sharp Tools
Beware: Sharp ToolsBeware: Sharp Tools
Beware: Sharp Tools
 

More from Fabrizio Farinacci

A taxonomy of botnet detection approaches
A taxonomy of botnet detection approachesA taxonomy of botnet detection approaches
A taxonomy of botnet detection approaches
Fabrizio Farinacci
 
Project in malware analysis:C2C
Project in malware analysis:C2CProject in malware analysis:C2C
Project in malware analysis:C2C
Fabrizio Farinacci
 
Classifying IoT malware delivery patterns for attack detection
Classifying IoT malware delivery patterns for attack detectionClassifying IoT malware delivery patterns for attack detection
Classifying IoT malware delivery patterns for attack detection
Fabrizio Farinacci
 
A Taxonomy of Botnet Detection Approaches
A Taxonomy of Botnet Detection ApproachesA Taxonomy of Botnet Detection Approaches
A Taxonomy of Botnet Detection Approaches
Fabrizio Farinacci
 
The Same-Origin Policy
The Same-Origin PolicyThe Same-Origin Policy
The Same-Origin Policy
Fabrizio Farinacci
 
Deanonymize Tor Hidden Services
Deanonymize Tor Hidden ServicesDeanonymize Tor Hidden Services
Deanonymize Tor Hidden Services
Fabrizio Farinacci
 
RecipeX - Your personal caregiver and lifestyle makeover
RecipeX - Your personal caregiver and lifestyle makeoverRecipeX - Your personal caregiver and lifestyle makeover
RecipeX - Your personal caregiver and lifestyle makeover
Fabrizio Farinacci
 
RecipeX - Your personal caregiver and lifestyle makeover
RecipeX - Your personal caregiver and lifestyle makeoverRecipeX - Your personal caregiver and lifestyle makeover
RecipeX - Your personal caregiver and lifestyle makeover
Fabrizio Farinacci
 

More from Fabrizio Farinacci (8)

A taxonomy of botnet detection approaches
A taxonomy of botnet detection approachesA taxonomy of botnet detection approaches
A taxonomy of botnet detection approaches
 
Project in malware analysis:C2C
Project in malware analysis:C2CProject in malware analysis:C2C
Project in malware analysis:C2C
 
Classifying IoT malware delivery patterns for attack detection
Classifying IoT malware delivery patterns for attack detectionClassifying IoT malware delivery patterns for attack detection
Classifying IoT malware delivery patterns for attack detection
 
A Taxonomy of Botnet Detection Approaches
A Taxonomy of Botnet Detection ApproachesA Taxonomy of Botnet Detection Approaches
A Taxonomy of Botnet Detection Approaches
 
The Same-Origin Policy
The Same-Origin PolicyThe Same-Origin Policy
The Same-Origin Policy
 
Deanonymize Tor Hidden Services
Deanonymize Tor Hidden ServicesDeanonymize Tor Hidden Services
Deanonymize Tor Hidden Services
 
RecipeX - Your personal caregiver and lifestyle makeover
RecipeX - Your personal caregiver and lifestyle makeoverRecipeX - Your personal caregiver and lifestyle makeover
RecipeX - Your personal caregiver and lifestyle makeover
 
RecipeX - Your personal caregiver and lifestyle makeover
RecipeX - Your personal caregiver and lifestyle makeoverRecipeX - Your personal caregiver and lifestyle makeover
RecipeX - Your personal caregiver and lifestyle makeover
 

Recently uploaded

Cyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdfCyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdf
Cyanic lab
 
How Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxHow Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptx
wottaspaceseo
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
Globus
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
Juraj Vysvader
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
Ortus Solutions, Corp
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
Neo4j
 
Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
abdulrafaychaudhry
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
NYGGS Automation Suite
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
Matt Welsh
 
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Globus
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
Globus
 
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke
 
Launch Your Streaming Platforms in Minutes
Launch Your Streaming Platforms in MinutesLaunch Your Streaming Platforms in Minutes
Launch Your Streaming Platforms in Minutes
Roshan Dwivedi
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
Paco van Beckhoven
 
Top 7 Unique WhatsApp API Benefits | Saudi Arabia
Top 7 Unique WhatsApp API Benefits | Saudi ArabiaTop 7 Unique WhatsApp API Benefits | Saudi Arabia
Top 7 Unique WhatsApp API Benefits | Saudi Arabia
Yara Milbes
 
Graphic Design Crash Course for beginners
Graphic Design Crash Course for beginnersGraphic Design Crash Course for beginners
Graphic Design Crash Course for beginners
e20449
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
Philip Schwarz
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Globus
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
rickgrimesss22
 

Recently uploaded (20)

Cyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdfCyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdf
 
How Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxHow Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptx
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
 
Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
 
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
 
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
 
Launch Your Streaming Platforms in Minutes
Launch Your Streaming Platforms in MinutesLaunch Your Streaming Platforms in Minutes
Launch Your Streaming Platforms in Minutes
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
 
Top 7 Unique WhatsApp API Benefits | Saudi Arabia
Top 7 Unique WhatsApp API Benefits | Saudi ArabiaTop 7 Unique WhatsApp API Benefits | Saudi Arabia
Top 7 Unique WhatsApp API Benefits | Saudi Arabia
 
Graphic Design Crash Course for beginners
Graphic Design Crash Course for beginnersGraphic Design Crash Course for beginners
Graphic Design Crash Course for beginners
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
 

Redis - Usability and Use Cases

  • 2. !!!!i! i iiiiii i iii iii i i i i sssss 1
  • 3. 1. What is Redis? REmote DIctionary Server 2
  • 4. “ is an in-memory data structure store, that can be served as a database, cache or message broker (Pub/Sub). 3
  • 6. … a ‘‘data structure server’’? Redis is essentially a key-value database… but it’s NOT a plain key-value database: it’s not limited to string values, but can also hold complex data structures. 5
  • 8. Strings Command line: > set mystr foo OK > set myint 1 OK > get mystr "foo" > append mystr foo (integer) 6 > incr myint (integer) 2 > mget mystr myint 1) "foofoo" 2) "2" Are key-value pairs, to store strings or integers, with: □Common operations on strings (APPEND, STRLEN, exc.); □Atomic increment/decrement (INCR/DECR) on integers; □Get multiple values at once (MGET). Python: >>> import redis >>> r = redis.StrictRedis( host='localhost', port=6379, db=0 ) >>> r.set('mystr', 'foo') True >>> r.set('myint', 1) True >>> r.get('mystr') 'foo' >>> r.append('mystr', 'foo') 6L >>> r.incr('myint') 2 >>> r.mget('mystr', 'myint') ['foofoo', '2'] 7
  • 9. Lists Are linked-lists of strings: □Index-based access to the entries; □Insertion and deletion at head/tail, in constant-time (push/pop); □Trim/Range operations available. 8
  • 10. Interacting with Lists Command line: > rpush mylist A (integer) 1 > rpush mylist B (integer) 2 > lpush mylist first (integer) 3 > lrange mylist 0 ‐1 1) "first" 2) "A" 3) "B" > lrange mylist 1 3 1) "A" 2) "B" Python: >>> import redis >>> r = redis.StrictRedis( host='localhost', port=6379, db=0 ) >>> r.rpush('mylist', 'A') 1L >>> r.rpush('mylist', 'B') 2L >>> r.lpush('mylist', 'first') 3L >>> r.lrange('mylist', 0, ‐1) ['first', 'A', 'B'] >>> r.lrange('mylist', 1, 3) ['A', 'B'] 9
  • 11. Sets Are sets of strings: □Unordered collection of non- repeating elements; □Intersection/Union/Difference between multiple sets; □Membership test available. 10
  • 12. Interacting with Sets Command line: > sadd myset A (integer) 1 > sadd myset B (integer) 1 > sadd myset2 C (integer) 1 > sismember myset C (integer) 0 > smembers myset 1) "A" 2) "B" > sunion myset myset2 1) "A" 2) "B" 3) "C" Python: >>> import redis >>> r = redis.StrictRedis( host='localhost', port=6379, db=0 ) >>> r.sadd('myset', 'A') 1 >>> r.sadd('myset', 'B') 1 >>> r.sadd('myset2', 'C') 1 >>> r.sismember('myset', 'C') False >>> r.smembers('myset') set(['A', 'B'])  >>> r.sunion('myset', 'myset2') set(['A', 'C', 'B']) 11
  • 13. Sorted Set (ZSET) 12 Are sorted sets of strings: □Collection of non-repeating elements sorted by floating-point numbers (the score) and lexicographically; □Range operations on score/lexicon; □Intersection/Union between sets.
  • 14. Interacting with ZSETs Command line: > zadd myzset 2 C (integer) 1 > zadd myzset 3 D (integer) 1 > zadd myzset 1 A (integer) 1 > zadd myzset 2 B (integer) 1 > zrange myzset 0 ‐1 1) "A" 2) "B" 3) "C" 4) "D" > zrangebyscore myzset 1 2 1) "A" 2) "B" 3) "C" > zrangebylex myzset (A [D  1) "B" 2) "C" 3) "D" Python: >>> import redis >>> r = redis.StrictRedis( host='localhost', port=6379, db=0 ) >>> r.zadd('myzset', 2, 'C') 1 >>> r.zadd('myzset', 3, 'D')  1 >>> r.zadd('myzset', A=1)  1 >>> r.zadd('myzset', B=2)  1 >>> r.zrange('myzset', 0, ‐1)  ['A', 'B', 'C', 'D'] >>> r.zrangebyscore('myzset', 1, 2)  ['A', 'B', 'C']  >>> r.zrangebylex('myzset', '(A', '[D')  ['B', 'C', 'D'] 13
  • 15. Hash A map of field-value pairs: □Key-based access, specifying selected field or fields; □To implement objects, specifying the name of the field and its value. 14
  • 16. Interacting with Hashes Command line: > hset myhash key1 A (integer) 1 > hmset myhash key2 B key3 C OK > hget myhash key2 "B" > hmget myhash key1 key3 1) "A" 2) "C" > hgetall myhash 1) "key1" 2) "A" 3) "key2" 4) "B" 5) "key3" 6) "C" Python: >>> import redis >>> r = redis.StrictRedis( host='localhost', port=6379, db=0 ) >>> r.hset('myhash', 'key1', 'A')  1L >>> r.hmset('myhash', {'key2':'B', 'key3':'C'} )  True >>> r.hget('myhash', 'key2') 'B' >>> r.hmget('myhash', 'key1', 'key3')  ['A', 'C'] >>> r.hgetall('myhash') {'key3': 'C', 'key2': 'B', 'key1': 'A'} 15
  • 17. Additional Data Structures Bitmap: A set of bit-oriented operations (e.g. GETBIT/SETBIT) to manipulate string values as blobs of size up to 512 MB. HyperLogLog: A probabilistic data structure structure to estimate size of sets (i.e. counting unique elements) efficiently and in constant-space. Geo: Geospatial items, stored as geospatial indexes (in sorted indexes). Support for distance based operations (eg. GEODIST) and radius queries (GEORADIUS). Available only in the BETA testing version (3.2.0). 16
  • 19. Redis Pub/Sub 18 To implement the Publish/Subscribe paradigm: □Published messages (PUBLISH) are categorized into channels and pushed to all the subscribers (SUBSCRIBE). □Publisher and subscriber are completely decoupled: advantages are high scalability and dynamic network features.
  • 20. Place your screenshot here □ Redis Pub/Sub channels are exploited as thematic channels (EG. Sport, Tv Shows, exc.). □ Users subscribe to the channels they’re interested in. □ Once the web-chat session is started the user can: ■ Receive messages published on the channels of interest; ■ Publish messages onto selected channels. Redis SubsChat: A multi-thematic web-chat 19
  • 21. How it has been done? import redis # At the beginning, to setup the Redis interface object r = redis.StrictRedis(host='localhost', port=6379, db=0) ... # When start is pressed, the session starts def on_start(): pubsub = r.pubsub()  # Disable Widgets and manage subscriptions ... ui.checkBox.setEnabled(False) if ui.checkBox.isChecked(): # Setup the the handler for the subscriber tasks pubsub.subscribe(**{str(ui.checkBox.text()):  mess_handler}) ...  # This is done for all the checklists ... # Run the receiver tasks into a parallel thread ...  thread = pubsub.run_in_thread(sleep_time=0.001) ... 20
  • 22. How it has been done? (2) ... # Handler that pushes the received message onto the web‐chat def mess_handler(message): QtCore.QMetaObject.invokeMethod(ui.textEdit,  "append",QtCore.Q_ARG(str, str(message['data'])+'n'))  ...  # To send a message when send is pressed def on_send():  # Get the info about the message from the UI msg = str(ui.textEdit_2.toPlainText())  if len(msg) > 0: usrname = str(ui.lineEdit.text()) if len(usrname) == 0: usrname = '<Anonymous>'  channel = str(ui.comboBox.currentText()) ui.textEdit_2.clear()  message = ‘%s [%s]: %s' % (usrname, channel, msg)  # Publish the message onto the specified channel r.publish(channel, message) ... 21
  • 23. How it has been done? (3) ... def on_stop():  # Re‐enable the disabled widgets ... ui.checkBox_2.setEnabled(True) ...  # This is done for all the checklists ... pubsub.close()  ...  if __name__ == "__main__":  # To setup the UI and make the application run import sys app = QtGui.QApplication(sys.argv)  MainWindow = QtGui.QMainWindow()  ui = Ui_MainWindow() ui.setupUi(MainWindow)  MainWindow.show()  sys.exit(app.exec_()) 22
  • 24. Live Demo Let’s see how it works!! 23
  • 25. 4. Use cases When should we use it? 24
  • 26. Performances and usability Redis is an in-memory database, persistent on disk. PROs: □Faster reads and writes: all happens in memory. A transaction is considered committed without the need of writing on the disk. □Simple complex data structure manipulation: all is in memory; lower complexity. □Efficient persistency management: snapshotting or journal mode. CONs: □Suitable for small datasets, of size up to memory capacity. □Not suitable for application where durability is a crucial aspect. 25
  • 27. When it should be used? We Should use it if: □Small datasets that fits in memory: very high performance, similar to a cache. □Assumptions on data structures and queries: to take advantage of the supported data types. □Realize a cache layer: for example, to speedup a conventional RDBMS. We Shouldn’t use it if: □Frequent schema changes: a traditional key-value approach, with the schema managed by the application, would be preferred. □Prototyping: don’t want to waste loads of time in the design of the database and have the application soon ready. □Durability critical applications: like seat booking mechanism. 26
  • 29. thanks! Any questions? You can find me at: https://it.linkedin.com/in/fabrizio-farinacci-496679116 https://github.com/FabFari/redis-subschat ? 28