SlideShare a Scribd company logo
Matteo Baglini                            www.dotnettoscana.org
Software Developer, Freelance
matteo.baglini@gmail.com
http://it.linkedin.com/in/matteobaglini
http://github.cpom/bmatte
«Advanced key-value store.
 It is often referred to as a
    data structure server»


                            2
Key              Value

page:index                <html><head>[...]


user:123:session          xDrSdEwd4dSlZkEkj+


user:123:avatar           77u/PD94bWwgdm+




           Everything is a «blob»
Commands, primarily, can GET and SET the values
                                               3
Key                             Value                      Type
page:index         <html><head>[...]                       String

events:timeline    { «Joe logged», «File X Uploaded», …}   List

logged:today       { 1, 2, 3, 4, 5 }                       Set

                   time => 10927353
user:123:profile                                           Hash
                   username => bmatte
                   joe ~ 1.3483
game:leaderboard   smith ~ 293.45                          Sorted Set
                   fred ~ 83.22



              Different «data type/structure»
             Rich set of specialized commands                            4
   Everything is stored in memory
   Screamingly fast performance
   Persistent via snapshot or append-only log file
   Replication (only Master/Slave)
   Extensible via embedded scripting engine (Lua)
   Rich set of client libraries
   High availability (In progress)
    ◦ Cluster (Fault tolerance, Multi-Node consistence)
    ◦ Sentinel (Monitoring, Notification, Automatic failover)



                                                                5
   Created by Salvatore
    Sanfilippo (@antirez)
   First «public release»
    in March 2009.
   Since 2010 sponsored
    by VMware.



Initially written to improve performance of Web
  Analytics product LLOOGG out of his startup
                                                  6
   Written in ANSI C
   No external dependencies
   Single thread (asynchronous evented I/O)
   Works on all POSIX-like system
   Exist unofficial build for Windows
   Open-source BSD licensed
   Community (list, IRC & wiki)



                                               7
1.   A DSL for Abstract Data Types.
2.   Memory storage is #1.
3.   Fundamental data structures for a
     fundamental API.
4.   Code is like a poem.
5.   We're against complexity.
6.   Two levels of API.
7.   We optimize for joy.

                                         8
Getting
Started
          9
Latest stable version (2.6.*)




                                10
Latest unstable version (2.9.7)




                                  11
12
13
14
15
Data Types

             16
Strings

          17
Any blob will do
(A value can be at max 512MB)




                                18
Operations on strings holding an
             integer




                                   19
20
   Sharing state across processes
    ◦ Distribute lock, Incremental ID, Time series,
      User session.
   Web Analytics
    ◦ User visit (day, week, month), Feature Tracking.
   Caching
    ◦ String values can hold arbitrary data.
   Rate limiting
    ◦ Limit number of API calls/minute.
                                                      21
Keys

       22
Any item in can be made to expire
    after or at a certain time.




                                    23
24
Lists

        25
Sequence of string values




                            26
Sequence of string values
  (Max length is 232 - 1 elements)




                                     27
Prevent indefinite growth




                            28
29
   Events Store or Notification
    ◦ Logs, Social Network Timelines, Notifications.
   Fixed Data
    ◦ Last N activity.
   Message Passing
    ◦ Durable MQ, Job Queue.
   Circular list


                                                       30
Sets

       31
Unordered set of unique values




                                 32
Unordered set of unique values
   (Max number of members is 232 – 1)




                                        33
You can do unions, intersections,
differences of sets in very short time.




                                      34
35
   Web Analytics
    ◦ Unique Page View, IP addresses visiting.
   Relations
    ◦ Friends, Followers, Tags.
   Caching Result
    ◦ Store result of expensive intersection of data.




                                                        36
Sorted Set

             37
Ordered set of unique values




                               38
Access by rank




                 39
Access by score




                  40
41
   Web Analytics
    ◦ Online users, Most visited pages.
   Leaderbord
    ◦ Show top N.
   Order by data
    ◦ Maintain a set of ordered data like user by age.




                                                     42
Hashes

         43
Key → Value map (as value)




                             44
Set attributes
(Store up to 232 - 1 field-value pairs)




                                          45
Get attributes




                 46
47
   Storing Objects
    ◦ Hashes are maps between string fields and
      string values, so they are the perfect data type
      to represent objects.




                                                         48
Persistence

              49
Dump data to disk after certain
    conditions are met




                                  50
   Pro:
    ◦   RDB   is a very compact single-file.
    ◦   RDB   files are perfect for backups.
    ◦   RDB   is very good for disaster recovery.
    ◦   RDB   allows faster restarts with big datasets.
    ◦   RDB   maximizes performances (backgr. I/O via fork(2)).
   Contro:
    ◦ RDB is NOT good if you need to minimize the chance of
      data loss in case Redis stops working (for example after
      a power outage).
    ◦ Fork can be time consuming if the dataset is very big.

                                                              51
Append all write operations to a log




                                       52
Durability depends on fsync(2) policy




                                        53
   Pro:
    ◦ AOF is much more durable.
    ◦ AOF is an append only log, no seeks, nor corruption
      problems (for example after a power outage).
    ◦ AOF contains a log of all the operations one after the
      other in an easy to understand and parse format.
   Contro:
    ◦ AOF files are usually bigger than the equivalent RDB.
    ◦ AOF can be slower then RDB depending on the exact
      fsync policy.



                                                               54
   Use both persistence methods if you want a degree of
    data safety comparable to what any RDBMS can provide
    you.

   If you care a lot about your data, but still can live with a
    few minutes of data lose in case of disasters, you can
    simply use RDB alone.

   There are many users using AOF alone, but we
    discourage it since to have an RDB snapshot from time to
    time is a great idea for doing database backups, for
    faster restarts.

                                                                   55
