SlideShare a Scribd company logo
The Versatility of Redis
Powering our critical business using Redis
Luciano Sabença
Eiti Kimura
ABOUT US
● Software Engineer at Movile/Wavy
● Developer and architect of distributed systems
● Main interest areas are: Computer Theory, Machine
Learning and Distributed System.
● BS degree with praise in Computer Science by
University of Campinas.
Luciano Sabença
lucianosabenca
ABOUT US
● IT Coordinator and Software Architect at Movile
● Msc. in Electrical Engineering
● Apache Cassandra MVP (2014/2015 and 2015/2016)
● Apache Cassandra Contributor (2015)
● Cassandra Summit Speaker (2014 and 2015)
● Strata Hadoop World Singapore Speaker (2016)
● Spark Summit Speaker (2017)
Eiti Kimura
eitikimura
Movile is the company behind several
apps that makes the life easier
WE MAKE LIFE BETTER
THROUGH OUR APPS
is a Movile company
BALANCE INFORMATION
Account: X3254
Balance: $1,564.20
100852
BALANCE INFORMATION
Account: X3254
Balance: $1,564.20
100852
A deposit of $95.00 was
made to your account on
April 23th at 7:59pm.
Your balance is:
$1,659.20. Text STOP to
cancel or HELP for more
information.
PLAYKIDS
685-63
PLAYKIDS
685-63
You have opted to
subscribe for Play Kids
access fo $14,99/mo.
Reply YES to confirm. Text
STOP to cancel or HELP for
more info.
PLAYKIDS
685-63
You have opted to
subscribe for Play Kids
access fo $14,99/mo.
Reply YES to confirm. Text
STOP to cancel or HELP for
more info.
YES
You successfully
subscribed to PK.
Download the app:
http://bit.ly/pp and enter
this validation code:
528-985-963 to access.
[Redis conf18] The Versatility of Redis
AGENDA
● What/Why Redis?
● 1st Using Redis as Database
● 2nd Traditional Cache Usage
● 3rd A Distributed Lock case
● Lessons Learned / Pros & Cons
WHAT IS REDIS ?
● Redis is what is called a key-value store often
referred to as a NoSQL database
● It can handle concurrency problems very well
● Records can be set to expire after sometime
● It can be used in several different applications
WHY REDIS ?
● Most Redis Operations are atomic!
○ No need for external synchronization!
● Redis Async Replication is fast and makes Redis
reliable!
● All dataset is in memory: fast access!
● Data persistence: Durability!
1st Use Case
How about to try Redis as
a Database?
1st Use Case Intro
Exploring the Redis feature as a datastore we are using
in this case as a distributed database for our blacklist
datalayer service.
60 million phone
numbers
> 1 billion
requests/mo
latency < 5ms
Blacklist Usage by Our Services
Messaging Platform
BLACKLIST DATABASE LAYER
check
PLAY KIDS
685-63
Blacklist Usage by Our Services
Messaging Platform
BLACKLIST DATABASE LAYER
check
PLAY KIDS
You have opted to
subscribe for Play
Kids access fo
$14,99/mo. Reply YES
to confirm.
685-63
Blacklist Usage by Our Services
Billing Platform
BLACKLIST DATABASE LAYER
check
YES
685-63
PLAY KIDS
You have opted to
subscribe for Play
Kids access fo
$14,99/mo. Reply YES
to confirm.
Blacklist Usage by Our Services
Subscription Platform
BLACKLIST DATABASE LAYER
check
YES
You successfully
subscribed to PK.
Enter this validation
code: 528-985-963
685-63
PLAY KIDS
You have opted to
subscribe for Play
Kids access fo
$14,99/mo. Reply YES
to confirm.
Blacklist Usage by Our Services
Subscription Platform Billing Platform Messaging Platform
BLACKLIST DATABASE LAYER
check check check
685-63
YES
You successfully
subscribed to PK.
Enter this validation
code: 528-985-963
685-63
PLAY KIDS
You have opted to
subscribe for Play
Kids access fo
$14,99/mo. Reply YES
to confirm.
Blacklist Usage by Our Services
Web Pages Marketplaces
Broadcast
Applications
Third-Party
Applications
Mobile Apps
Blacklist Usage by Our Services
Subscription Platform Billing Platform Messaging Platform
BLACKLIST DATABASE LAYER
Web Pages Marketplaces
Broadcast
Applications
Third-Party
Applications
Mobile Apps
charge
subscribe
subscribe
charge
send SMS
send message
broadcast
check check check
APPLICATION LAYER
SERVICE LAYER
Old Architecture
Old Architecture
Old Architecture - Failure
● Large amount of memory
being used (~5GB/instance)
● High frequency of GC pauses
● General low performance
noticed
● No more memory available
(scale up limitation)
New Architecture using Redis as Main Database
New Architecture using Redis as Main Database
Redis Advantages for the New Architecture Solution
Configurable
Persistence
Configurable
Replication
Strategies
Fast In-memory
data access
Redis Architecture Setup
Application Application Application Application Application Application
DATACENTER 1 DATACENTER 2
Read data
Write data
Results
● We saved more than 100 GB of memory
● Saved thousands Dollars in memory
● Distributed Data reliability
High message throughput
High scalability
Low costs
Low latency and
business impact
2nd Use Case
Using Redis as a Cache for
Distributed Systems
2nd Use Case Intro
One of the most common Redis usages is as a cache.
A well known case to use in our solution to provide fast
access to our high performance services.
> 160 million
records
essential for the
high throughput of
our platforms
direct impact in
company's
revenue
By the way what is a Grey list concept?
We create a score to our users based on the product it
is subscribed, it intent to classify the user as a good
customer.
Phone Number: + 55 19 0000 1111 Score: 0,8
Phone Number: + 55 19 2323 0101 Score: 0,2
Phone Number: + 55 19 0202 0000 Score: 0,4
Phone Number: + 55 19 4242 9090 Score: 0,1
GREYLIST DATA LAYER
By the way what is a Greylist concept?
Would you like to
receive Sports News
for your location
$2,99/week. Reply
YES to confirm.
685-63
Media Partner
By the way what is a Greylist concept?
Would you like to
receive Sports News
for your location
$2,99/week. Reply
YES to confirm.
YES
685-63
Subscription Platform
Greylist Service Layer
By the way what is a Greylist concept?
Would you like to
receive Sports News
for your location
$2,99/week. Reply
YES to confirm.
YES
685-63
Subscription Platform
Greylist Service Layer
SORRY service
unavailable for your
phone number.
Congratulations now
you are subscribed to
receive Sports News
for your location. Text
STOP to cancel.
YES
SCORE > 0,5NO
By the way what is a Greylist concept?
Would you like to
receive Sports News
for your location
$2,99/week. Reply
YES to confirm.
YES
SORRY service
unavailable for your
phone number.
685-63
Greylist Service Layer
SORRY service
unavailable for your
phone number.
Congratulations now
you are subscribed to
receive Sports News
for your location. Text
STOP to cancel.
YES
SCORE > 0,5NO
By the way what is a Greylist concept?
Would you like to
receive Sports News
for your location
$2,99/week. Reply
YES to confirm.
YES
SORRY service
unavailable for your
phone number.
685-63
Subscription Platform
Greylist Service Layer
SORRY service
unavailable for your
phone number.
Media Partner
Congratulations now
you are subscribed to
receive Sports News
for your location. Text
STOP to cancel.
YES
NO SCORE > 0,5
Solution Architecture
Redis In the Solution
● We disabled Redis persistence and reached write rate over
300k/second.
● Peak of 400k writes/second
● Redis response is below ms.
● We have no impact in our subscription flow
Results
● Blocked more than 1MM subscriptions from bad
payers users.
● Saved around U$60k in media in a few months.
● Block Rate > 40% for some campaigns.
3rd Use Case
Have you tried to orchestrate a
distributed system?
3rd Use Case Intro
Exploring Redis as an orchestrator for our distributed
systems managing SMPP connections
Stateful
connection with
limited number of
binds
A connection can
be consumed by
more than one
instance
We should be
capable of load
balancing the
connections
Normal Scenario
Platform Instance
Platform Instance
Mobile Carrier
SMPP / BIND 1
SMPP / BIND 2
WAVY DATACENTERS INTERNET
Failure Scenario
Platform Instance
Platform Instance
Mobile Carrier
SMPP / BIND 1
SMPP / BIND 2
WAVY DATACENTERS INTERNET
Expected Scenario
Platform Instance
Platform Instance
Mobile Carrier
SMPP / BIND 1
SMPP / BIND 2
WAVY DATACENTERS INTERNET
Solution Scenario
Platform Instance
Platform Instance
Mobile Carrier
SMPP / BIND 1
SMPP / BIND 2
WAVY DATACENTERS INTERNET
Components trying to acquire a lock
Set The Lock:
SET resource_lock_name some_random_value NX PX <expiration>
How to set/release the Lock?
Set The Lock:
SET resource_lock_name some_random_value NX PX <expiration>
Release The Lock:
if redis.call("get",KEYS[1]) == ARGV[1] then
return redis.call("del",KEYS[1])
else
return 0
end
Source and More Information: https://redis.io/topics/distlock
How to set/release the Lock?
Redis Strengths for the Solution
Atomic Operations Powerful Data Structures
Results
Low downtime for
a connection
Increase reliability for
our integrations
Increase resilience to
failures in our systems
Lessons Learned
1st Use case Lessons Learned
● Lack of multi DC support:
○ We replicate all writes which might cause
consistency problems
Application
DATACENTER 1 DATACENTER 2
2nd Use case Lessons Learned
● Persistence Might Slow Down Redis
Main Memory Access Send 2KB Over Commodity
Network
Read Sequentially 1MB from
SSD
100 ns 900 ns 400 µs
Source: https://people.eecs.berkeley.edu/~rcs/research/interactive_latency.html
Date reference 2010-2012
Architecture Setup Mistake (do not do this)
Master
KeepAliveD
Slave
KeepAliveD
Virtual IP
Platform
Instance
writes
Master Failure Expected Scenario
Down
KeepAliveD
Slave
KeepAliveD
Virtual IP
Platform
Instance
writes
Master
KeepAliveD
Slave
KeepAliveD
Virtual IP
Platform
Instance
writes
Failure Expected Scenario
Slave
KeepAliveD
Master
KeepAliveD
Virtual IP
Platform
Instance
writes
What really happened
Master
KeepAliveD
Slave
KeepAliveD
Virtual IP
Platform
Instance
writes
● The old master goes up
assuming as master and
synchronizing old
information
● We lost a huge amount data
● Causing overall
consistencies problems
Lesson Learned: Don't try to use
home-made solutions. Use Redis
Sentinel instead.
3rd Use case Lessons Learned
● Single point of failure
Platform
Platform
Platform
3rd Use case Lessons Learned
● Single point of failure
Platform
Platform
Platform
Delay
Slave
Solutions for These Problems: Use a more complex lock algorithm (e.g. RedLock)
● Not very suitable for high throughput locks
Platform
Platform
Platform
Thank you!
Questions?
luciano.sabenca@wavy.global
eiti.kimura@wavy.global
linkedin.com/in/eitikimura
linkedin.com/in/luciano-sabenca

