SlideShare ist ein Scribd-Unternehmen logo
1 von 48
Downloaden Sie, um offline zu lesen
How you
can benefit
from using

Redis

javier ramirez
@supercoco9
I was
Lois Lane

javier ramirez

@supercoco9

https://teowaki.com

FOSDEM 2014
In the beginner's
mind there are many
possibilities, in the
expert's mind there
are few.
Shunryu Suzuki
javier ramirez

@supercoco9

https://teowaki.com

FOSDEM 2014
myth: the bottleneck

javier ramirez

@supercoco9

https://teowaki.com

FOSDEM 2014
redis-benchmark -r 1000000 -n 2000000 -t get,set,lpush,lpop,mset -P 16 -q
On my laptop:

SET: 513610 requests per second
GET: 641436 requests per second
LPUSH: 845665 requests per second
LPOP: 783392 requests per second
MSET (10 keys): 89988 requests per second
On a small digital ocean server ($5/month)
SET: 227816 requests per second
GET: 228258 requests per second
LPUSH: 251098 requests per second
LPOP: 251572 requests per second
MSET (10 keys): 43918 requests per second

javier ramirez

@supercoco9

https://teowaki.com

FOSDEM 2014
myth: Redis is just like
memcached

javier ramirez

@supercoco9

https://teowaki.com

FOSDEM 2014
myth: Redis is for queues

javier ramirez

@supercoco9

https://teowaki.com

FOSDEM 2014
open source, BSD licensed, advanced
key-value store. It is often referred to as a
data structure server since keys can contain
strings, hashes, lists, sets and sorted sets.
http://redis.io
started in 2009 by Salvatore Sanfilippo @antirez
104 contributors at

https://github.com/antirez/redis
javier ramirez

@supercoco9

https://teowaki.com

FOSDEM 2014
The Redis Manifesto

1.A DSL for Abstract Data Types
2.Memory storage is #1

3.Fundamental data structures for a
fundamental API
4.Two levels of API

5.Code is like a poem; it's not just something
we write to reach some practical result
6.We're against complexity
7.We optimize for joy
javier ramirez

@supercoco9

https://teowaki.com

FOSDEM 2014
Redis makes
you think
javier ramirez

@supercoco9

https://teowaki.com

FOSDEM 2014
Redis data types
Strings
Hashes
Lists
Sets
Sorted Sets
javier ramirez

@supercoco9

https://teowaki.com

FOSDEM 2014
basic commands
Setting/getting/deleting/expiring
Increment/decrement
Pushing/popping
Checking membership, size...

javier ramirez

@supercoco9

https://teowaki.com

FOSDEM 2014
much cooler commands
Setting only if exists
Blocking pop
(Blocking) pop from one list, push to another
Get/set string ranges (and bit operations)
Set intersections/diffs (and store)
Pub/sub
javier ramirez

@supercoco9

https://teowaki.com

FOSDEM 2014
A chat in 6 lines of code
r=Redis.new driver: :hiredis
r.subscribe “chatrooms:42” do |on|
on.message do |topic, msg|
puts “#{topic}: #{msg}”
end
end

r.publish “chatrooms:42”, “Hello Fosdem”

javier ramirez

@supercoco9

https://teowaki.com

FOSDEM 2014
atomicity
single threaded, so no
concurrency problems
transactions and lua
scripts to run multiple
operations atomically

javier ramirez

@supercoco9

https://teowaki.com

FOSDEM 2014
Scripting with lua
You can use Lua for scripting Redis when you need to
atomically execute a sequence of commands in which
the output of a command is used as input for another
It reduces the need to use complex lock mechanisms
and simplifies dependencies between clients
You can even extend the functionality of Redis by using
Lua scripts

javier ramirez

@supercoco9

https://teowaki.com

FOSDEM 2014
Redis keeps
everything
in memory
all the time
javier ramirez

@supercoco9

https://teowaki.com

FOSDEM 2014
Persistance: RDB
Compact binary format
Saves snapshots every few minutes
Good for backups and synchronizing
If Redis crashes, a few minutes worth of
data will be lost

javier ramirez

@supercoco9

https://teowaki.com

FOSDEM 2014
Durability: AOF
Log text format
Configurable durability
Large file, can slow down startup
If Redis crashes, typically one second of
data could be lost

javier ramirez

@supercoco9

https://teowaki.com

FOSDEM 2014
replication & scaling out
one master, several
read-only slaves
sharding
Twemproxy & redis cluster
javier ramirez

@supercoco9

https://teowaki.com

FOSDEM 2014
what's being used for

javier ramirez

@supercoco9

https://teowaki.com

FOSDEM 2014
twitter
Every time line (800 tweets
per user) is on redis
5000 writes per second avg
300K reads per second
javier ramirez

@supercoco9

https://teowaki.com

FOSDEM 2014
twitter

write API (from browser or client app)
follo
e per
on

user id

tweet id

wer

fanout (flockDB)

metadata
rpushx to Redis

user info from
gizmoduck
(memcached)

javier ramirez

@supercoco9

tweet info from
tweetypie
(memcached + mysql)

https://teowaki.com

your twitter
timeline

FOSDEM 2014
World Of Warcraft
Blizzard is quite secretive about it
Known to have at least 8 servers with 64Gb each to
serve user avatars
Known to have seen 1.000.000 users concurrently in
the Asian version of the game

javier ramirez

@supercoco9

https://teowaki.com

FOSDEM 2014
pinterest object graph
per user
Redis SortedSet, with timestamp as the score to
store the users followed explicitly
store the users followed implicitly
store the user’s explicit followers
store the user’s implicit followers
store boards followed explicitly
Redis set to store boards unfollowed explicitly
per board
Redis Hash to store a board’s explicit followers
Redis Set to store a board’s explicit unfollowers
javier ramirez

@supercoco9

https://teowaki.com

