SlideShare a Scribd company logo
1 of 21
Download to read offline
Everybody likes
REDIS
Liviu Costea @clm160
Software Developer
Biz Pro Technologies
23.09.2015
Let me help you add Redis to your stack today!
Agenda
What’s all this with Redis?
Advanced structures (real usage scenarios)
Features, many features
How and where to use it
Bit of history
There was a developer (@antirez) and he had a problem: real
time web analytics
NOT a plain Key-value NoSql database but a in memory data
structures server
VMWare, Pivotal, RedisLabs and many other companies
helped in some way
Very popular: Twitter, Airbnb, Flickr, StackOverflow, GitHub,
BitBucket, Biz Pro Technologies and many others
How people start
First there was a server, then you think of scaling
Next you have 2 servers, but how do you share:
◦Session
◦Cached & static items
◦Sometimes you need to synchronize them
Then you find some solutions:
◦Database (probably the worst)
◦Memcached (getting better)
◦Redis (a NoSQL, newest addition)
Data structures
Main data types:
◦Strings (everything is a string)
◦Lists (double linked lists)
◦Sets (unique lists)
◦Hashes (like an object)
◦Sorted sets (by a value at creation)
Efficiently modeling of data is your main concern!
Queries
You don’t have queries, you don’t have indexes
You do have
◦KEYS = returns all your keys (EVIL I tell you!)
◦SCAN with MATCH, COUNT = server side cursor
But these are not for real queries, instead you should
keep your data updated by yourself: queries, indexes
DEMO 1
1. Data model for a voting based
website
2. Query to get all developers
from Iasi
Single threaded server
Don’t block it with long
operations (#1 threat in
production is KEYS
command)
Single threaded server
There is no locking necessary
Extremely fast, everything is in RAM
Limited support for transactions with optimistic
locking (might be removed in the future versions)
Pipelining support (check your client)
Lua scripting
Similar to stored procedures:
◦They are atomic by nature, but not transactions
◦Rule of thumb: don’t write heavy scripts because
you block the server
◦Limitation: use only deterministic functions
(because of replication model)
◦KEYS and ARGV global variables
DEMO 2
1. Sliding expiration for a simple
key
2. Increment all scores of a set
3. Distributed locking
Use as a cache system
It can be configured as a LRU cache with max memory
and different eviction policies
Expiration (TTL) of keys only (no subkeys)
Use as a session storage
If you go with the session out of proc here are some
existing session providers:
◦PHPRedis
◦Spring Session
◦Ruby
◦Node.js
◦ASP.NET (official and open source - wow)
Use as a real database
Backup – Snapshot (RDB file) - default
◦BGSave – fork
◦On Stop / On Start
Persistence - AOF
◦Every write appends
Use both, on long term they will be unified
Master / Slave replication and WAIT command
DEMO 3
1. Restarting the server, data is
not lost
2. Save on demand
3. Lets see also AOF
More features
Big ecosystem, lots of client libraries out there: redis.
io/clients
On AWS and Azure – first class citizen (with high
availability)
Windows port by MS Open Tech (good for dev)
GUIs:
Redsmin (web), Redis-commander (web, your own
installation, node.js), FastoRedis (desktop)
Redis Cluster
Available from 3.0 – waiting for adoption – clients and
applications
Implemented with query routing
Client must be (smart) able to memorize things about
the cluster: gets redirected to the right node
Ping – Pong between clients (heartbeat)
Keyspace (dividing data into nodes)
Generating KEYS in a LUA script isn’t cluster-safe
Troubleshooting
Main problems come from long running commands:
◦FLUSHDB,
◦FLUSHALL,
◦KEYS
◦LUA Scripts
◦They can even bring your replica set DOWN
DEMO 4
1. Slowlog
2. Big keys
3. Monitor
Future features
For the next version
◦Geo hashing API (already documented)
◦A few new commands: like a memory introspection
command
Other things in the queue:
◦Real transactions with Lua, support for rollback
?questions?
1. Liviu Costea
2. email.lcostea@gmail.com
3. @clm160
4. SO user:4138058