C#
Clients
          56
Rich set of clients




                      57
58
59
Code

       60
Transactions

               61
Multiple commands (ACID)




                           62
63
   Classic scenario
    ◦ Multi atomic commands.
   Optimistic locking
    ◦ Check and Set (CAS Pattern) write only if not
      changed.




                                                      64
Publish
Subscribe
            65
Provide 1-N messaging




                        66
Subscribe multi channels decoupled
        from the key space




                                     67
Publish on some channel




                          68
Subscriber getting notified




                              69
70
   Message Passing
    ◦ Distribute message-oriented system, Event-
      Driven Architecture, Service Bus.




                                                   71
Code

       72
Replication

              73
One master replicate to multiple slaves




                                      74
Slave send SYNC command and master
 transfers the database file to the slave




                                       75
Slaves can perform only read operation




                                     76
   Scalability
    ◦ Multiple slaves for read-only queries.
   Redundancy
    ◦ Data replication.
   Slave of Slave
    ◦ Graph-like structure for more scalability e
      redundancy.



                                                    77
Performance

              78
Screamingly fast performance

 ~50K read/write operations per
  seconds.
 ~100K read/write ops per second on a
  regular EC2 instance.



                                         79
redis-benchmark tool on a Ubuntu
     virtual machine ~36K rps




                                   80
Application
Architecture
               81
Application Server




 SQL                Redis
Server
                            82
83
Finally

          84
«I see Redis definitely more as a flexible tool than
     as a solution specialized to solve a specific
    problem: his mixed soul of cache, store, and
       messaging server shows this very well»

                               Salvatore Sanfilippo



                                                 85
   http://redis.io/
   http://github.com/antirez/redis
   http://groups.google.com/group/redis-db




                                              86
Key-value databases in practice Redis @ DotNetToscana

More Related Content

What's hot

MySQL for Large Scale Social Games
MySQL for Large Scale Social GamesMySQL for Large Scale Social Games
MySQL for Large Scale Social Games
Yoshinori Matsunobu
 
SUSE Expert Days Paris 2018 - SUSE HA Cluster Multi-Device
SUSE Expert Days Paris 2018 - SUSE HA Cluster Multi-DeviceSUSE Expert Days Paris 2018 - SUSE HA Cluster Multi-Device
SUSE Expert Days Paris 2018 - SUSE HA Cluster Multi-Device
SUSE
 
MySQL with DRBD/Pacemaker/Corosync on Linux
 MySQL with DRBD/Pacemaker/Corosync on Linux MySQL with DRBD/Pacemaker/Corosync on Linux
MySQL with DRBD/Pacemaker/Corosync on Linux
Pawan Kumar
 