FOSDEM 2014
viacom
Object dependency graph. Cache on steroids
Redis as a queue for background jobs
Activity tracking and view counts buffering before saving
to mysql
Lua script working on a slave to recalculate ranking and
popularity of contents, then send the data to master.
The new process takes 1/60th less than the old one in
mysql

javier ramirez

@supercoco9

https://teowaki.com

FOSDEM 2014
stack overflow
Three level cache:

local cache (no persistence)

sessions, and pending view count updates

site cache

hot question id lists, user acceptance rates...

global cache (separate Redis DB)
Inboxes, API usage quotas...

javier ramirez

@supercoco9

https://teowaki.com

FOSDEM 2014
youporn
Most data is found in hashes with ordered sets used to
know what data to show.
zInterStore on: videos:filters:released,
Videos:filters:orientation:straight,Videos:filters:categorie
s:{category_id}, Videos:ordering:rating
Then perform a zRange to get the pages we want and
get the list of video_ids back.
Then start a pipeline and get all the videos from hashes.
javier ramirez

@supercoco9

https://teowaki.com

FOSDEM 2014
github
Git as a service internally. Redis is used for
storing routing info matching user
repositories to server names

hipchat
Redis for caching. Information like which
users are in which rooms, presence
information, who is online, etc, so it doesn’t
matter which XMPP server you connect to.
javier ramirez

@supercoco9

https://teowaki.com

FOSDEM 2014
when things go wrong

javier ramirez

@supercoco9

https://teowaki.com

FOSDEM 2014
the instagram case
moving from redis to
cassandra: 75% savings on
servers
lesson learnt:
know when redis is not appropriate
javier ramirez

@supercoco9

https://teowaki.com

FOSDEM 2014
the twilio case
credit card hell

lesson learnt:
know what you are doing.
Don't change config on the fly
javier ramirez

@supercoco9

https://teowaki.com

FOSDEM 2014
Numbers can be scary
Twitter: 2TB RAM for Redis on its own servers
Blizzard: At least 8 servers with 64Gb each
Pinteres:t 110 Redis instances
Instagram: 1.2 TB of data

javier ramirez

@supercoco9

https://teowaki.com

FOSDEM 2014
openredis
redis as a service on AWS
serving over 1000
customers with a single
machine
javier ramirez

@supercoco9

https://teowaki.com

FOSDEM 2014
how teowaki is using redis

javier ramirez

@supercoco9

https://teowaki.com

FOSDEM 2014
Abusing sidekiq/resque
keep track of every activity in the system, even if you
don't need them all right now:
- every page view
- every API request
- every time a record is created/updated/deleted
benefits:
- highly decoupled system
- easier to divide into services
- you can add behaviour without changing your app
javier ramirez

@supercoco9

https://teowaki.com

FOSDEM 2014
intermediate cache
* As a very fast lightweight storage for analytics data before
sending them to our google bigquery based solution
* As a cache for attributes frequently looked up in join tables
(names, nicknames, guids, delegated or included
model names...)

javier ramirez

@supercoco9

https://teowaki.com

FOSDEM 2014
Some of our uses of Lua
Expiring attributes inside a Redis hash
Inserting notifications into a list only if there are not
pending notifications from the same user for the
same scope
Paginating a list by an attribute
Manipulating JSON directly at the Redis layer

javier ramirez

@supercoco9

https://teowaki.com

FOSDEM 2014
counters
Atomic counters can be safely invoked concurrently
from anywhere, so you can implement “like”
features, global sequences or usage monitoring
systems in highly concurrent applications for free.
You can share your counters with any other internal
application and still be sure they won't collide.

javier ramirez

@supercoco9

https://teowaki.com

FOSDEM 2014
Temporary data
Redis allows us to self expire keys after a time has
passed. You can use this mechanism for a simple
cache
If you operate on a key with expiration time, you
can change its value and still keep the expiration
going. By combining a decrementing counter with
an expiration time, implementing usage quotas is
trivial
Also, you can inspect which keys you have in your
server efficiently using SCAN commands
javier ramirez

@supercoco9

https://teowaki.com

FOSDEM 2014
nginx + lua + redis
apache + mruby + redis
Multiple levels of cache by using Redis on the webserver/
middleware layer
http://wiki.nginx.org/HttpRedis

javier ramirez

@supercoco9

https://teowaki.com

FOSDEM 2014
summarizing
* Redis is more powerful than it seems
* Very fast, easy to use, simple, good documentation
* In-memory data structures, distributed, shared and persisted
* Good as data store, intermediate data store, cache or queue
* Lots of use cases, both in huge and smaller systems

You should probably use it a lot more

javier ramirez

@supercoco9

https://teowaki.com

FOSDEM 2014
Find related links at
https://teowaki.com/teams/javier-community/link-categories/redis

Dank u.
Merci.
If you enjoyed this talk, please sign up for
https://teowaki.com

Javier Ramírez
@supercoco9
FOSDEM 2014

Weitere ähnliche Inhalte

Was ist angesagt?

Securing Apache Web Servers
Securing Apache Web ServersSecuring Apache Web Servers
Securing Apache Web Serverswebhostingguy
 
Drupal Efficiency - Coding, Deployment, Scaling
Drupal Efficiency - Coding, Deployment, ScalingDrupal Efficiency - Coding, Deployment, Scaling
Drupal Efficiency - Coding, Deployment, Scalingsmattoon
 
Real World Lessons on the Pain Points of Node.js Applications
Real World Lessons on the Pain Points of Node.js ApplicationsReal World Lessons on the Pain Points of Node.js Applications
Real World Lessons on the Pain Points of Node.js ApplicationsBen Hall
 
Presentation iv implementasi 802x eap tls peap mscha pv2
Presentation iv implementasi  802x eap tls peap mscha pv2Presentation iv implementasi  802x eap tls peap mscha pv2
Presentation iv implementasi 802x eap tls peap mscha pv2Hell19
 