More Related Content

What's hot

OTechs Cloud Computing Training Course
OTechs Cloud Computing Training CourseOTechs Cloud Computing Training Course
OTechs Cloud Computing Training CourseOsman Suliman
 
RelStorage Plone Zope RDB Storage Backend
RelStorage Plone Zope RDB Storage BackendRelStorage Plone Zope RDB Storage Backend
RelStorage Plone Zope RDB Storage BackendJens Klein
 
Draft slide of Demystifying DHT in GlusterFS
Draft slide of Demystifying DHT in GlusterFSDraft slide of Demystifying DHT in GlusterFS
Draft slide of Demystifying DHT in GlusterFSAnkit Raj
 
"Clouds on the Horizon Get Ready for Drizzle" by David Axmark @ eLiberatica 2009
"Clouds on the Horizon Get Ready for Drizzle" by David Axmark @ eLiberatica 2009"Clouds on the Horizon Get Ready for Drizzle" by David Axmark @ eLiberatica 2009
"Clouds on the Horizon Get Ready for Drizzle" by David Axmark @ eLiberatica 2009eLiberatica
 
Hadoop 2.x HDFS Cluster Installation (VirtualBox)
Hadoop 2.x  HDFS Cluster Installation (VirtualBox)Hadoop 2.x  HDFS Cluster Installation (VirtualBox)
Hadoop 2.x HDFS Cluster Installation (VirtualBox)Amir Sedighi
 
Azure document db
Azure document dbAzure document db
Azure document dbIan Chen
 
Handling scientific workloads using opennebula, Roland den Hollander, VU
Handling scientific workloads using opennebula, Roland den Hollander, VUHandling scientific workloads using opennebula, Roland den Hollander, VU
Handling scientific workloads using opennebula, Roland den Hollander, VUOpenNebula Project
 
Intro to Node.js
Intro to Node.jsIntro to Node.js
Intro to Node.jsJames Carr
 
Rapid prototyping using azure functions - A walk on the wild side
Rapid prototyping using azure functions - A walk on the wild sideRapid prototyping using azure functions - A walk on the wild side
Rapid prototyping using azure functions - A walk on the wild sideSamrat Saha
 
Node in Real Time - The Beginning
Node in Real Time - The BeginningNode in Real Time - The Beginning
Node in Real Time - The BeginningAxilis
 
JavaScript, Meet Cloud: Node.js on Windows Azure
JavaScript, Meet Cloud: Node.js on Windows AzureJavaScript, Meet Cloud: Node.js on Windows Azure
JavaScript, Meet Cloud: Node.js on Windows AzureSasha Goldshtein
 
Academy PRO: Introduction to search engines. Meet Elasticsearch
Academy PRO: Introduction to search engines. Meet ElasticsearchAcademy PRO: Introduction to search engines. Meet Elasticsearch
Academy PRO: Introduction to search engines. Meet ElasticsearchBinary Studio
 
Ускоряем загрузку картинок вебсокетами
Ускоряем загрузку картинок вебсокетамиУскоряем загрузку картинок вебсокетами
Ускоряем загрузку картинок вебсокетами2ГИС Технологии
 
Supercharge your next Vue app with Nuxt
Supercharge your next Vue app with NuxtSupercharge your next Vue app with Nuxt
Supercharge your next Vue app with NuxtThe Software House
 

What's hot (20)

OTechs Cloud Computing Training Course
OTechs Cloud Computing Training CourseOTechs Cloud Computing Training Course
OTechs Cloud Computing Training Course
 
The C10k Problem
The C10k ProblemThe C10k Problem
The C10k Problem
 
RelStorage Plone Zope RDB Storage Backend
RelStorage Plone Zope RDB Storage BackendRelStorage Plone Zope RDB Storage Backend
RelStorage Plone Zope RDB Storage Backend
 