More Related Content

PDF
DNS Made Easy Sales Brochure
PDF
Zombie DNS
PDF
Hostingultraso com (denmark)
PDF
Hostingultraso com dedicated-server_denmark
PDF
Dedicated server brisbane
PPTX
Cyber-Security Product
PDF
The road to clustered data ontap.
PDF
Dedicated server calgary
DNS Made Easy Sales Brochure
Zombie DNS
Hostingultraso com (denmark)
Hostingultraso com dedicated-server_denmark
Dedicated server brisbane
Cyber-Security Product
The road to clustered data ontap.
Dedicated server calgary

What's hot (10)

PDF
Experience Using RIR Whois
PPTX
Buying Smart: PC, Hardware, & Telecom - MNA SuperConf2009
PPSX
Network Repairs Power Point Presentation2
PDF
Dedicated server in belgrade
PPT
Capstone Powerpoint
PPTX
Network Repairs Power Point Presentation
PDF
DASH7 Technical Overview Webinar
PPT
Capstone Presentation For Five Rivers Medical Centers
PDF
Czech Republic Dedicated Server
PDF
Node4 Managed Hosting
Experience Using RIR Whois
Buying Smart: PC, Hardware, & Telecom - MNA SuperConf2009
Network Repairs Power Point Presentation2
Dedicated server in belgrade
Capstone Powerpoint
Network Repairs Power Point Presentation
DASH7 Technical Overview Webinar
Capstone Presentation For Five Rivers Medical Centers
Czech Republic Dedicated Server
Node4 Managed Hosting
Ad