Site Performance - From Pinto to Ferrari
Site Performance - From Pinto to FerrariSite Performance - From Pinto to Ferrari
Site Performance - From Pinto to FerrariJoseph Scott
 
WAF Bypass Techniques - Using HTTP Standard and Web Servers’ Behaviour
WAF Bypass Techniques - Using HTTP Standard and Web Servers’ BehaviourWAF Bypass Techniques - Using HTTP Standard and Web Servers’ Behaviour
WAF Bypass Techniques - Using HTTP Standard and Web Servers’ BehaviourSoroush Dalili
 
Lessons from running potentially malicious code inside containers
Lessons from running potentially malicious code inside containersLessons from running potentially malicious code inside containers
Lessons from running potentially malicious code inside containersBen Hall
 
RIPE 71 and IETF 94 reports webinar
RIPE 71 and IETF 94 reports webinarRIPE 71 and IETF 94 reports webinar
RIPE 71 and IETF 94 reports webinarMen and Mice
 
Pandora FMS: Raven DB Plugin
Pandora FMS: Raven DB PluginPandora FMS: Raven DB Plugin
Pandora FMS: Raven DB PluginPandora FMS
 
BIND 9 logging best practices
BIND 9 logging best practicesBIND 9 logging best practices
BIND 9 logging best practicesMen and Mice
 
Apache Wizardry - Ohio Linux 2011
Apache Wizardry - Ohio Linux 2011Apache Wizardry - Ohio Linux 2011
Apache Wizardry - Ohio Linux 2011Rich Bowen
 
Keeping DNS server up-and-running with “runit
Keeping DNS server up-and-running with “runitKeeping DNS server up-and-running with “runit
Keeping DNS server up-and-running with “runitMen and Mice
 
Kea DHCP – the new open source DHCP server from ISC
Kea DHCP – the new open source DHCP server from ISCKea DHCP – the new open source DHCP server from ISC
Kea DHCP – the new open source DHCP server from ISCMen and Mice
 
Nginx 0.8.x + php 5.2.13 (fast cgi) setup web server
Nginx 0.8.x + php 5.2.13 (fast cgi) setup web serverNginx 0.8.x + php 5.2.13 (fast cgi) setup web server
Nginx 0.8.x + php 5.2.13 (fast cgi) setup web serverwruben
 
What is new in BIND 9.11?
What is new in BIND 9.11?What is new in BIND 9.11?
What is new in BIND 9.11?Men and Mice
 
Roy foubister (hosting high traffic sites on a tight budget)
Roy foubister (hosting high traffic sites on a tight budget)Roy foubister (hosting high traffic sites on a tight budget)
Roy foubister (hosting high traffic sites on a tight budget)WordCamp Cape Town
 

Was ist angesagt? (20)

Securing Apache Web Servers
Securing Apache Web ServersSecuring Apache Web Servers
Securing Apache Web Servers
 
Installing lemp with ssl and varnish on Debian 9
Installing lemp with ssl and varnish on Debian 9Installing lemp with ssl and varnish on Debian 9
Installing lemp with ssl and varnish on Debian 9
 
Drupal Efficiency - Coding, Deployment, Scaling
Drupal Efficiency - Coding, Deployment, ScalingDrupal Efficiency - Coding, Deployment, Scaling
Drupal Efficiency - Coding, Deployment, Scaling
 
Alfresco tuning part1
Alfresco tuning part1Alfresco tuning part1
Alfresco tuning part1
 
Real World Lessons on the Pain Points of Node.js Applications
Real World Lessons on the Pain Points of Node.js ApplicationsReal World Lessons on the Pain Points of Node.js Applications
Real World Lessons on the Pain Points of Node.js Applications
 
Performance_Up.ppt
Performance_Up.pptPerformance_Up.ppt
Performance_Up.ppt
 
Presentation iv implementasi 802x eap tls peap mscha pv2
Presentation iv implementasi  802x eap tls peap mscha pv2Presentation iv implementasi  802x eap tls peap mscha pv2
Presentation iv implementasi 802x eap tls peap mscha pv2
 
Site Performance - From Pinto to Ferrari
Site Performance - From Pinto to FerrariSite Performance - From Pinto to Ferrari
Site Performance - From Pinto to Ferrari
 
WAF Bypass Techniques - Using HTTP Standard and Web Servers’ Behaviour
WAF Bypass Techniques - Using HTTP Standard and Web Servers’ BehaviourWAF Bypass Techniques - Using HTTP Standard and Web Servers’ Behaviour
WAF Bypass Techniques - Using HTTP Standard and Web Servers’ Behaviour
 
Lessons from running potentially malicious code inside containers
Lessons from running potentially malicious code inside containersLessons from running potentially malicious code inside containers
Lessons from running potentially malicious code inside containers
 
RIPE 71 and IETF 94 reports webinar
RIPE 71 and IETF 94 reports webinarRIPE 71 and IETF 94 reports webinar
RIPE 71 and IETF 94 reports webinar
 
Pandora FMS: Raven DB Plugin
Pandora FMS: Raven DB PluginPandora FMS: Raven DB Plugin
Pandora FMS: Raven DB Plugin
 
BIND 9 logging best practices
BIND 9 logging best practicesBIND 9 logging best practices
BIND 9 logging best practices
 
Apache Wizardry - Ohio Linux 2011
Apache Wizardry - Ohio Linux 2011Apache Wizardry - Ohio Linux 2011
Apache Wizardry - Ohio Linux 2011
 
Keeping DNS server up-and-running with “runit
Keeping DNS server up-and-running with “runitKeeping DNS server up-and-running with “runit
Keeping DNS server up-and-running with “runit
 
Kea DHCP – the new open source DHCP server from ISC
Kea DHCP – the new open source DHCP server from ISCKea DHCP – the new open source DHCP server from ISC
Kea DHCP – the new open source DHCP server from ISC
 