Draft slide of Demystifying DHT in GlusterFS
Draft slide of Demystifying DHT in GlusterFSDraft slide of Demystifying DHT in GlusterFS
Draft slide of Demystifying DHT in GlusterFS
 
"Clouds on the Horizon Get Ready for Drizzle" by David Axmark @ eLiberatica 2009
"Clouds on the Horizon Get Ready for Drizzle" by David Axmark @ eLiberatica 2009"Clouds on the Horizon Get Ready for Drizzle" by David Axmark @ eLiberatica 2009
"Clouds on the Horizon Get Ready for Drizzle" by David Axmark @ eLiberatica 2009
 
Nodejs
NodejsNodejs
Nodejs
 
Hadoop 2.x HDFS Cluster Installation (VirtualBox)
Hadoop 2.x  HDFS Cluster Installation (VirtualBox)Hadoop 2.x  HDFS Cluster Installation (VirtualBox)
Hadoop 2.x HDFS Cluster Installation (VirtualBox)
 
Azure document db
Azure document dbAzure document db
Azure document db
 
Handling scientific workloads using opennebula, Roland den Hollander, VU
Handling scientific workloads using opennebula, Roland den Hollander, VUHandling scientific workloads using opennebula, Roland den Hollander, VU
Handling scientific workloads using opennebula, Roland den Hollander, VU
 
Intro to Node.js
Intro to Node.jsIntro to Node.js
Intro to Node.js
 
Restinio (actual aug 2018)
Restinio (actual aug 2018)Restinio (actual aug 2018)
Restinio (actual aug 2018)
 
node.js
node.jsnode.js
node.js
 
Rapid prototyping using azure functions - A walk on the wild side
Rapid prototyping using azure functions - A walk on the wild sideRapid prototyping using azure functions - A walk on the wild side
Rapid prototyping using azure functions - A walk on the wild side
 
Swarm
SwarmSwarm
Swarm
 
Node in Real Time - The Beginning
Node in Real Time - The BeginningNode in Real Time - The Beginning
Node in Real Time - The Beginning
 
Cassandra at scale
Cassandra at scaleCassandra at scale
Cassandra at scale
 
JavaScript, Meet Cloud: Node.js on Windows Azure
JavaScript, Meet Cloud: Node.js on Windows AzureJavaScript, Meet Cloud: Node.js on Windows Azure
JavaScript, Meet Cloud: Node.js on Windows Azure
 
Academy PRO: Introduction to search engines. Meet Elasticsearch
Academy PRO: Introduction to search engines. Meet ElasticsearchAcademy PRO: Introduction to search engines. Meet Elasticsearch
Academy PRO: Introduction to search engines. Meet Elasticsearch
 
Ускоряем загрузку картинок вебсокетами
Ускоряем загрузку картинок вебсокетамиУскоряем загрузку картинок вебсокетами
Ускоряем загрузку картинок вебсокетами
 
Supercharge your next Vue app with Nuxt
Supercharge your next Vue app with NuxtSupercharge your next Vue app with Nuxt
Supercharge your next Vue app with Nuxt
 

Viewers also liked

Commerical insurance presentation final 3.3.16
Commerical insurance presentation final 3.3.16Commerical insurance presentation final 3.3.16
Commerical insurance presentation final 3.3.16Jennifer Benincasa
 
L3 gd ha3_the_structureofthegame_050115
L3 gd ha3_the_structureofthegame_050115L3 gd ha3_the_structureofthegame_050115
L3 gd ha3_the_structureofthegame_050115PaulinaKucharska
 
IG2 game audio cut sequence production_2014 to 2015
IG2 game audio cut sequence production_2014 to 2015IG2 game audio cut sequence production_2014 to 2015
IG2 game audio cut sequence production_2014 to 2015PaulinaKucharska
 
Solidarity eocnomy building alternatives for people and planet papers and rep...
Solidarity eocnomy building alternatives for people and planet papers and rep...Solidarity eocnomy building alternatives for people and planet papers and rep...
Solidarity eocnomy building alternatives for people and planet papers and rep...roland_saavedra
 