Similar to [Redis conf18] The Versatility of Redis (20)

PDF
Redis as a Cache Boosting Performance and Scalability
PPT
New York REDIS Meetup Welcome Session
PDF
Redis Everywhere - Sunshine PHP
PPTX
Add Redis to Postgres to Make Your Microservices Go Boom!
PDF
Redis everywhere - PHP London
PPTX
Redis meetup
PPTX
Microservices - Is it time to breakup?
PPTX
Introduction to Redis and its features.pptx
PPTX
Introduction to Redis
KEY
Redis overview for Software Architecture Forum
PDF
Mini-Training: Redis
PDF
Redis - The Universal NoSQL Tool
PPTX
What's new with enterprise Redis - Leena Joshi, Redis Labs
PPTX
Redis Labcamp
PPTX
Get more than a cache back! - ConFoo Montreal
PDF
Speed up your Symfony2 application and build awesome features with Redis
PPTX
Redis and it's data types
PPTX
Big Data Day LA 2016/ NoSQL track - Analytics at the Speed of Light with Redi...
PDF
PostgreSQL and Redis - talk at pgcon 2013
PPTX
Redis Labs and SQL Server
Redis as a Cache Boosting Performance and Scalability
New York REDIS Meetup Welcome Session
Redis Everywhere - Sunshine PHP
Add Redis to Postgres to Make Your Microservices Go Boom!
Redis everywhere - PHP London
Redis meetup
Microservices - Is it time to breakup?
Introduction to Redis and its features.pptx
Introduction to Redis
Redis overview for Software Architecture Forum
Mini-Training: Redis
Redis - The Universal NoSQL Tool
What's new with enterprise Redis - Leena Joshi, Redis Labs
Redis Labcamp
Get more than a cache back! - ConFoo Montreal
Speed up your Symfony2 application and build awesome features with Redis
Redis and it's data types
Big Data Day LA 2016/ NoSQL track - Analytics at the Speed of Light with Redi...
PostgreSQL and Redis - talk at pgcon 2013
Redis Labs and SQL Server
Ad