IAP09 CUDA@MIT 6.963 - Lecture 01: GPU Computing using CUDA (David Luebke, NV...
IAP09 CUDA@MIT 6.963 - Lecture 01: GPU Computing using CUDA (David Luebke, NV...IAP09 CUDA@MIT 6.963 - Lecture 01: GPU Computing using CUDA (David Luebke, NV...
IAP09 CUDA@MIT 6.963 - Lecture 01: GPU Computing using CUDA (David Luebke, NV...
npinto
 
brief introduction of drbd in SLE12SP2
brief introduction of drbd in SLE12SP2brief introduction of drbd in SLE12SP2
brief introduction of drbd in SLE12SP2
Nick Wang
 
Frokost seminar windows server 2012
Frokost seminar   windows server 2012Frokost seminar   windows server 2012
Frokost seminar windows server 2012
Olav Tvedt
 
High Availability Storage (susecon2016)
High Availability Storage (susecon2016)High Availability Storage (susecon2016)
High Availability Storage (susecon2016)
Roger Zhou 周志强
 
Introduction to PostgreSQL for System Administrators
Introduction to PostgreSQL for System AdministratorsIntroduction to PostgreSQL for System Administrators
Introduction to PostgreSQL for System AdministratorsJignesh Shah
 
Mongo db roma replication and sharding
Mongo db roma replication and shardingMongo db roma replication and sharding
Mongo db roma replication and sharding
Guglielmo Incisa Di Camerana
 
CloudStackユーザ会〜仮想ルータの謎に迫る
CloudStackユーザ会〜仮想ルータの謎に迫るCloudStackユーザ会〜仮想ルータの謎に迫る
CloudStackユーザ会〜仮想ルータの謎に迫る
samemoon
 
Containers and Namespaces in the Linux Kernel
Containers and Namespaces in the Linux KernelContainers and Namespaces in the Linux Kernel
Containers and Namespaces in the Linux Kernel
OpenVZ
 
High Availability != High-cost
High Availability != High-costHigh Availability != High-cost
High Availability != High-costnormanmaurer
 
Building High Availability Clusters with SUSE Linux Enterprise High Availabil...
Building High Availability Clusters with SUSE Linux Enterprise High Availabil...Building High Availability Clusters with SUSE Linux Enterprise High Availabil...
Building High Availability Clusters with SUSE Linux Enterprise High Availabil...
Novell
 
Unique ID generation in distributed systems
Unique ID generation in distributed systemsUnique ID generation in distributed systems
Unique ID generation in distributed systems
Dave Gardner
 
Windows server 2012 failover clustering new features
Windows server 2012 failover clustering new featuresWindows server 2012 failover clustering new features
Windows server 2012 failover clustering new featuresJoseph D'Antoni
 
Linux-HA with Pacemaker
Linux-HA with PacemakerLinux-HA with Pacemaker
Linux-HA with Pacemaker
Kris Buytaert
 
Anatomy of a Container: Namespaces, cgroups & Some Filesystem Magic - LinuxCon
Anatomy of a Container: Namespaces, cgroups & Some Filesystem Magic - LinuxConAnatomy of a Container: Namespaces, cgroups & Some Filesystem Magic - LinuxCon
Anatomy of a Container: Namespaces, cgroups & Some Filesystem Magic - LinuxCon
Jérôme Petazzoni
 
Cassandra勉強会
Cassandra勉強会Cassandra勉強会
Cassandra勉強会
Shun Nakamura
 
Introduction to linux containers
Introduction to linux containersIntroduction to linux containers
Introduction to linux containers
Google
 
NewSQL
NewSQLNewSQL

What's hot (20)

MySQL for Large Scale Social Games
MySQL for Large Scale Social GamesMySQL for Large Scale Social Games
MySQL for Large Scale Social Games
 
SUSE Expert Days Paris 2018 - SUSE HA Cluster Multi-Device
SUSE Expert Days Paris 2018 - SUSE HA Cluster Multi-DeviceSUSE Expert Days Paris 2018 - SUSE HA Cluster Multi-Device
SUSE Expert Days Paris 2018 - SUSE HA Cluster Multi-Device
 
MySQL with DRBD/Pacemaker/Corosync on Linux
 MySQL with DRBD/Pacemaker/Corosync on Linux MySQL with DRBD/Pacemaker/Corosync on Linux
MySQL with DRBD/Pacemaker/Corosync on Linux
 
IAP09 CUDA@MIT 6.963 - Lecture 01: GPU Computing using CUDA (David Luebke, NV...
IAP09 CUDA@MIT 6.963 - Lecture 01: GPU Computing using CUDA (David Luebke, NV...IAP09 CUDA@MIT 6.963 - Lecture 01: GPU Computing using CUDA (David Luebke, NV...
IAP09 CUDA@MIT 6.963 - Lecture 01: GPU Computing using CUDA (David Luebke, NV...
 
brief introduction of drbd in SLE12SP2
brief introduction of drbd in SLE12SP2brief introduction of drbd in SLE12SP2
brief introduction of drbd in SLE12SP2
 
Frokost seminar windows server 2012
Frokost seminar   windows server 2012Frokost seminar   windows server 2012
Frokost seminar windows server 2012
 
High Availability Storage (susecon2016)
High Availability Storage (susecon2016)High Availability Storage (susecon2016)
High Availability Storage (susecon2016)
 
Introduction to PostgreSQL for System Administrators
Introduction to PostgreSQL for System AdministratorsIntroduction to PostgreSQL for System Administrators
Introduction to PostgreSQL for System Administrators
 
Mongo db roma replication and sharding
Mongo db roma replication and shardingMongo db roma replication and sharding
Mongo db roma replication and sharding
 
CloudStackユーザ会〜仮想ルータの謎に迫る
CloudStackユーザ会〜仮想ルータの謎に迫るCloudStackユーザ会〜仮想ルータの謎に迫る
CloudStackユーザ会〜仮想ルータの謎に迫る
 
Containers and Namespaces in the Linux Kernel
Containers and Namespaces in the Linux KernelContainers and Namespaces in the Linux Kernel
Containers and Namespaces in the Linux Kernel
 
High Availability != High-cost
High Availability != High-costHigh Availability != High-cost
High Availability != High-cost
 
Building High Availability Clusters with SUSE Linux Enterprise High Availabil...
Building High Availability Clusters with SUSE Linux Enterprise High Availabil...Building High Availability Clusters with SUSE Linux Enterprise High Availabil...
Building High Availability Clusters with SUSE Linux Enterprise High Availabil...
 
Unique ID generation in distributed systems
Unique ID generation in distributed systemsUnique ID generation in distributed systems
Unique ID generation in distributed systems
 
Windows server 2012 failover clustering new features
Windows server 2012 failover clustering new featuresWindows server 2012 failover clustering new features
Windows server 2012 failover clustering new features
 
Linux-HA with Pacemaker
Linux-HA with PacemakerLinux-HA with Pacemaker
Linux-HA with Pacemaker
 
Anatomy of a Container: Namespaces, cgroups & Some Filesystem Magic - LinuxCon
Anatomy of a Container: Namespaces, cgroups & Some Filesystem Magic - LinuxConAnatomy of a Container: Namespaces, cgroups & Some Filesystem Magic - LinuxCon
Anatomy of a Container: Namespaces, cgroups & Some Filesystem Magic - LinuxCon
 
Cassandra勉強会
Cassandra勉強会Cassandra勉強会
Cassandra勉強会
 
Introduction to linux containers
Introduction to linux containersIntroduction to linux containers
Introduction to linux containers
 
NewSQL
NewSQLNewSQL
NewSQL
 

Viewers also liked

Redis in Practice: Scenarios, Performance and Practice with PHP
Redis in Practice: Scenarios, Performance and Practice with PHPRedis in Practice: Scenarios, Performance and Practice with PHP
Redis in Practice: Scenarios, Performance and Practice with PHP
Chen Huang
 
MOSC2012 - Building High-Performance Web-Application with PHP & MongoDB
MOSC2012 - Building High-Performance Web-Application with PHP & MongoDBMOSC2012 - Building High-Performance Web-Application with PHP & MongoDB
MOSC2012 - Building High-Performance Web-Application with PHP & MongoDBr1dotmy
 
The holy bible in hungarian
The holy bible in hungarianThe holy bible in hungarian
The holy bible in hungarianWorldBibles
 
Digital Communication
Digital CommunicationDigital Communication
Digital Communication
sitcom987
 
I am my_own_wife_2
I am my_own_wife_2I am my_own_wife_2
I am my_own_wife_2
sitcom987
 
Hungarian Language
Hungarian LanguageHungarian Language
Hungarian Language
sitcom987
 
Gossip & Key Value Store
Gossip & Key Value StoreGossip & Key Value Store
Gossip & Key Value Store
Sajeev P
 
Estudo comparativo entr bancos RDBMS, NoSQL e NewSQL
Estudo comparativo entr bancos RDBMS, NoSQL e NewSQLEstudo comparativo entr bancos RDBMS, NoSQL e NewSQL
Estudo comparativo entr bancos RDBMS, NoSQL e NewSQL
Orlando Vitali
 
Tech Talk Buscapé - Clean Code
Tech Talk Buscapé - Clean CodeTech Talk Buscapé - Clean Code
Tech Talk Buscapé - Clean Code
Marcelo Tozzi de Lima
 
Redis: servidor de estructuras de datos
Redis: servidor de estructuras de datosRedis: servidor de estructuras de datos
Redis: servidor de estructuras de datos
Antonio Ognio
 
Redis persistence in practice
Redis persistence in practiceRedis persistence in practice
Redis persistence in practice
Eugene Fidelin
 
Sistemas NoSQL, surgimento, características e exemplos
Sistemas NoSQL, surgimento, características e exemplosSistemas NoSQL, surgimento, características e exemplos
Sistemas NoSQL, surgimento, características e exemplos
Aricelio Souza
 
Redis to the Rescue?
Redis to the Rescue?Redis to the Rescue?
Redis to the Rescue?
Wooga
 
NoSQL: Introducción a las Bases de Datos no estructuradas
NoSQL: Introducción a las Bases de Datos no estructuradasNoSQL: Introducción a las Bases de Datos no estructuradas
NoSQL: Introducción a las Bases de Datos no estructuradas
Diego López-de-Ipiña González-de-Artaza
 
Redis for the Everyday Developer
Redis for the Everyday DeveloperRedis for the Everyday Developer
Redis for the Everyday Developer
Ross Tuck
 
Banco de Dados Não Relacionais vs Banco de Dados Relacionais
Banco de Dados Não Relacionais vs Banco de Dados RelacionaisBanco de Dados Não Relacionais vs Banco de Dados Relacionais
Banco de Dados Não Relacionais vs Banco de Dados Relacionais
alexculpado
 
Redis in Practice
Redis in PracticeRedis in Practice
Redis in Practice
Noah Davis
 
Everything you always wanted to know about Redis but were afraid to ask
Everything you always wanted to know about Redis but were afraid to askEverything you always wanted to know about Redis but were afraid to ask
Everything you always wanted to know about Redis but were afraid to ask
Carlos Abalde
 
Introducao aos Bancos de Dados Não-relacionais
Introducao aos Bancos de Dados Não-relacionaisIntroducao aos Bancos de Dados Não-relacionais
Introducao aos Bancos de Dados Não-relacionais
Mauricio De Diana
 

Viewers also liked (20)

Redis in Practice: Scenarios, Performance and Practice with PHP
Redis in Practice: Scenarios, Performance and Practice with PHPRedis in Practice: Scenarios, Performance and Practice with PHP
Redis in Practice: Scenarios, Performance and Practice with PHP
 
MOSC2012 - Building High-Performance Web-Application with PHP & MongoDB
MOSC2012 - Building High-Performance Web-Application with PHP & MongoDBMOSC2012 - Building High-Performance Web-Application with PHP & MongoDB
MOSC2012 - Building High-Performance Web-Application with PHP & MongoDB
 
The holy bible in hungarian
The holy bible in hungarianThe holy bible in hungarian
The holy bible in hungarian
 
Digital Communication
Digital CommunicationDigital Communication
Digital Communication
 
I am my_own_wife_2
I am my_own_wife_2I am my_own_wife_2
I am my_own_wife_2
 
Hungarian Language
Hungarian LanguageHungarian Language
Hungarian Language
 
Tech Talk Buscapé - Redis
Tech Talk Buscapé - RedisTech Talk Buscapé - Redis
Tech Talk Buscapé - Redis
 
Gossip & Key Value Store
Gossip & Key Value StoreGossip & Key Value Store
Gossip & Key Value Store
 
Estudo comparativo entr bancos RDBMS, NoSQL e NewSQL
Estudo comparativo entr bancos RDBMS, NoSQL e NewSQLEstudo comparativo entr bancos RDBMS, NoSQL e NewSQL
Estudo comparativo entr bancos RDBMS, NoSQL e NewSQL
 
Tech Talk Buscapé - Clean Code
Tech Talk Buscapé - Clean CodeTech Talk Buscapé - Clean Code
Tech Talk Buscapé - Clean Code
 
Redis: servidor de estructuras de datos
Redis: servidor de estructuras de datosRedis: servidor de estructuras de datos
Redis: servidor de estructuras de datos
 
Redis persistence in practice
Redis persistence in practiceRedis persistence in practice
Redis persistence in practice
 
Sistemas NoSQL, surgimento, características e exemplos
Sistemas NoSQL, surgimento, características e exemplosSistemas NoSQL, surgimento, características e exemplos
Sistemas NoSQL, surgimento, características e exemplos
 
Redis to the Rescue?
Redis to the Rescue?Redis to the Rescue?
Redis to the Rescue?
 
NoSQL: Introducción a las Bases de Datos no estructuradas
NoSQL: Introducción a las Bases de Datos no estructuradasNoSQL: Introducción a las Bases de Datos no estructuradas
NoSQL: Introducción a las Bases de Datos no estructuradas
 
Redis for the Everyday Developer
Redis for the Everyday DeveloperRedis for the Everyday Developer
Redis for the Everyday Developer
 
Banco de Dados Não Relacionais vs Banco de Dados Relacionais
Banco de Dados Não Relacionais vs Banco de Dados RelacionaisBanco de Dados Não Relacionais vs Banco de Dados Relacionais
Banco de Dados Não Relacionais vs Banco de Dados Relacionais
 
Redis in Practice
Redis in PracticeRedis in Practice
Redis in Practice
 
Everything you always wanted to know about Redis but were afraid to ask
Everything you always wanted to know about Redis but were afraid to askEverything you always wanted to know about Redis but were afraid to ask
Everything you always wanted to know about Redis but were afraid to ask
 
Introducao aos Bancos de Dados Não-relacionais
Introducao aos Bancos de Dados Não-relacionaisIntroducao aos Bancos de Dados Não-relacionais
Introducao aos Bancos de Dados Não-relacionais
 

Similar to Key-value databases in practice Redis @ DotNetToscana

In-memory Databases
In-memory DatabasesIn-memory Databases
In-memory Databases
Robert Friberg
 
INFINISTORE(tm) - Scalable Open Source Storage Arhcitecture
INFINISTORE(tm) - Scalable Open Source Storage ArhcitectureINFINISTORE(tm) - Scalable Open Source Storage Arhcitecture
INFINISTORE(tm) - Scalable Open Source Storage ArhcitectureThomas Uhl
 
2012-03-15 What's New at Red Hat
2012-03-15 What's New at Red Hat2012-03-15 What's New at Red Hat
2012-03-15 What's New at Red Hat
Shawn Wells
 
MySQL Cluster Scaling to a Billion Queries
MySQL Cluster Scaling to a Billion QueriesMySQL Cluster Scaling to a Billion Queries
MySQL Cluster Scaling to a Billion Queries
Bernd Ocklin
 
XenSummit - 08/28/2012
XenSummit - 08/28/2012XenSummit - 08/28/2012
XenSummit - 08/28/2012
Ceph Community
 
Initial review of Firebird 3
Initial review of Firebird 3Initial review of Firebird 3
Initial review of Firebird 3
Mind The Firebird
 
Cassandra training
Cassandra trainingCassandra training
Cassandra training
András Fehér
 
Run Cloud Native MySQL NDB Cluster in Kubernetes
Run Cloud Native MySQL NDB Cluster in KubernetesRun Cloud Native MySQL NDB Cluster in Kubernetes
Run Cloud Native MySQL NDB Cluster in Kubernetes
Bernd Ocklin
 
Summer 2017 undergraduate research powerpoint
Summer 2017 undergraduate research powerpointSummer 2017 undergraduate research powerpoint
Summer 2017 undergraduate research powerpoint
Christopher Dubois
 
Brk2051 sql server on linux and docker
Brk2051 sql server on linux and dockerBrk2051 sql server on linux and docker
Brk2051 sql server on linux and docker
Bob Ward
 
Experience In Building Scalable Web Sites Through Infrastructure's View
Experience In Building Scalable Web Sites Through Infrastructure's ViewExperience In Building Scalable Web Sites Through Infrastructure's View
Experience In Building Scalable Web Sites Through Infrastructure's View
Phuwadon D
 
Deployment Strategy
Deployment StrategyDeployment Strategy
Deployment StrategyMongoDB
 
Quick-and-Easy Deployment of a Ceph Storage Cluster
Quick-and-Easy Deployment of a Ceph Storage ClusterQuick-and-Easy Deployment of a Ceph Storage Cluster
Quick-and-Easy Deployment of a Ceph Storage Cluster
Patrick Quairoli
 
Common MongoDB Use Cases
Common MongoDB Use CasesCommon MongoDB Use Cases
Common MongoDB Use CasesDATAVERSITY
 
What CloudStackers Need To Know About LINSTOR/DRBD
What CloudStackers Need To Know About LINSTOR/DRBDWhat CloudStackers Need To Know About LINSTOR/DRBD
What CloudStackers Need To Know About LINSTOR/DRBD
ShapeBlue
 
Data Grids with Oracle Coherence
Data Grids with Oracle CoherenceData Grids with Oracle Coherence
Data Grids with Oracle Coherence
Ben Stopford
 
Exploiting NoSQL Like Never Before
Exploiting NoSQL Like Never BeforeExploiting NoSQL Like Never Before
Exploiting NoSQL Like Never Before
Francis Alexander
 
Ippevent : openshift Introduction
Ippevent : openshift IntroductionIppevent : openshift Introduction
Ippevent : openshift Introduction
kanedafromparis
 

Similar to Key-value databases in practice Redis @ DotNetToscana (20)

In-memory Databases
In-memory DatabasesIn-memory Databases
In-memory Databases
 
INFINISTORE(tm) - Scalable Open Source Storage Arhcitecture
INFINISTORE(tm) - Scalable Open Source Storage ArhcitectureINFINISTORE(tm) - Scalable Open Source Storage Arhcitecture
INFINISTORE(tm) - Scalable Open Source Storage Arhcitecture
 
2012-03-15 What's New at Red Hat
2012-03-15 What's New at Red Hat2012-03-15 What's New at Red Hat
2012-03-15 What's New at Red Hat
 
Block Storage For VMs With Ceph
Block Storage For VMs With CephBlock Storage For VMs With Ceph
Block Storage For VMs With Ceph
 
MySQL Cluster Scaling to a Billion Queries
MySQL Cluster Scaling to a Billion QueriesMySQL Cluster Scaling to a Billion Queries
MySQL Cluster Scaling to a Billion Queries
 
XenSummit - 08/28/2012
XenSummit - 08/28/2012XenSummit - 08/28/2012
XenSummit - 08/28/2012
 
Initial review of Firebird 3
Initial review of Firebird 3Initial review of Firebird 3
Initial review of Firebird 3
 
Cassandra training
Cassandra trainingCassandra training
Cassandra training
 
Run Cloud Native MySQL NDB Cluster in Kubernetes
Run Cloud Native MySQL NDB Cluster in KubernetesRun Cloud Native MySQL NDB Cluster in Kubernetes
Run Cloud Native MySQL NDB Cluster in Kubernetes
 
Summer 2017 undergraduate research powerpoint
Summer 2017 undergraduate research powerpointSummer 2017 undergraduate research powerpoint
Summer 2017 undergraduate research powerpoint
 
Brk2051 sql server on linux and docker
Brk2051 sql server on linux and dockerBrk2051 sql server on linux and docker
Brk2051 sql server on linux and docker
 
Experience In Building Scalable Web Sites Through Infrastructure's View
Experience In Building Scalable Web Sites Through Infrastructure's ViewExperience In Building Scalable Web Sites Through Infrastructure's View
Experience In Building Scalable Web Sites Through Infrastructure's View
 
Deployment Strategy
Deployment StrategyDeployment Strategy
Deployment Strategy
 
Quick-and-Easy Deployment of a Ceph Storage Cluster
Quick-and-Easy Deployment of a Ceph Storage ClusterQuick-and-Easy Deployment of a Ceph Storage Cluster
Quick-and-Easy Deployment of a Ceph Storage Cluster
 
Common MongoDB Use Cases
Common MongoDB Use CasesCommon MongoDB Use Cases
Common MongoDB Use Cases
 
Hadoop, Taming Elephants
Hadoop, Taming ElephantsHadoop, Taming Elephants
Hadoop, Taming Elephants
 
What CloudStackers Need To Know About LINSTOR/DRBD
What CloudStackers Need To Know About LINSTOR/DRBDWhat CloudStackers Need To Know About LINSTOR/DRBD
What CloudStackers Need To Know About LINSTOR/DRBD
 
Data Grids with Oracle Coherence
Data Grids with Oracle CoherenceData Grids with Oracle Coherence
Data Grids with Oracle Coherence
 
Exploiting NoSQL Like Never Before
Exploiting NoSQL Like Never BeforeExploiting NoSQL Like Never Before
Exploiting NoSQL Like Never Before
 
Ippevent : openshift Introduction
Ippevent : openshift IntroductionIppevent : openshift Introduction
Ippevent : openshift Introduction
 

More from Matteo Baglini

Writing Good Tests
Writing Good TestsWriting Good Tests
Writing Good Tests
Matteo Baglini
 
Legacy Coderetreat Bologna @ CodersTUG
Legacy Coderetreat Bologna @ CodersTUGLegacy Coderetreat Bologna @ CodersTUG
Legacy Coderetreat Bologna @ CodersTUGMatteo Baglini
 
Approval Tests @ MiniIAD
Approval Tests @ MiniIADApproval Tests @ MiniIAD
Approval Tests @ MiniIADMatteo Baglini
 
VS13 - Approval Tests: cosa, come, quando, perché? @ CDays
VS13 - Approval Tests: cosa, come, quando, perché? @ CDaysVS13 - Approval Tests: cosa, come, quando, perché? @ CDays
VS13 - Approval Tests: cosa, come, quando, perché? @ CDays
Matteo Baglini
 
Approval Tests @ CodersTUG
Approval Tests @ CodersTUGApproval Tests @ CodersTUG
Approval Tests @ CodersTUGMatteo Baglini
 
Coderetreat @ CodersTUG
Coderetreat @ CodersTUGCoderetreat @ CodersTUG
Coderetreat @ CodersTUGMatteo Baglini
 
RESTFul Web API Services @ DotNetToscana
RESTFul Web API Services @ DotNetToscanaRESTFul Web API Services @ DotNetToscana
RESTFul Web API Services @ DotNetToscana
Matteo Baglini
 
Modern JavaScript Development @ DotNetToscana
Modern JavaScript Development @ DotNetToscanaModern JavaScript Development @ DotNetToscana
Modern JavaScript Development @ DotNetToscanaMatteo Baglini
 
Async: scalabilità e responsiveness senza pari! @ CDays
Async: scalabilità e responsiveness senza pari! @ CDaysAsync: scalabilità e responsiveness senza pari! @ CDays
Async: scalabilità e responsiveness senza pari! @ CDays
Matteo Baglini
 
The NoSQL movement @ DotNetToscana
The NoSQL movement @ DotNetToscanaThe NoSQL movement @ DotNetToscana
The NoSQL movement @ DotNetToscanaMatteo Baglini
 
Asynchronous Programming Lab @ DotNetToscana
Asynchronous Programming Lab @ DotNetToscanaAsynchronous Programming Lab @ DotNetToscana
Asynchronous Programming Lab @ DotNetToscana
Matteo Baglini
 

More from Matteo Baglini (11)

Writing Good Tests
Writing Good TestsWriting Good Tests
Writing Good Tests
 
Legacy Coderetreat Bologna @ CodersTUG
Legacy Coderetreat Bologna @ CodersTUGLegacy Coderetreat Bologna @ CodersTUG
Legacy Coderetreat Bologna @ CodersTUG
 
Approval Tests @ MiniIAD
Approval Tests @ MiniIADApproval Tests @ MiniIAD
Approval Tests @ MiniIAD
 
VS13 - Approval Tests: cosa, come, quando, perché? @ CDays
VS13 - Approval Tests: cosa, come, quando, perché? @ CDaysVS13 - Approval Tests: cosa, come, quando, perché? @ CDays
VS13 - Approval Tests: cosa, come, quando, perché? @ CDays
 
Approval Tests @ CodersTUG
Approval Tests @ CodersTUGApproval Tests @ CodersTUG
Approval Tests @ CodersTUG
 
Coderetreat @ CodersTUG
Coderetreat @ CodersTUGCoderetreat @ CodersTUG
Coderetreat @ CodersTUG
 
RESTFul Web API Services @ DotNetToscana
RESTFul Web API Services @ DotNetToscanaRESTFul Web API Services @ DotNetToscana
RESTFul Web API Services @ DotNetToscana
 
Modern JavaScript Development @ DotNetToscana
Modern JavaScript Development @ DotNetToscanaModern JavaScript Development @ DotNetToscana
Modern JavaScript Development @ DotNetToscana
 
Async: scalabilità e responsiveness senza pari! @ CDays
Async: scalabilità e responsiveness senza pari! @ CDaysAsync: scalabilità e responsiveness senza pari! @ CDays
Async: scalabilità e responsiveness senza pari! @ CDays
 
The NoSQL movement @ DotNetToscana
The NoSQL movement @ DotNetToscanaThe NoSQL movement @ DotNetToscana
The NoSQL movement @ DotNetToscana
 
Asynchronous Programming Lab @ DotNetToscana
Asynchronous Programming Lab @ DotNetToscanaAsynchronous Programming Lab @ DotNetToscana
Asynchronous Programming Lab @ DotNetToscana
 

Recently uploaded

FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
DianaGray10
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
SOFTTECHHUB
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptxSecstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
nkrafacyberclub
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
DianaGray10
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
Pierluigi Pugliese
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
Neo4j
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems S.M.S.A.
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
Matthew Sinclair
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdfSAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
Peter Spielvogel
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
Neo4j
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
James Anderson
 

Recently uploaded (20)

FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptxSecstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdfSAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
 

Key-value databases in practice Redis @ DotNetToscana

  • 1. Matteo Baglini www.dotnettoscana.org Software Developer, Freelance matteo.baglini@gmail.com http://it.linkedin.com/in/matteobaglini http://github.cpom/bmatte
  • 2. «Advanced key-value store. It is often referred to as a data structure server» 2
  • 3. Key Value page:index <html><head>[...] user:123:session xDrSdEwd4dSlZkEkj+ user:123:avatar 77u/PD94bWwgdm+ Everything is a «blob» Commands, primarily, can GET and SET the values 3
  • 4. Key Value Type page:index <html><head>[...] String events:timeline { «Joe logged», «File X Uploaded», …} List logged:today { 1, 2, 3, 4, 5 } Set time => 10927353 user:123:profile Hash username => bmatte joe ~ 1.3483 game:leaderboard smith ~ 293.45 Sorted Set fred ~ 83.22 Different «data type/structure» Rich set of specialized commands 4
  • 5. Everything is stored in memory  Screamingly fast performance  Persistent via snapshot or append-only log file  Replication (only Master/Slave)  Extensible via embedded scripting engine (Lua)  Rich set of client libraries  High availability (In progress) ◦ Cluster (Fault tolerance, Multi-Node consistence) ◦ Sentinel (Monitoring, Notification, Automatic failover) 5
  • 6. Created by Salvatore Sanfilippo (@antirez)  First «public release» in March 2009.  Since 2010 sponsored by VMware. Initially written to improve performance of Web Analytics product LLOOGG out of his startup 6
  • 7. Written in ANSI C  No external dependencies  Single thread (asynchronous evented I/O)  Works on all POSIX-like system  Exist unofficial build for Windows  Open-source BSD licensed  Community (list, IRC & wiki) 7
  • 8. 1. A DSL for Abstract Data Types. 2. Memory storage is #1. 3. Fundamental data structures for a fundamental API. 4. Code is like a poem. 5. We're against complexity. 6. Two levels of API. 7. We optimize for joy. 8
  • 10. Latest stable version (2.6.*) 10
  • 12. 12
  • 13. 13
  • 14. 14
  • 15. 15
  • 17. Strings 17
  • 18. Any blob will do (A value can be at max 512MB) 18
  • 19. Operations on strings holding an integer 19
  • 20. 20
  • 21. Sharing state across processes ◦ Distribute lock, Incremental ID, Time series, User session.  Web Analytics ◦ User visit (day, week, month), Feature Tracking.  Caching ◦ String values can hold arbitrary data.  Rate limiting ◦ Limit number of API calls/minute. 21
  • 22. Keys 22
  • 23. Any item in can be made to expire after or at a certain time. 23
  • 24. 24
  • 25. Lists 25
  • 26. Sequence of string values 26
  • 27. Sequence of string values (Max length is 232 - 1 elements) 27
  • 29. 29
  • 30. Events Store or Notification ◦ Logs, Social Network Timelines, Notifications.  Fixed Data ◦ Last N activity.  Message Passing ◦ Durable MQ, Job Queue.  Circular list 30
  • 31. Sets 31
  • 32. Unordered set of unique values 32
  • 33. Unordered set of unique values (Max number of members is 232 – 1) 33
  • 34. You can do unions, intersections, differences of sets in very short time. 34
  • 35. 35
  • 36. Web Analytics ◦ Unique Page View, IP addresses visiting.  Relations ◦ Friends, Followers, Tags.  Caching Result ◦ Store result of expensive intersection of data. 36
  • 38. Ordered set of unique values 38
  • 41. 41
  • 42. Web Analytics ◦ Online users, Most visited pages.  Leaderbord ◦ Show top N.  Order by data ◦ Maintain a set of ordered data like user by age. 42
  • 43. Hashes 43
  • 44. Key → Value map (as value) 44
  • 45. Set attributes (Store up to 232 - 1 field-value pairs) 45
  • 47. 47
  • 48. Storing Objects ◦ Hashes are maps between string fields and string values, so they are the perfect data type to represent objects. 48
  • 50. Dump data to disk after certain conditions are met 50
  • 51. Pro: ◦ RDB is a very compact single-file. ◦ RDB files are perfect for backups. ◦ RDB is very good for disaster recovery. ◦ RDB allows faster restarts with big datasets. ◦ RDB maximizes performances (backgr. I/O via fork(2)).  Contro: ◦ RDB is NOT good if you need to minimize the chance of data loss in case Redis stops working (for example after a power outage). ◦ Fork can be time consuming if the dataset is very big. 51
  • 52. Append all write operations to a log 52
  • 53. Durability depends on fsync(2) policy 53
  • 54. Pro: ◦ AOF is much more durable. ◦ AOF is an append only log, no seeks, nor corruption problems (for example after a power outage). ◦ AOF contains a log of all the operations one after the other in an easy to understand and parse format.  Contro: ◦ AOF files are usually bigger than the equivalent RDB. ◦ AOF can be slower then RDB depending on the exact fsync policy. 54
  • 55. Use both persistence methods if you want a degree of data safety comparable to what any RDBMS can provide you.  If you care a lot about your data, but still can live with a few minutes of data lose in case of disasters, you can simply use RDB alone.  There are many users using AOF alone, but we discourage it since to have an RDB snapshot from time to time is a great idea for doing database backups, for faster restarts. 55
  • 57. Rich set of clients 57
  • 58. 58
  • 59. 59
  • 60. Code 60
  • 63. 63
  • 64. Classic scenario ◦ Multi atomic commands.  Optimistic locking ◦ Check and Set (CAS Pattern) write only if not changed. 64
  • 67. Subscribe multi channels decoupled from the key space 67
  • 68. Publish on some channel 68
  • 70. 70
  • 71. Message Passing ◦ Distribute message-oriented system, Event- Driven Architecture, Service Bus. 71
  • 72. Code 72
  • 74. One master replicate to multiple slaves 74
  • 75. Slave send SYNC command and master transfers the database file to the slave 75
  • 76. Slaves can perform only read operation 76
  • 77. Scalability ◦ Multiple slaves for read-only queries.  Redundancy ◦ Data replication.  Slave of Slave ◦ Graph-like structure for more scalability e redundancy. 77
  • 79. Screamingly fast performance  ~50K read/write operations per seconds.  ~100K read/write ops per second on a regular EC2 instance. 79
  • 80. redis-benchmark tool on a Ubuntu virtual machine ~36K rps 80
  • 82. Application Server SQL Redis Server 82
  • 83. 83
  • 84. Finally 84
  • 85. «I see Redis definitely more as a flexible tool than as a solution specialized to solve a specific problem: his mixed soul of cache, store, and messaging server shows this very well» Salvatore Sanfilippo 85
  • 86. http://redis.io/  http://github.com/antirez/redis  http://groups.google.com/group/redis-db 86