Jauniešu garantijas projektu konkurss pašvaldībām, JSPA, 12.11.2014.
Jauniešu garantijas projektu konkurss pašvaldībām, JSPA, 12.11.2014.Jauniešu garantijas projektu konkurss pašvaldībām, JSPA, 12.11.2014.
Jauniešu garantijas projektu konkurss pašvaldībām, JSPA, 12.11.2014.Latvijas Jaunatnes padome
 
Ethanol whitepaper
Ethanol whitepaperEthanol whitepaper
Ethanol whitepaperRavi Yadav
 

Viewers also liked (12)

Mision universidad de londres
Mision universidad de londresMision universidad de londres
Mision universidad de londres
 
Commerical insurance presentation final 3.3.16
Commerical insurance presentation final 3.3.16Commerical insurance presentation final 3.3.16
Commerical insurance presentation final 3.3.16
 
L3 gd ha3_the_structureofthegame_050115
L3 gd ha3_the_structureofthegame_050115L3 gd ha3_the_structureofthegame_050115
L3 gd ha3_the_structureofthegame_050115
 
IG2 game audio cut sequence production_2014 to 2015
IG2 game audio cut sequence production_2014 to 2015IG2 game audio cut sequence production_2014 to 2015
IG2 game audio cut sequence production_2014 to 2015
 
1000 Lens Campaign
1000 Lens Campaign1000 Lens Campaign
1000 Lens Campaign
 
Solidarity eocnomy building alternatives for people and planet papers and rep...
Solidarity eocnomy building alternatives for people and planet papers and rep...Solidarity eocnomy building alternatives for people and planet papers and rep...
Solidarity eocnomy building alternatives for people and planet papers and rep...
 
Youth Policy for NEETs
Youth Policy for NEETsYouth Policy for NEETs
Youth Policy for NEETs
 
Jauniešu garantijas projektu konkurss pašvaldībām, JSPA, 12.11.2014.
Jauniešu garantijas projektu konkurss pašvaldībām, JSPA, 12.11.2014.Jauniešu garantijas projektu konkurss pašvaldībām, JSPA, 12.11.2014.
Jauniešu garantijas projektu konkurss pašvaldībām, JSPA, 12.11.2014.
 
Jauniešu politiskā līdzdalība Latvijā.
Jauniešu politiskā līdzdalība Latvijā.Jauniešu politiskā līdzdalība Latvijā.
Jauniešu politiskā līdzdalība Latvijā.
 
Lesson template
Lesson templateLesson template
Lesson template
 
Manualmaster,0
Manualmaster,0Manualmaster,0
Manualmaster,0
 
Ethanol whitepaper
Ethanol whitepaperEthanol whitepaper
Ethanol whitepaper
 

Similar to dba_lounge_Iasi: Everybody likes redis

Planning for-high-performance-web-application
Planning for-high-performance-web-applicationPlanning for-high-performance-web-application
Planning for-high-performance-web-applicationNguyễn Duy Nhân
 
Get more than a cache back! The Microsoft Azure Redis Cache (NDC Oslo)
Get more than a cache back! The Microsoft Azure Redis Cache (NDC Oslo)Get more than a cache back! The Microsoft Azure Redis Cache (NDC Oslo)
Get more than a cache back! The Microsoft Azure Redis Cache (NDC Oslo)Maarten Balliauw
 
Austin Web Architecture
Austin Web ArchitectureAustin Web Architecture
Austin Web Architecturejoaquincasares
 
NoSQL for great good [hanoi.rb talk]
NoSQL for great good [hanoi.rb talk]NoSQL for great good [hanoi.rb talk]
NoSQL for great good [hanoi.rb talk]Huy Do
 
SFScon14: Schrödinger’s elephant: why PostgreSQL can solve all your database ...
SFScon14: Schrödinger’s elephant: why PostgreSQL can solve all your database ...SFScon14: Schrödinger’s elephant: why PostgreSQL can solve all your database ...
SFScon14: Schrödinger’s elephant: why PostgreSQL can solve all your database ...South Tyrol Free Software Conference
 
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 dockerBob Ward
 