More from Eiti Kimura (12)

PDF
[Datafest 2018] Apache Spark Structured Stream - Moedor de dados em tempo qua...
PDF
[DEVFEST] Apache Spark Casos de Uso e Escalabilidade
PDF
[DataFest-2017] Apache Cassandra Para Sistemas de Alto Desempenho
PDF
[TDC2016] Apache SparkMLlib: Machine Learning na Prática
PDF
[TDC2016] Apache Cassandra Estratégias de Modelagem de Dados
PDF
QConSP16 - Apache Cassandra Evoluindo Sistemas Distribuídos
PPTX
SP Big Data Meetup - Conhecendo Apache Cassandra @Movile
PDF
Cassandra Summit 2015 - A Change of Seasons
PDF
TDC2015 - Apache Cassandra no Desenvolvimento de Sistemas de Alto Desempenho
PDF
Conhecendo Apache Cassandra @Movile
PDF
Cassandra overview: Um Caso Prático
PDF
QConSP 2014 - Cassandra no Desenvolvimento de Aplicações para serviços Móveis
[Datafest 2018] Apache Spark Structured Stream - Moedor de dados em tempo qua...
[DEVFEST] Apache Spark Casos de Uso e Escalabilidade
[DataFest-2017] Apache Cassandra Para Sistemas de Alto Desempenho
[TDC2016] Apache SparkMLlib: Machine Learning na Prática
[TDC2016] Apache Cassandra Estratégias de Modelagem de Dados
QConSP16 - Apache Cassandra Evoluindo Sistemas Distribuídos
SP Big Data Meetup - Conhecendo Apache Cassandra @Movile
Cassandra Summit 2015 - A Change of Seasons
TDC2015 - Apache Cassandra no Desenvolvimento de Sistemas de Alto Desempenho
Conhecendo Apache Cassandra @Movile
Cassandra overview: Um Caso Prático
QConSP 2014 - Cassandra no Desenvolvimento de Aplicações para serviços Móveis