DNSTap Webinar
DNSTap WebinarDNSTap Webinar
DNSTap Webinar
 
Nginx 0.8.x + php 5.2.13 (fast cgi) setup web server
Nginx 0.8.x + php 5.2.13 (fast cgi) setup web serverNginx 0.8.x + php 5.2.13 (fast cgi) setup web server
Nginx 0.8.x + php 5.2.13 (fast cgi) setup web server
 
What is new in BIND 9.11?
What is new in BIND 9.11?What is new in BIND 9.11?
What is new in BIND 9.11?
 
Roy foubister (hosting high traffic sites on a tight budget)
Roy foubister (hosting high traffic sites on a tight budget)Roy foubister (hosting high traffic sites on a tight budget)
Roy foubister (hosting high traffic sites on a tight budget)
 

Ähnlich wie Fosdem how you can benefit from redis, javier ramirez @ teowaki

Por que deberias haberle pedido redis a los reyes magos
Por que deberias haberle pedido redis a los reyes magosPor que deberias haberle pedido redis a los reyes magos
Por que deberias haberle pedido redis a los reyes magosjavier ramirez
 
API Analytics with Redis and Bigquery. NoSQLmatters Cologne '14 edition. Javi...
API Analytics with Redis and Bigquery. NoSQLmatters Cologne '14 edition. Javi...API Analytics with Redis and Bigquery. NoSQLmatters Cologne '14 edition. Javi...
API Analytics with Redis and Bigquery. NoSQLmatters Cologne '14 edition. Javi...javier ramirez
 
How you can benefit from using Redis. Javier Ramirez, teowaki, at Codemotion ...
How you can benefit from using Redis. Javier Ramirez, teowaki, at Codemotion ...How you can benefit from using Redis. Javier Ramirez, teowaki, at Codemotion ...
How you can benefit from using Redis. Javier Ramirez, teowaki, at Codemotion ...javier ramirez
 
Your Inner Sysadmin - MidwestPHP 2015
Your Inner Sysadmin - MidwestPHP 2015Your Inner Sysadmin - MidwestPHP 2015
Your Inner Sysadmin - MidwestPHP 2015Chris Tankersley
 
Your Inner Sysadmin - Tutorial (SunshinePHP 2015)
Your Inner Sysadmin - Tutorial (SunshinePHP 2015)Your Inner Sysadmin - Tutorial (SunshinePHP 2015)
Your Inner Sysadmin - Tutorial (SunshinePHP 2015)Chris Tankersley
 
Your Inner Sysadmin - LonestarPHP 2015
Your Inner Sysadmin - LonestarPHP 2015Your Inner Sysadmin - LonestarPHP 2015
Your Inner Sysadmin - LonestarPHP 2015Chris Tankersley
 
api analytics redis bigquery. Lrug
api analytics redis bigquery. Lrugapi analytics redis bigquery. Lrug
api analytics redis bigquery. Lrugjavier ramirez
 
Drupal Efficiency using open source technologies from Sun
Drupal Efficiency using open source technologies from SunDrupal Efficiency using open source technologies from Sun
Drupal Efficiency using open source technologies from Sunsmattoon
 
Why Sun for Drupal?
Why Sun for Drupal?Why Sun for Drupal?
Why Sun for Drupal?smattoon
 