Ingesting Over Four Million Rows Per Second With QuestDB Timeseries Database ...
Ingesting Over Four Million Rows Per Second With QuestDB Timeseries Database ...Ingesting Over Four Million Rows Per Second With QuestDB Timeseries Database ...
Ingesting Over Four Million Rows Per Second With QuestDB Timeseries Database ...javier ramirez
 
Exploiting NoSQL Like Never Before
Exploiting NoSQL Like Never BeforeExploiting NoSQL Like Never Before
Exploiting NoSQL Like Never BeforeFrancis Alexander
 
Azure SQL - more or/and less than SQL Server
Azure SQL - more or/and less than SQL ServerAzure SQL - more or/and less than SQL Server
Azure SQL - more or/and less than SQL ServerRafał Hryniewski
 
DrupalCampLA 2011: Drupal backend-performance
DrupalCampLA 2011: Drupal backend-performanceDrupalCampLA 2011: Drupal backend-performance
DrupalCampLA 2011: Drupal backend-performanceAshok Modi
 
Bootcamp 2017 - SQL Server on Linux
Bootcamp 2017 - SQL Server on LinuxBootcamp 2017 - SQL Server on Linux
Bootcamp 2017 - SQL Server on LinuxMaximiliano Accotto
 
Cómo se diseña una base de datos que pueda ingerir más de cuatro millones de ...
Cómo se diseña una base de datos que pueda ingerir más de cuatro millones de ...Cómo se diseña una base de datos que pueda ingerir más de cuatro millones de ...
Cómo se diseña una base de datos que pueda ingerir más de cuatro millones de ...javier ramirez
 
Experiences using CouchDB inside Microsoft's Azure team
Experiences using CouchDB inside Microsoft's Azure teamExperiences using CouchDB inside Microsoft's Azure team
Experiences using CouchDB inside Microsoft's Azure teamBrian Benz
 
Redis Everywhere - Sunshine PHP
Redis Everywhere - Sunshine PHPRedis Everywhere - Sunshine PHP
Redis Everywhere - Sunshine PHPRicard Clau
 
Planning For High Performance Web Application
Planning For High Performance Web ApplicationPlanning For High Performance Web Application
Planning For High Performance Web ApplicationYue Tian
 
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 ClusterPatrick Quairoli
 
Redis everywhere - PHP London
Redis everywhere - PHP LondonRedis everywhere - PHP London
Redis everywhere - PHP LondonRicard Clau
 
Build an Open Source Data Lake For Data Scientists
Build an Open Source Data Lake For Data ScientistsBuild an Open Source Data Lake For Data Scientists
Build an Open Source Data Lake For Data ScientistsShawn Zhu
 

Similar to dba_lounge_Iasi: Everybody likes redis (20)

Planning for-high-performance-web-application
Planning for-high-performance-web-applicationPlanning for-high-performance-web-application
Planning for-high-performance-web-application
 
SQL on linux
SQL on linuxSQL on linux
SQL on linux
 
Get more than a cache back! The Microsoft Azure Redis Cache (NDC Oslo)
Get more than a cache back! The Microsoft Azure Redis Cache (NDC Oslo)Get more than a cache back! The Microsoft Azure Redis Cache (NDC Oslo)
Get more than a cache back! The Microsoft Azure Redis Cache (NDC Oslo)
 
Austin Web Architecture
Austin Web ArchitectureAustin Web Architecture
Austin Web Architecture
 
NoSQL for great good [hanoi.rb talk]
NoSQL for great good [hanoi.rb talk]NoSQL for great good [hanoi.rb talk]
NoSQL for great good [hanoi.rb talk]
 