Recently uploaded (20)

PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Review of recent advances in non-invasive hemoglobin estimation
PPTX
Cloud computing and distributed systems.
PPT
Teaching material agriculture food technology
DOCX
The AUB Centre for AI in Media Proposal.docx
PPTX
Big Data Technologies - Introduction.pptx
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
Unlocking AI with Model Context Protocol (MCP)
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Building Integrated photovoltaic BIPV_UPV.pdf
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Review of recent advances in non-invasive hemoglobin estimation
Cloud computing and distributed systems.
Teaching material agriculture food technology
The AUB Centre for AI in Media Proposal.docx
Big Data Technologies - Introduction.pptx
Chapter 3 Spatial Domain Image Processing.pdf
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Dropbox Q2 2025 Financial Results & Investor Presentation
Diabetes mellitus diagnosis method based random forest with bat algorithm
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
Understanding_Digital_Forensics_Presentation.pptx
Agricultural_Statistics_at_a_Glance_2022_0.pdf
20250228 LYD VKU AI Blended-Learning.pptx

[Redis conf18] The Versatility of Redis

  • 1. The Versatility of Redis Powering our critical business using Redis Luciano Sabença Eiti Kimura
  • 2. ABOUT US ● Software Engineer at Movile/Wavy ● Developer and architect of distributed systems ● Main interest areas are: Computer Theory, Machine Learning and Distributed System. ● BS degree with praise in Computer Science by University of Campinas. Luciano Sabença lucianosabenca
  • 3. ABOUT US ● IT Coordinator and Software Architect at Movile ● Msc. in Electrical Engineering ● Apache Cassandra MVP (2014/2015 and 2015/2016) ● Apache Cassandra Contributor (2015) ● Cassandra Summit Speaker (2014 and 2015) ● Strata Hadoop World Singapore Speaker (2016) ● Spark Summit Speaker (2017) Eiti Kimura eitikimura
  • 4. Movile is the company behind several apps that makes the life easier WE MAKE LIFE BETTER THROUGH OUR APPS
  • 5. is a Movile company
  • 7. BALANCE INFORMATION Account: X3254 Balance: $1,564.20 100852 A deposit of $95.00 was made to your account on April 23th at 7:59pm. Your balance is: $1,659.20. Text STOP to cancel or HELP for more information.
  • 9. PLAYKIDS 685-63 You have opted to subscribe for Play Kids access fo $14,99/mo. Reply YES to confirm. Text STOP to cancel or HELP for more info.
  • 10. PLAYKIDS 685-63 You have opted to subscribe for Play Kids access fo $14,99/mo. Reply YES to confirm. Text STOP to cancel or HELP for more info. YES You successfully subscribed to PK. Download the app: http://bit.ly/pp and enter this validation code: 528-985-963 to access.
  • 12. AGENDA ● What/Why Redis? ● 1st Using Redis as Database ● 2nd Traditional Cache Usage ● 3rd A Distributed Lock case ● Lessons Learned / Pros & Cons
  • 13. WHAT IS REDIS ? ● Redis is what is called a key-value store often referred to as a NoSQL database ● It can handle concurrency problems very well ● Records can be set to expire after sometime ● It can be used in several different applications
  • 14. WHY REDIS ? ● Most Redis Operations are atomic! ○ No need for external synchronization! ● Redis Async Replication is fast and makes Redis reliable! ● All dataset is in memory: fast access! ● Data persistence: Durability!
  • 15. 1st Use Case How about to try Redis as a Database?
  • 16. 1st Use Case Intro Exploring the Redis feature as a datastore we are using in this case as a distributed database for our blacklist datalayer service. 60 million phone numbers > 1 billion requests/mo latency < 5ms
  • 17. Blacklist Usage by Our Services Messaging Platform BLACKLIST DATABASE LAYER check PLAY KIDS 685-63
  • 18. Blacklist Usage by Our Services Messaging Platform BLACKLIST DATABASE LAYER check PLAY KIDS You have opted to subscribe for Play Kids access fo $14,99/mo. Reply YES to confirm. 685-63
  • 19. Blacklist Usage by Our Services Billing Platform BLACKLIST DATABASE LAYER check YES 685-63 PLAY KIDS You have opted to subscribe for Play Kids access fo $14,99/mo. Reply YES to confirm.
  • 20. Blacklist Usage by Our Services Subscription Platform BLACKLIST DATABASE LAYER check YES You successfully subscribed to PK. Enter this validation code: 528-985-963 685-63 PLAY KIDS You have opted to subscribe for Play Kids access fo $14,99/mo. Reply YES to confirm.
  • 21. Blacklist Usage by Our Services Subscription Platform Billing Platform Messaging Platform BLACKLIST DATABASE LAYER check check check 685-63 YES You successfully subscribed to PK. Enter this validation code: 528-985-963 685-63 PLAY KIDS You have opted to subscribe for Play Kids access fo $14,99/mo. Reply YES to confirm.
  • 22. Blacklist Usage by Our Services Web Pages Marketplaces Broadcast Applications Third-Party Applications Mobile Apps
  • 23. Blacklist Usage by Our Services Subscription Platform Billing Platform Messaging Platform BLACKLIST DATABASE LAYER Web Pages Marketplaces Broadcast Applications Third-Party Applications Mobile Apps charge subscribe subscribe charge send SMS send message broadcast check check check APPLICATION LAYER SERVICE LAYER
  • 26. Old Architecture - Failure ● Large amount of memory being used (~5GB/instance) ● High frequency of GC pauses ● General low performance noticed ● No more memory available (scale up limitation)
  • 27. New Architecture using Redis as Main Database
  • 28. New Architecture using Redis as Main Database
  • 29. Redis Advantages for the New Architecture Solution Configurable Persistence Configurable Replication Strategies Fast In-memory data access
  • 30. Redis Architecture Setup Application Application Application Application Application Application DATACENTER 1 DATACENTER 2 Read data Write data
  • 31. Results ● We saved more than 100 GB of memory ● Saved thousands Dollars in memory ● Distributed Data reliability High message throughput High scalability Low costs Low latency and business impact
  • 32. 2nd Use Case Using Redis as a Cache for Distributed Systems
  • 33. 2nd Use Case Intro One of the most common Redis usages is as a cache. A well known case to use in our solution to provide fast access to our high performance services. > 160 million records essential for the high throughput of our platforms direct impact in company's revenue
  • 34. By the way what is a Grey list concept? We create a score to our users based on the product it is subscribed, it intent to classify the user as a good customer. Phone Number: + 55 19 0000 1111 Score: 0,8 Phone Number: + 55 19 2323 0101 Score: 0,2 Phone Number: + 55 19 0202 0000 Score: 0,4 Phone Number: + 55 19 4242 9090 Score: 0,1 GREYLIST DATA LAYER
  • 35. By the way what is a Greylist concept? Would you like to receive Sports News for your location $2,99/week. Reply YES to confirm. 685-63 Media Partner
  • 36. By the way what is a Greylist concept? Would you like to receive Sports News for your location $2,99/week. Reply YES to confirm. YES 685-63 Subscription Platform Greylist Service Layer
  • 37. By the way what is a Greylist concept? Would you like to receive Sports News for your location $2,99/week. Reply YES to confirm. YES 685-63 Subscription Platform Greylist Service Layer SORRY service unavailable for your phone number. Congratulations now you are subscribed to receive Sports News for your location. Text STOP to cancel. YES SCORE > 0,5NO
  • 38. By the way what is a Greylist concept? Would you like to receive Sports News for your location $2,99/week. Reply YES to confirm. YES SORRY service unavailable for your phone number. 685-63 Greylist Service Layer SORRY service unavailable for your phone number. Congratulations now you are subscribed to receive Sports News for your location. Text STOP to cancel. YES SCORE > 0,5NO
  • 39. By the way what is a Greylist concept? Would you like to receive Sports News for your location $2,99/week. Reply YES to confirm. YES SORRY service unavailable for your phone number. 685-63 Subscription Platform Greylist Service Layer SORRY service unavailable for your phone number. Media Partner Congratulations now you are subscribed to receive Sports News for your location. Text STOP to cancel. YES NO SCORE > 0,5
  • 41. Redis In the Solution ● We disabled Redis persistence and reached write rate over 300k/second. ● Peak of 400k writes/second ● Redis response is below ms. ● We have no impact in our subscription flow
  • 42. Results ● Blocked more than 1MM subscriptions from bad payers users. ● Saved around U$60k in media in a few months. ● Block Rate > 40% for some campaigns.
  • 43. 3rd Use Case Have you tried to orchestrate a distributed system?
  • 44. 3rd Use Case Intro Exploring Redis as an orchestrator for our distributed systems managing SMPP connections Stateful connection with limited number of binds A connection can be consumed by more than one instance We should be capable of load balancing the connections
  • 45. Normal Scenario Platform Instance Platform Instance Mobile Carrier SMPP / BIND 1 SMPP / BIND 2 WAVY DATACENTERS INTERNET
  • 46. Failure Scenario Platform Instance Platform Instance Mobile Carrier SMPP / BIND 1 SMPP / BIND 2 WAVY DATACENTERS INTERNET
  • 47. Expected Scenario Platform Instance Platform Instance Mobile Carrier SMPP / BIND 1 SMPP / BIND 2 WAVY DATACENTERS INTERNET
  • 48. Solution Scenario Platform Instance Platform Instance Mobile Carrier SMPP / BIND 1 SMPP / BIND 2 WAVY DATACENTERS INTERNET
  • 49. Components trying to acquire a lock
  • 50. Set The Lock: SET resource_lock_name some_random_value NX PX <expiration> How to set/release the Lock?
  • 51. Set The Lock: SET resource_lock_name some_random_value NX PX <expiration> Release The Lock: if redis.call("get",KEYS[1]) == ARGV[1] then return redis.call("del",KEYS[1]) else return 0 end Source and More Information: https://redis.io/topics/distlock How to set/release the Lock?
  • 52. Redis Strengths for the Solution Atomic Operations Powerful Data Structures
  • 53. Results Low downtime for a connection Increase reliability for our integrations Increase resilience to failures in our systems
  • 55. 1st Use case Lessons Learned ● Lack of multi DC support: ○ We replicate all writes which might cause consistency problems Application DATACENTER 1 DATACENTER 2
  • 56. 2nd Use case Lessons Learned ● Persistence Might Slow Down Redis Main Memory Access Send 2KB Over Commodity Network Read Sequentially 1MB from SSD 100 ns 900 ns 400 µs Source: https://people.eecs.berkeley.edu/~rcs/research/interactive_latency.html Date reference 2010-2012
  • 57. Architecture Setup Mistake (do not do this) Master KeepAliveD Slave KeepAliveD Virtual IP Platform Instance writes
  • 58. Master Failure Expected Scenario Down KeepAliveD Slave KeepAliveD Virtual IP Platform Instance writes Master KeepAliveD Slave KeepAliveD Virtual IP Platform Instance writes
  • 60. What really happened Master KeepAliveD Slave KeepAliveD Virtual IP Platform Instance writes ● The old master goes up assuming as master and synchronizing old information ● We lost a huge amount data ● Causing overall consistencies problems Lesson Learned: Don't try to use home-made solutions. Use Redis Sentinel instead.
  • 61. 3rd Use case Lessons Learned ● Single point of failure Platform Platform Platform
  • 62. 3rd Use case Lessons Learned ● Single point of failure Platform Platform Platform Delay Slave Solutions for These Problems: Use a more complex lock algorithm (e.g. RedLock) ● Not very suitable for high throughput locks Platform Platform Platform