How to Build a High Performance Application Using Cloud Foundry and Redis (Cl...
How to Build a High Performance Application Using Cloud Foundry and Redis (Cl...How to Build a High Performance Application Using Cloud Foundry and Redis (Cl...
How to Build a High Performance Application Using Cloud Foundry and Redis (Cl...VMware Tanzu
 
API analytics with Redis and Google Bigquery. NoSQL matters edition
API analytics with Redis and Google Bigquery. NoSQL matters editionAPI analytics with Redis and Google Bigquery. NoSQL matters edition
API analytics with Redis and Google Bigquery. NoSQL matters editionjavier ramirez
 
Caching objects-in-memory
Caching objects-in-memoryCaching objects-in-memory
Caching objects-in-memoryMauro Cassani
 
Brian Bulkowski : what startups can learn from real-time bidding
Brian Bulkowski : what startups can learn from real-time biddingBrian Bulkowski : what startups can learn from real-time bidding
Brian Bulkowski : what startups can learn from real-time biddingAerospike
 
Scaleable PHP Applications in Kubernetes
Scaleable PHP Applications in KubernetesScaleable PHP Applications in Kubernetes
Scaleable PHP Applications in KubernetesRobert Lemke
 
Accelerating Analytics with EMR on your S3 Data Lake
Accelerating Analytics with EMR on your S3 Data LakeAccelerating Analytics with EMR on your S3 Data Lake
Accelerating Analytics with EMR on your S3 Data LakeAlluxio, Inc.
 
Big Data analytics with Nginx, Logstash, Redis, Google Bigquery and Neo4j, ja...
Big Data analytics with Nginx, Logstash, Redis, Google Bigquery and Neo4j, ja...Big Data analytics with Nginx, Logstash, Redis, Google Bigquery and Neo4j, ja...
Big Data analytics with Nginx, Logstash, Redis, Google Bigquery and Neo4j, ja...javier ramirez
 
Fun with ruby and redis, arrrrcamp edition, javier_ramirez, teowaki
Fun with ruby and redis, arrrrcamp edition, javier_ramirez, teowakiFun with ruby and redis, arrrrcamp edition, javier_ramirez, teowaki
Fun with ruby and redis, arrrrcamp edition, javier_ramirez, teowakijavier ramirez
 

Ähnlich wie Fosdem how you can benefit from redis, javier ramirez @ teowaki (20)

Por que deberias haberle pedido redis a los reyes magos
Por que deberias haberle pedido redis a los reyes magosPor que deberias haberle pedido redis a los reyes magos
Por que deberias haberle pedido redis a los reyes magos
 
API Analytics with Redis and Bigquery. NoSQLmatters Cologne '14 edition. Javi...
API Analytics with Redis and Bigquery. NoSQLmatters Cologne '14 edition. Javi...API Analytics with Redis and Bigquery. NoSQLmatters Cologne '14 edition. Javi...
API Analytics with Redis and Bigquery. NoSQLmatters Cologne '14 edition. Javi...
 
How you can benefit from using Redis. Javier Ramirez, teowaki, at Codemotion ...
How you can benefit from using Redis. Javier Ramirez, teowaki, at Codemotion ...How you can benefit from using Redis. Javier Ramirez, teowaki, at Codemotion ...
How you can benefit from using Redis. Javier Ramirez, teowaki, at Codemotion ...
 
Your Inner Sysadmin - MidwestPHP 2015
Your Inner Sysadmin - MidwestPHP 2015Your Inner Sysadmin - MidwestPHP 2015
Your Inner Sysadmin - MidwestPHP 2015
 
Your Inner Sysadmin - Tutorial (SunshinePHP 2015)
Your Inner Sysadmin - Tutorial (SunshinePHP 2015)Your Inner Sysadmin - Tutorial (SunshinePHP 2015)
Your Inner Sysadmin - Tutorial (SunshinePHP 2015)
 
Your Inner Sysadmin - LonestarPHP 2015
Your Inner Sysadmin - LonestarPHP 2015Your Inner Sysadmin - LonestarPHP 2015
Your Inner Sysadmin - LonestarPHP 2015
 
api analytics redis bigquery. Lrug
api analytics redis bigquery. Lrugapi analytics redis bigquery. Lrug
api analytics redis bigquery. Lrug
 
Drupal Efficiency using open source technologies from Sun
Drupal Efficiency using open source technologies from SunDrupal Efficiency using open source technologies from Sun
Drupal Efficiency using open source technologies from Sun
 
Why Sun for Drupal?
Why Sun for Drupal?Why Sun for Drupal?
Why Sun for Drupal?
 
How to Build a High Performance Application Using Cloud Foundry and Redis (Cl...
How to Build a High Performance Application Using Cloud Foundry and Redis (Cl...How to Build a High Performance Application Using Cloud Foundry and Redis (Cl...
How to Build a High Performance Application Using Cloud Foundry and Redis (Cl...
 
API analytics with Redis and Google Bigquery. NoSQL matters edition
API analytics with Redis and Google Bigquery. NoSQL matters editionAPI analytics with Redis and Google Bigquery. NoSQL matters edition
API analytics with Redis and Google Bigquery. NoSQL matters edition
 
Caching objects-in-memory
Caching objects-in-memoryCaching objects-in-memory
Caching objects-in-memory
 
Scaling PHP apps
Scaling PHP appsScaling PHP apps
Scaling PHP apps
 
Liberty Deep Dive
Liberty Deep DiveLiberty Deep Dive
Liberty Deep Dive
 
Brian Bulkowski : what startups can learn from real-time bidding
Brian Bulkowski : what startups can learn from real-time biddingBrian Bulkowski : what startups can learn from real-time bidding
Brian Bulkowski : what startups can learn from real-time bidding
 
Scaleable PHP Applications in Kubernetes
Scaleable PHP Applications in KubernetesScaleable PHP Applications in Kubernetes
Scaleable PHP Applications in Kubernetes
 
Accelerating Analytics with EMR on your S3 Data Lake
Accelerating Analytics with EMR on your S3 Data LakeAccelerating Analytics with EMR on your S3 Data Lake
Accelerating Analytics with EMR on your S3 Data Lake
 
Introduction to redis
Introduction to redisIntroduction to redis
Introduction to redis
 
Big Data analytics with Nginx, Logstash, Redis, Google Bigquery and Neo4j, ja...
Big Data analytics with Nginx, Logstash, Redis, Google Bigquery and Neo4j, ja...Big Data analytics with Nginx, Logstash, Redis, Google Bigquery and Neo4j, ja...
Big Data analytics with Nginx, Logstash, Redis, Google Bigquery and Neo4j, ja...
 
Fun with ruby and redis, arrrrcamp edition, javier_ramirez, teowaki
Fun with ruby and redis, arrrrcamp edition, javier_ramirez, teowakiFun with ruby and redis, arrrrcamp edition, javier_ramirez, teowaki
Fun with ruby and redis, arrrrcamp edition, javier_ramirez, teowaki
 

Mehr von javier ramirez

¿Se puede vivir del open source? T3chfest
¿Se puede vivir del open source? T3chfest¿Se puede vivir del open source? T3chfest
¿Se puede vivir del open source? T3chfestjavier ramirez
 
QuestDB: The building blocks of a fast open-source time-series database
QuestDB: The building blocks of a fast open-source time-series databaseQuestDB: The building blocks of a fast open-source time-series database
QuestDB: The building blocks of a fast open-source time-series databasejavier ramirez
 
Como creamos QuestDB Cloud, un SaaS basado en Kubernetes alrededor de QuestDB...
Como creamos QuestDB Cloud, un SaaS basado en Kubernetes alrededor de QuestDB...Como creamos QuestDB Cloud, un SaaS basado en Kubernetes alrededor de QuestDB...
Como creamos QuestDB Cloud, un SaaS basado en Kubernetes alrededor de QuestDB...javier ramirez
 
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
 
Deduplicating and analysing time-series data with Apache Beam and QuestDB
Deduplicating and analysing time-series data with Apache Beam and QuestDBDeduplicating and analysing time-series data with Apache Beam and QuestDB
Deduplicating and analysing time-series data with Apache Beam and QuestDBjavier ramirez
 
Your Database Cannot Do this (well)
Your Database Cannot Do this (well)Your Database Cannot Do this (well)
Your Database Cannot Do this (well)javier ramirez
 
Your Timestamps Deserve Better than a Generic Database
Your Timestamps Deserve Better than a Generic DatabaseYour Timestamps Deserve Better than a Generic Database
Your Timestamps Deserve Better than a Generic Databasejavier ramirez
 
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
 
QuestDB-Community-Call-20220728
QuestDB-Community-Call-20220728QuestDB-Community-Call-20220728
QuestDB-Community-Call-20220728javier ramirez
 
Processing and analysing streaming data with Python. Pycon Italy 2022
Processing and analysing streaming  data with Python. Pycon Italy 2022Processing and analysing streaming  data with Python. Pycon Italy 2022
Processing and analysing streaming data with Python. Pycon Italy 2022javier ramirez
 
QuestDB: ingesting a million time series per second on a single instance. Big...
QuestDB: ingesting a million time series per second on a single instance. Big...QuestDB: ingesting a million time series per second on a single instance. Big...
QuestDB: ingesting a million time series per second on a single instance. Big...javier ramirez
 
Servicios e infraestructura de AWS y la próxima región en Aragón
Servicios e infraestructura de AWS y la próxima región en AragónServicios e infraestructura de AWS y la próxima región en Aragón
Servicios e infraestructura de AWS y la próxima región en Aragónjavier ramirez
 
Primeros pasos en desarrollo serverless
Primeros pasos en desarrollo serverlessPrimeros pasos en desarrollo serverless
Primeros pasos en desarrollo serverlessjavier ramirez
 
How AWS is reinventing the cloud
How AWS is reinventing the cloudHow AWS is reinventing the cloud
How AWS is reinventing the cloudjavier ramirez
 
Analitica de datos en tiempo real con Apache Flink y Apache BEAM
Analitica de datos en tiempo real con Apache Flink y Apache BEAMAnalitica de datos en tiempo real con Apache Flink y Apache BEAM
Analitica de datos en tiempo real con Apache Flink y Apache BEAMjavier ramirez
 
Getting started with streaming analytics
Getting started with streaming analyticsGetting started with streaming analytics
Getting started with streaming analyticsjavier ramirez
 
Getting started with streaming analytics: Setting up a pipeline
Getting started with streaming analytics: Setting up a pipelineGetting started with streaming analytics: Setting up a pipeline
Getting started with streaming analytics: Setting up a pipelinejavier ramirez
 
Getting started with streaming analytics: Deep Dive
Getting started with streaming analytics: Deep DiveGetting started with streaming analytics: Deep Dive
Getting started with streaming analytics: Deep Divejavier ramirez
 
Getting started with streaming analytics: streaming basics (1 of 3)
Getting started with streaming analytics: streaming basics (1 of 3)Getting started with streaming analytics: streaming basics (1 of 3)
Getting started with streaming analytics: streaming basics (1 of 3)javier ramirez
 
Monitorización de seguridad y detección de amenazas con AWS
Monitorización de seguridad y detección de amenazas con AWSMonitorización de seguridad y detección de amenazas con AWS
Monitorización de seguridad y detección de amenazas con AWSjavier ramirez
 

Mehr von javier ramirez (20)

¿Se puede vivir del open source? T3chfest
¿Se puede vivir del open source? T3chfest¿Se puede vivir del open source? T3chfest
¿Se puede vivir del open source? T3chfest
 
QuestDB: The building blocks of a fast open-source time-series database
QuestDB: The building blocks of a fast open-source time-series databaseQuestDB: The building blocks of a fast open-source time-series database
QuestDB: The building blocks of a fast open-source time-series database
 
Como creamos QuestDB Cloud, un SaaS basado en Kubernetes alrededor de QuestDB...
Como creamos QuestDB Cloud, un SaaS basado en Kubernetes alrededor de QuestDB...Como creamos QuestDB Cloud, un SaaS basado en Kubernetes alrededor de QuestDB...
Como creamos QuestDB Cloud, un SaaS basado en Kubernetes alrededor de QuestDB...
 
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 ...
 
Deduplicating and analysing time-series data with Apache Beam and QuestDB
Deduplicating and analysing time-series data with Apache Beam and QuestDBDeduplicating and analysing time-series data with Apache Beam and QuestDB
Deduplicating and analysing time-series data with Apache Beam and QuestDB
 
Your Database Cannot Do this (well)
Your Database Cannot Do this (well)Your Database Cannot Do this (well)
Your Database Cannot Do this (well)
 
Your Timestamps Deserve Better than a Generic Database
Your Timestamps Deserve Better than a Generic DatabaseYour Timestamps Deserve Better than a Generic Database
Your Timestamps Deserve Better than a Generic Database
 
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 ...
 
QuestDB-Community-Call-20220728
QuestDB-Community-Call-20220728QuestDB-Community-Call-20220728
QuestDB-Community-Call-20220728
 
Processing and analysing streaming data with Python. Pycon Italy 2022
Processing and analysing streaming  data with Python. Pycon Italy 2022Processing and analysing streaming  data with Python. Pycon Italy 2022
Processing and analysing streaming data with Python. Pycon Italy 2022
 
QuestDB: ingesting a million time series per second on a single instance. Big...
QuestDB: ingesting a million time series per second on a single instance. Big...QuestDB: ingesting a million time series per second on a single instance. Big...
QuestDB: ingesting a million time series per second on a single instance. Big...
 
Servicios e infraestructura de AWS y la próxima región en Aragón
Servicios e infraestructura de AWS y la próxima región en AragónServicios e infraestructura de AWS y la próxima región en Aragón
Servicios e infraestructura de AWS y la próxima región en Aragón
 
Primeros pasos en desarrollo serverless
Primeros pasos en desarrollo serverlessPrimeros pasos en desarrollo serverless
Primeros pasos en desarrollo serverless
 
How AWS is reinventing the cloud
How AWS is reinventing the cloudHow AWS is reinventing the cloud
How AWS is reinventing the cloud
 
Analitica de datos en tiempo real con Apache Flink y Apache BEAM
Analitica de datos en tiempo real con Apache Flink y Apache BEAMAnalitica de datos en tiempo real con Apache Flink y Apache BEAM
Analitica de datos en tiempo real con Apache Flink y Apache BEAM
 
Getting started with streaming analytics
Getting started with streaming analyticsGetting started with streaming analytics
Getting started with streaming analytics
 
Getting started with streaming analytics: Setting up a pipeline
Getting started with streaming analytics: Setting up a pipelineGetting started with streaming analytics: Setting up a pipeline
Getting started with streaming analytics: Setting up a pipeline
 
Getting started with streaming analytics: Deep Dive
Getting started with streaming analytics: Deep DiveGetting started with streaming analytics: Deep Dive
Getting started with streaming analytics: Deep Dive
 
Getting started with streaming analytics: streaming basics (1 of 3)
Getting started with streaming analytics: streaming basics (1 of 3)Getting started with streaming analytics: streaming basics (1 of 3)
Getting started with streaming analytics: streaming basics (1 of 3)
 
Monitorización de seguridad y detección de amenazas con AWS
Monitorización de seguridad y detección de amenazas con AWSMonitorización de seguridad y detección de amenazas con AWS
Monitorización de seguridad y detección de amenazas con AWS
 

Kürzlich hochgeladen

08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 

Kürzlich hochgeladen (20)

08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 

Fosdem how you can benefit from redis, javier ramirez @ teowaki

  • 1. How you can benefit from using Redis javier ramirez @supercoco9
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7. I was Lois Lane javier ramirez @supercoco9 https://teowaki.com FOSDEM 2014
  • 8. In the beginner's mind there are many possibilities, in the expert's mind there are few. Shunryu Suzuki javier ramirez @supercoco9 https://teowaki.com FOSDEM 2014
  • 9. myth: the bottleneck javier ramirez @supercoco9 https://teowaki.com FOSDEM 2014
  • 10. redis-benchmark -r 1000000 -n 2000000 -t get,set,lpush,lpop,mset -P 16 -q On my laptop: SET: 513610 requests per second GET: 641436 requests per second LPUSH: 845665 requests per second LPOP: 783392 requests per second MSET (10 keys): 89988 requests per second On a small digital ocean server ($5/month) SET: 227816 requests per second GET: 228258 requests per second LPUSH: 251098 requests per second LPOP: 251572 requests per second MSET (10 keys): 43918 requests per second javier ramirez @supercoco9 https://teowaki.com FOSDEM 2014
  • 11. myth: Redis is just like memcached javier ramirez @supercoco9 https://teowaki.com FOSDEM 2014
  • 12. myth: Redis is for queues javier ramirez @supercoco9 https://teowaki.com FOSDEM 2014
  • 13. open source, BSD licensed, advanced key-value store. It is often referred to as a data structure server since keys can contain strings, hashes, lists, sets and sorted sets. http://redis.io started in 2009 by Salvatore Sanfilippo @antirez 104 contributors at https://github.com/antirez/redis javier ramirez @supercoco9 https://teowaki.com FOSDEM 2014
  • 14. The Redis Manifesto 1.A DSL for Abstract Data Types 2.Memory storage is #1 3.Fundamental data structures for a fundamental API 4.Two levels of API 5.Code is like a poem; it's not just something we write to reach some practical result 6.We're against complexity 7.We optimize for joy javier ramirez @supercoco9 https://teowaki.com FOSDEM 2014
  • 15. Redis makes you think javier ramirez @supercoco9 https://teowaki.com FOSDEM 2014
  • 16. Redis data types Strings Hashes Lists Sets Sorted Sets javier ramirez @supercoco9 https://teowaki.com FOSDEM 2014
  • 17. basic commands Setting/getting/deleting/expiring Increment/decrement Pushing/popping Checking membership, size... javier ramirez @supercoco9 https://teowaki.com FOSDEM 2014
  • 18. much cooler commands Setting only if exists Blocking pop (Blocking) pop from one list, push to another Get/set string ranges (and bit operations) Set intersections/diffs (and store) Pub/sub javier ramirez @supercoco9 https://teowaki.com FOSDEM 2014
  • 19. A chat in 6 lines of code r=Redis.new driver: :hiredis r.subscribe “chatrooms:42” do |on| on.message do |topic, msg| puts “#{topic}: #{msg}” end end r.publish “chatrooms:42”, “Hello Fosdem” javier ramirez @supercoco9 https://teowaki.com FOSDEM 2014
  • 20. atomicity single threaded, so no concurrency problems transactions and lua scripts to run multiple operations atomically javier ramirez @supercoco9 https://teowaki.com FOSDEM 2014
  • 21. Scripting with lua You can use Lua for scripting Redis when you need to atomically execute a sequence of commands in which the output of a command is used as input for another It reduces the need to use complex lock mechanisms and simplifies dependencies between clients You can even extend the functionality of Redis by using Lua scripts javier ramirez @supercoco9 https://teowaki.com FOSDEM 2014
  • 22. Redis keeps everything in memory all the time javier ramirez @supercoco9 https://teowaki.com FOSDEM 2014
  • 23. Persistance: RDB Compact binary format Saves snapshots every few minutes Good for backups and synchronizing If Redis crashes, a few minutes worth of data will be lost javier ramirez @supercoco9 https://teowaki.com FOSDEM 2014
  • 24. Durability: AOF Log text format Configurable durability Large file, can slow down startup If Redis crashes, typically one second of data could be lost javier ramirez @supercoco9 https://teowaki.com FOSDEM 2014
  • 25. replication & scaling out one master, several read-only slaves sharding Twemproxy & redis cluster javier ramirez @supercoco9 https://teowaki.com FOSDEM 2014
  • 26. what's being used for javier ramirez @supercoco9 https://teowaki.com FOSDEM 2014
  • 27. twitter Every time line (800 tweets per user) is on redis 5000 writes per second avg 300K reads per second javier ramirez @supercoco9 https://teowaki.com FOSDEM 2014
  • 28. twitter write API (from browser or client app) follo e per on user id tweet id wer fanout (flockDB) metadata rpushx to Redis user info from gizmoduck (memcached) javier ramirez @supercoco9 tweet info from tweetypie (memcached + mysql) https://teowaki.com your twitter timeline FOSDEM 2014
  • 29. World Of Warcraft Blizzard is quite secretive about it Known to have at least 8 servers with 64Gb each to serve user avatars Known to have seen 1.000.000 users concurrently in the Asian version of the game javier ramirez @supercoco9 https://teowaki.com FOSDEM 2014
  • 30. pinterest object graph per user Redis SortedSet, with timestamp as the score to store the users followed explicitly store the users followed implicitly store the user’s explicit followers store the user’s implicit followers store boards followed explicitly Redis set to store boards unfollowed explicitly per board Redis Hash to store a board’s explicit followers Redis Set to store a board’s explicit unfollowers javier ramirez @supercoco9 https://teowaki.com FOSDEM 2014
  • 31. viacom Object dependency graph. Cache on steroids Redis as a queue for background jobs Activity tracking and view counts buffering before saving to mysql Lua script working on a slave to recalculate ranking and popularity of contents, then send the data to master. The new process takes 1/60th less than the old one in mysql javier ramirez @supercoco9 https://teowaki.com FOSDEM 2014
  • 32. stack overflow Three level cache: local cache (no persistence) sessions, and pending view count updates site cache hot question id lists, user acceptance rates... global cache (separate Redis DB) Inboxes, API usage quotas... javier ramirez @supercoco9 https://teowaki.com FOSDEM 2014
  • 33. youporn Most data is found in hashes with ordered sets used to know what data to show. zInterStore on: videos:filters:released, Videos:filters:orientation:straight,Videos:filters:categorie s:{category_id}, Videos:ordering:rating Then perform a zRange to get the pages we want and get the list of video_ids back. Then start a pipeline and get all the videos from hashes. javier ramirez @supercoco9 https://teowaki.com FOSDEM 2014
  • 34. github Git as a service internally. Redis is used for storing routing info matching user repositories to server names hipchat Redis for caching. Information like which users are in which rooms, presence information, who is online, etc, so it doesn’t matter which XMPP server you connect to. javier ramirez @supercoco9 https://teowaki.com FOSDEM 2014
  • 35. when things go wrong javier ramirez @supercoco9 https://teowaki.com FOSDEM 2014
  • 36. the instagram case moving from redis to cassandra: 75% savings on servers lesson learnt: know when redis is not appropriate javier ramirez @supercoco9 https://teowaki.com FOSDEM 2014
  • 37. the twilio case credit card hell lesson learnt: know what you are doing. Don't change config on the fly javier ramirez @supercoco9 https://teowaki.com FOSDEM 2014
  • 38. Numbers can be scary Twitter: 2TB RAM for Redis on its own servers Blizzard: At least 8 servers with 64Gb each Pinteres:t 110 Redis instances Instagram: 1.2 TB of data javier ramirez @supercoco9 https://teowaki.com FOSDEM 2014
  • 39. openredis redis as a service on AWS serving over 1000 customers with a single machine javier ramirez @supercoco9 https://teowaki.com FOSDEM 2014
  • 40. how teowaki is using redis javier ramirez @supercoco9 https://teowaki.com FOSDEM 2014
  • 41. Abusing sidekiq/resque keep track of every activity in the system, even if you don't need them all right now: - every page view - every API request - every time a record is created/updated/deleted benefits: - highly decoupled system - easier to divide into services - you can add behaviour without changing your app javier ramirez @supercoco9 https://teowaki.com FOSDEM 2014
  • 42. intermediate cache * As a very fast lightweight storage for analytics data before sending them to our google bigquery based solution * As a cache for attributes frequently looked up in join tables (names, nicknames, guids, delegated or included model names...) javier ramirez @supercoco9 https://teowaki.com FOSDEM 2014
  • 43. Some of our uses of Lua Expiring attributes inside a Redis hash Inserting notifications into a list only if there are not pending notifications from the same user for the same scope Paginating a list by an attribute Manipulating JSON directly at the Redis layer javier ramirez @supercoco9 https://teowaki.com FOSDEM 2014
  • 44. counters Atomic counters can be safely invoked concurrently from anywhere, so you can implement “like” features, global sequences or usage monitoring systems in highly concurrent applications for free. You can share your counters with any other internal application and still be sure they won't collide. javier ramirez @supercoco9 https://teowaki.com FOSDEM 2014
  • 45. Temporary data Redis allows us to self expire keys after a time has passed. You can use this mechanism for a simple cache If you operate on a key with expiration time, you can change its value and still keep the expiration going. By combining a decrementing counter with an expiration time, implementing usage quotas is trivial Also, you can inspect which keys you have in your server efficiently using SCAN commands javier ramirez @supercoco9 https://teowaki.com FOSDEM 2014
  • 46. nginx + lua + redis apache + mruby + redis Multiple levels of cache by using Redis on the webserver/ middleware layer http://wiki.nginx.org/HttpRedis javier ramirez @supercoco9 https://teowaki.com FOSDEM 2014
  • 47. summarizing * Redis is more powerful than it seems * Very fast, easy to use, simple, good documentation * In-memory data structures, distributed, shared and persisted * Good as data store, intermediate data store, cache or queue * Lots of use cases, both in huge and smaller systems You should probably use it a lot more javier ramirez @supercoco9 https://teowaki.com FOSDEM 2014
  • 48. Find related links at https://teowaki.com/teams/javier-community/link-categories/redis Dank u. Merci. If you enjoyed this talk, please sign up for https://teowaki.com Javier Ramírez @supercoco9 FOSDEM 2014