SFScon14: Schrödinger’s elephant: why PostgreSQL can solve all your database ...
SFScon14: Schrödinger’s elephant: why PostgreSQL can solve all your database ...SFScon14: Schrödinger’s elephant: why PostgreSQL can solve all your database ...
SFScon14: Schrödinger’s elephant: why PostgreSQL can solve all your database ...
 
In-memory Databases
In-memory DatabasesIn-memory Databases
In-memory Databases
 
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
 
Ingesting Over Four Million Rows Per Second With QuestDB Timeseries Database ...
Ingesting Over Four Million Rows Per Second With QuestDB Timeseries Database ...Ingesting Over Four Million Rows Per Second With QuestDB Timeseries Database ...
Ingesting Over Four Million Rows Per Second With QuestDB Timeseries Database ...
 
Exploiting NoSQL Like Never Before
Exploiting NoSQL Like Never BeforeExploiting NoSQL Like Never Before
Exploiting NoSQL Like Never Before
 
Azure SQL - more or/and less than SQL Server
Azure SQL - more or/and less than SQL ServerAzure SQL - more or/and less than SQL Server
Azure SQL - more or/and less than SQL Server
 
DrupalCampLA 2011: Drupal backend-performance
DrupalCampLA 2011: Drupal backend-performanceDrupalCampLA 2011: Drupal backend-performance
DrupalCampLA 2011: Drupal backend-performance
 
Bootcamp 2017 - SQL Server on Linux
Bootcamp 2017 - SQL Server on LinuxBootcamp 2017 - SQL Server on Linux
Bootcamp 2017 - SQL Server on Linux
 
Cómo se diseña una base de datos que pueda ingerir más de cuatro millones de ...
Cómo se diseña una base de datos que pueda ingerir más de cuatro millones de ...Cómo se diseña una base de datos que pueda ingerir más de cuatro millones de ...
Cómo se diseña una base de datos que pueda ingerir más de cuatro millones de ...
 
Experiences using CouchDB inside Microsoft's Azure team
Experiences using CouchDB inside Microsoft's Azure teamExperiences using CouchDB inside Microsoft's Azure team
Experiences using CouchDB inside Microsoft's Azure team
 
Redis Everywhere - Sunshine PHP
Redis Everywhere - Sunshine PHPRedis Everywhere - Sunshine PHP
Redis Everywhere - Sunshine PHP
 
Planning For High Performance Web Application
Planning For High Performance Web ApplicationPlanning For High Performance Web Application
Planning For High Performance Web Application
 
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
 
Redis everywhere - PHP London
Redis everywhere - PHP LondonRedis everywhere - PHP London
Redis everywhere - PHP London
 
Build an Open Source Data Lake For Data Scientists
Build an Open Source Data Lake For Data ScientistsBuild an Open Source Data Lake For Data Scientists
Build an Open Source Data Lake For Data Scientists
 

Recently uploaded

办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样umasea
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprisepreethippts
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceBrainSell Technologies
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesPhilip Schwarz
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024StefanoLambiase
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...Technogeeks
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odishasmiwainfosol
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Andreas Granig
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfAlina Yurenko
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based projectAnoyGreter
 
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdfExploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdfkalichargn70th171
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...OnePlan Solutions
 
Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf31events.com
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Matt Ray
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesŁukasz Chruściel
 
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationBradBedford3
 
VK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web DevelopmentVK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web Developmentvyaparkranti
 
Precise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalPrecise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalLionel Briand
 

Recently uploaded (20)

办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprise
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. Salesforce
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a series
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based project
 
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdfExploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
 
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
 
Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New Features
 
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion Application
 
VK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web DevelopmentVK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web Development
 
Odoo Development Company in India | Devintelle Consulting Service
Odoo Development Company in India | Devintelle Consulting ServiceOdoo Development Company in India | Devintelle Consulting Service
Odoo Development Company in India | Devintelle Consulting Service
 
Precise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalPrecise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive Goal
 

dba_lounge_Iasi: Everybody likes redis

  • 1. Everybody likes REDIS Liviu Costea @clm160 Software Developer Biz Pro Technologies 23.09.2015 Let me help you add Redis to your stack today!
  • 2. Agenda What’s all this with Redis? Advanced structures (real usage scenarios) Features, many features How and where to use it
  • 3. Bit of history There was a developer (@antirez) and he had a problem: real time web analytics NOT a plain Key-value NoSql database but a in memory data structures server VMWare, Pivotal, RedisLabs and many other companies helped in some way Very popular: Twitter, Airbnb, Flickr, StackOverflow, GitHub, BitBucket, Biz Pro Technologies and many others
  • 4. How people start First there was a server, then you think of scaling Next you have 2 servers, but how do you share: ◦Session ◦Cached & static items ◦Sometimes you need to synchronize them Then you find some solutions: ◦Database (probably the worst) ◦Memcached (getting better) ◦Redis (a NoSQL, newest addition)
  • 5. Data structures Main data types: ◦Strings (everything is a string) ◦Lists (double linked lists) ◦Sets (unique lists) ◦Hashes (like an object) ◦Sorted sets (by a value at creation) Efficiently modeling of data is your main concern!
  • 6. Queries You don’t have queries, you don’t have indexes You do have ◦KEYS = returns all your keys (EVIL I tell you!) ◦SCAN with MATCH, COUNT = server side cursor But these are not for real queries, instead you should keep your data updated by yourself: queries, indexes
  • 7. DEMO 1 1. Data model for a voting based website 2. Query to get all developers from Iasi
  • 8. Single threaded server Don’t block it with long operations (#1 threat in production is KEYS command)
  • 9. Single threaded server There is no locking necessary Extremely fast, everything is in RAM Limited support for transactions with optimistic locking (might be removed in the future versions) Pipelining support (check your client)
  • 10. Lua scripting Similar to stored procedures: ◦They are atomic by nature, but not transactions ◦Rule of thumb: don’t write heavy scripts because you block the server ◦Limitation: use only deterministic functions (because of replication model) ◦KEYS and ARGV global variables
  • 11. DEMO 2 1. Sliding expiration for a simple key 2. Increment all scores of a set 3. Distributed locking
  • 12. Use as a cache system It can be configured as a LRU cache with max memory and different eviction policies Expiration (TTL) of keys only (no subkeys)
  • 13. Use as a session storage If you go with the session out of proc here are some existing session providers: ◦PHPRedis ◦Spring Session ◦Ruby ◦Node.js ◦ASP.NET (official and open source - wow)
  • 14. Use as a real database Backup – Snapshot (RDB file) - default ◦BGSave – fork ◦On Stop / On Start Persistence - AOF ◦Every write appends Use both, on long term they will be unified Master / Slave replication and WAIT command
  • 15. DEMO 3 1. Restarting the server, data is not lost 2. Save on demand 3. Lets see also AOF
  • 16. More features Big ecosystem, lots of client libraries out there: redis. io/clients On AWS and Azure – first class citizen (with high availability) Windows port by MS Open Tech (good for dev) GUIs: Redsmin (web), Redis-commander (web, your own installation, node.js), FastoRedis (desktop)
  • 17. Redis Cluster Available from 3.0 – waiting for adoption – clients and applications Implemented with query routing Client must be (smart) able to memorize things about the cluster: gets redirected to the right node Ping – Pong between clients (heartbeat) Keyspace (dividing data into nodes) Generating KEYS in a LUA script isn’t cluster-safe
  • 18. Troubleshooting Main problems come from long running commands: ◦FLUSHDB, ◦FLUSHALL, ◦KEYS ◦LUA Scripts ◦They can even bring your replica set DOWN
  • 19. DEMO 4 1. Slowlog 2. Big keys 3. Monitor
  • 20. Future features For the next version ◦Geo hashing API (already documented) ◦A few new commands: like a memory introspection command Other things in the queue: ◦Real transactions with Lua, support for rollback
  • 21. ?questions? 1. Liviu Costea 2. email.lcostea@gmail.com 3. @clm160 4. SO user:4138058