SlideShare ist ein Scribd-Unternehmen logo
1 von 34
Downloaden Sie, um offline zu lesen
Redis

  REmote DIctionary Server


         Ezra Zygmuntowicz
#redis   twitter: @ezmobius
• Fast, in memory key/value store
• STRING, LIST, SET & ZSET data types
• Persistence via async snapshots or AOF
• Perfect Data Structure/State/Cache Server
Data Structure Server
Data Structure Server
   Key:String => Value:String
Data Structure Server
   Key:String => Value:String

   Key:String => Value:List
Data Structure Server
   Key:String => Value:String

   Key:String => Value:List

   Key:String => Value:Set
Data Structure Server
   Key:String => Value:String

   Key:String => Value:List

   Key:String => Value:Set

    Key:String => Value:Zset
Operations on any Type

• Exists, Del, Type
• Keys, Randomkey
• Rename, RenameNX
• Dbsize, Select, Move, Flushdb, Flushall
• TTL, Expire
Operations on
       STRING’s
• Get, Set, GetSet, SetNX
• Mget, Mset, MgetNX, MsetNX
• Incr, Incrby
• Decr, Decrby
Operations on LISTS’s
• Atomic Operations:
• Push/Pop
• Index (array indexing)
• Lrange, Ltrim, Llen
• Blpop, Brpop
• RpopLpush, BRpopLpush
Operations on SET’s

• Sadd, Srem, Spop, Smove
• Scard, Sismember, Smembers, Srandmember
• Sinter, Sinterstore, Sunion, Sunionstore
• Sdiff, Sdiffstore
Operations on ZSET’s

• Zadd, Zrem, Zincrby
• Zrange, Zrevrange
• Zrangebyscore, Zcard
• Zscore, Zremrangebyscore
Seems cool, but what
  are the use cases?
• Memcached on Steroids
• Tag Clouds, Leaderboards
• Stat collections, circular log buffers
• Share state between processes
• A/B testing
• REDIStribute your load
Example: Tagging
Example: Tagging

  SADD article:42 magick
 SADD article:42 unicorns
 SADD article:42 rainbows
Example: Tagging

  SADD article:42 magick
 SADD article:42 unicorns
 SADD article:42 rainbows
  SADD article:12 magick
   SADD article:12 bar
   SADD article:12 qux
   SADD article:12 foo
Example: Tagging
  SADD article:42 magick
 SADD article:42 unicorns
 SADD article:42 rainbows
  SADD article:12 magick
   SADD article:12 bar
   SADD article:12 qux
   SADD article:12 foo

 SINTER article:42 article:12
       #=> magick
Example: Fair Work
    Scheduler
Example: Fair Work
    Scheduler
Example: Fair Work
    Scheduler



 Each worker node periodically issues:
 ZADD worker:nodes 1.5 hostname
    1.5 is the load ave of the host
Example: Fair Work
    Scheduler



Each worker node listens for work with:
         BLPOP hostname 10
Example: Fair Work
      Scheduler



When a producer wants to issue a work request:
         ZRANGE worker:nodes 0 2
       returns top 3 least loaded nodes
Example: Fair Work
        Scheduler



Pick a random node out of the 3 least loaded nodes
  in order to add jitter so we don’t overload hosts
Example: Fair Work
    Scheduler



    Then issue the work request:
LPUSH hostname {“work”: {“foo”: “bar”}}
Example: Fair Work
         Scheduler



This setup uses ZSETS and the load average as a score
  in order to evenly distribute load across a farm of
    worker instances listening for jobs with BLPOP
Example: AMQP
message de-dupe
Example: AMQP
           message de-dupe
Route messages through 2 separate rabbitmq brokers for
                     redundancy

Use redis for message de-dupe by tagging messages with a
                          guid

               Use guid as key into redis

 Use SETNX when setting the guid key so first one wins
 and second messages gets discarded as already received
Other Ideas
• Distributed Lock Manager for process
  coordination
• Full Text Inverted Index Lookups
• Caching with extra smarts using lists, sets
  and atomic ops on said structures
• Share data structures between multiple
  processes like a blackboard/tuplespace
Speed
• 110k GETS/SETS/second on average linux box
• Mostly faster then memcached for same ops
• Event Driven, can handle thousands of clients with
  epoll/kqueue support
• Ops happen in memory, persistence is async so
  everything is very fast
Persistence

• Async Snapshots with configurable triggers
• Append Only File: AOF
• Redis 2.0 Virtual Memory
Replication


• Built in Master -> Slave Async replication
• Create replication chains as needed
Sharding

• Client side sharding (like memcached)
• Consistent ring hashing
• Special case keys “foo{tags}” for operations on
  keys that must live on the same server in ruby
  client
Redactor
• Simple Actor Library based around Redis
Questions?


  http://code.google.com/p/redis/
http://github.com/ezmobius/redis-rb

Weitere ähnliche Inhalte

Was ist angesagt?

Faceting Optimizations for Solr: Presented by Toke Eskildsen, State & Univers...
Faceting Optimizations for Solr: Presented by Toke Eskildsen, State & Univers...Faceting Optimizations for Solr: Presented by Toke Eskildsen, State & Univers...
Faceting Optimizations for Solr: Presented by Toke Eskildsen, State & Univers...
Lucidworks
 
Logstash + Elasticsearch + Kibana Presentation on Startit Tech Meetup
Logstash + Elasticsearch + Kibana Presentation on Startit Tech MeetupLogstash + Elasticsearch + Kibana Presentation on Startit Tech Meetup
Logstash + Elasticsearch + Kibana Presentation on Startit Tech Meetup
Startit
 

Was ist angesagt? (20)

Paul Dix (Founder InfluxDB) - Organising Metrics at #DOXLON
Paul Dix (Founder InfluxDB) - Organising Metrics at #DOXLONPaul Dix (Founder InfluxDB) - Organising Metrics at #DOXLON
Paul Dix (Founder InfluxDB) - Organising Metrics at #DOXLON
 
Buzzwords 2014 / Overview / part1
Buzzwords 2014 / Overview / part1Buzzwords 2014 / Overview / part1
Buzzwords 2014 / Overview / part1
 
Ali Asad Lotia (DevOps at Beamly) - Riemann Stream Processing at #DOXLON
Ali Asad Lotia (DevOps at Beamly) - Riemann Stream Processing at #DOXLONAli Asad Lotia (DevOps at Beamly) - Riemann Stream Processing at #DOXLON
Ali Asad Lotia (DevOps at Beamly) - Riemann Stream Processing at #DOXLON
 
Introduction to elasticsearch
Introduction to elasticsearchIntroduction to elasticsearch
Introduction to elasticsearch
 
Elasticsearch
ElasticsearchElasticsearch
Elasticsearch
 
What I learnt: Elastic search & Kibana : introduction, installtion & configur...
What I learnt: Elastic search & Kibana : introduction, installtion & configur...What I learnt: Elastic search & Kibana : introduction, installtion & configur...
What I learnt: Elastic search & Kibana : introduction, installtion & configur...
 
Elasticsearch Arcihtecture & What's New in Version 5
Elasticsearch Arcihtecture & What's New in Version 5Elasticsearch Arcihtecture & What's New in Version 5
Elasticsearch Arcihtecture & What's New in Version 5
 
Introduction to ELK
Introduction to ELKIntroduction to ELK
Introduction to ELK
 
Machine Learning in a Twitter ETL using ELK
Machine Learning in a Twitter ETL using ELK Machine Learning in a Twitter ETL using ELK
Machine Learning in a Twitter ETL using ELK
 
Managing Your Content with Elasticsearch
Managing Your Content with ElasticsearchManaging Your Content with Elasticsearch
Managing Your Content with Elasticsearch
 
An Introduction to Elastic Search.
An Introduction to Elastic Search.An Introduction to Elastic Search.
An Introduction to Elastic Search.
 
Cassandra Summit 2014: Reading Cassandra SSTables Directly for Offline Data A...
Cassandra Summit 2014: Reading Cassandra SSTables Directly for Offline Data A...Cassandra Summit 2014: Reading Cassandra SSTables Directly for Offline Data A...
Cassandra Summit 2014: Reading Cassandra SSTables Directly for Offline Data A...
 
Faceting Optimizations for Solr: Presented by Toke Eskildsen, State & Univers...
Faceting Optimizations for Solr: Presented by Toke Eskildsen, State & Univers...Faceting Optimizations for Solr: Presented by Toke Eskildsen, State & Univers...
Faceting Optimizations for Solr: Presented by Toke Eskildsen, State & Univers...
 
Philly PHP: April '17 Elastic Search Introduction by Aditya Bhamidpati
Philly PHP: April '17 Elastic Search Introduction by Aditya BhamidpatiPhilly PHP: April '17 Elastic Search Introduction by Aditya Bhamidpati
Philly PHP: April '17 Elastic Search Introduction by Aditya Bhamidpati
 
ElasticES-Hadoop: Bridging the world of Hadoop and Elasticsearch
ElasticES-Hadoop: Bridging the world of Hadoop and ElasticsearchElasticES-Hadoop: Bridging the world of Hadoop and Elasticsearch
ElasticES-Hadoop: Bridging the world of Hadoop and Elasticsearch
 
Fluentd - Flexible, Stable, Scalable
Fluentd - Flexible, Stable, ScalableFluentd - Flexible, Stable, Scalable
Fluentd - Flexible, Stable, Scalable
 
Logstash + Elasticsearch + Kibana Presentation on Startit Tech Meetup
Logstash + Elasticsearch + Kibana Presentation on Startit Tech MeetupLogstash + Elasticsearch + Kibana Presentation on Startit Tech Meetup
Logstash + Elasticsearch + Kibana Presentation on Startit Tech Meetup
 
ELK Stack
ELK StackELK Stack
ELK Stack
 
Customer Intelligence: Using the ELK Stack to Analyze ForgeRock OpenAM Audit ...
Customer Intelligence: Using the ELK Stack to Analyze ForgeRock OpenAM Audit ...Customer Intelligence: Using the ELK Stack to Analyze ForgeRock OpenAM Audit ...
Customer Intelligence: Using the ELK Stack to Analyze ForgeRock OpenAM Audit ...
 
Elasticsearch and Spark
Elasticsearch and SparkElasticsearch and Spark
Elasticsearch and Spark
 

Andere mochten auch (6)

Get Rid Of Stress 194
Get Rid Of Stress 194Get Rid Of Stress 194
Get Rid Of Stress 194
 
Evan Ellis "Tumblr. Massively Sharded MySQL"
Evan Ellis "Tumblr. Massively Sharded MySQL"Evan Ellis "Tumblr. Massively Sharded MySQL"
Evan Ellis "Tumblr. Massively Sharded MySQL"
 
Redis勉強会資料(2015/06 update)
Redis勉強会資料(2015/06 update)Redis勉強会資料(2015/06 update)
Redis勉強会資料(2015/06 update)
 
High-Volume Data Collection and Real Time Analytics Using Redis
High-Volume Data Collection and Real Time Analytics Using RedisHigh-Volume Data Collection and Real Time Analytics Using Redis
High-Volume Data Collection and Real Time Analytics Using Redis
 
Sharding Methods for MongoDB
Sharding Methods for MongoDBSharding Methods for MongoDB
Sharding Methods for MongoDB
 
大規模Redisサーバ縮小化の戦い
大規模Redisサーバ縮小化の戦い大規模Redisサーバ縮小化の戦い
大規模Redisサーバ縮小化の戦い
 

Ähnlich wie Redis: REmote DIctionary Server

Solr Black Belt Pre-conference
Solr Black Belt Pre-conferenceSolr Black Belt Pre-conference
Solr Black Belt Pre-conference
Erik Hatcher
 

Ähnlich wie Redis: REmote DIctionary Server (20)

Postgres Vienna DB Meetup 2014
Postgres Vienna DB Meetup 2014Postgres Vienna DB Meetup 2014
Postgres Vienna DB Meetup 2014
 
Real time Analytics with Apache Kafka and Apache Spark
Real time Analytics with Apache Kafka and Apache SparkReal time Analytics with Apache Kafka and Apache Spark
Real time Analytics with Apache Kafka and Apache Spark
 
Build an High-Performance and High-Durable Block Storage Service Based on Ceph
Build an High-Performance and High-Durable Block Storage Service Based on CephBuild an High-Performance and High-Durable Block Storage Service Based on Ceph
Build an High-Performance and High-Durable Block Storage Service Based on Ceph
 
LuSql: (Quickly and easily) Getting your data from your DBMS into Lucene
LuSql: (Quickly and easily) Getting your data from your DBMS into LuceneLuSql: (Quickly and easily) Getting your data from your DBMS into Lucene
LuSql: (Quickly and easily) Getting your data from your DBMS into Lucene
 
Dictionary Based Annotation at Scale with Spark by Sujit Pal
Dictionary Based Annotation at Scale with Spark by Sujit PalDictionary Based Annotation at Scale with Spark by Sujit Pal
Dictionary Based Annotation at Scale with Spark by Sujit Pal
 
Dictionary based Annotation at Scale with Spark, SolrTextTagger and OpenNLP
Dictionary based Annotation at Scale with Spark, SolrTextTagger and OpenNLPDictionary based Annotation at Scale with Spark, SolrTextTagger and OpenNLP
Dictionary based Annotation at Scale with Spark, SolrTextTagger and OpenNLP
 
Real-Time Analytics with Kafka, Cassandra and Storm
Real-Time Analytics with Kafka, Cassandra and StormReal-Time Analytics with Kafka, Cassandra and Storm
Real-Time Analytics with Kafka, Cassandra and Storm
 
Apache Samza Past, Present and Future
Apache Samza  Past, Present and FutureApache Samza  Past, Present and Future
Apache Samza Past, Present and Future
 
Dragoncraft Architectural Overview
Dragoncraft Architectural OverviewDragoncraft Architectural Overview
Dragoncraft Architectural Overview
 
Online Analytics with Hadoop and Cassandra
Online Analytics with Hadoop and CassandraOnline Analytics with Hadoop and Cassandra
Online Analytics with Hadoop and Cassandra
 
Micro-batching: High-performance writes
Micro-batching: High-performance writesMicro-batching: High-performance writes
Micro-batching: High-performance writes
 
Micro-batching: High-performance Writes (Adam Zegelin, Instaclustr) | Cassand...
Micro-batching: High-performance Writes (Adam Zegelin, Instaclustr) | Cassand...Micro-batching: High-performance Writes (Adam Zegelin, Instaclustr) | Cassand...
Micro-batching: High-performance Writes (Adam Zegelin, Instaclustr) | Cassand...
 
Neo4j after 1 year in production
Neo4j after 1 year in productionNeo4j after 1 year in production
Neo4j after 1 year in production
 
KeyValue Stores
KeyValue StoresKeyValue Stores
KeyValue Stores
 
Optimizing Presto Connector on Cloud Storage
Optimizing Presto Connector on Cloud StorageOptimizing Presto Connector on Cloud Storage
Optimizing Presto Connector on Cloud Storage
 
Learning Puppet basic thing
Learning Puppet basic thing Learning Puppet basic thing
Learning Puppet basic thing
 
Evolution Of MongoDB Replicaset
Evolution Of MongoDB ReplicasetEvolution Of MongoDB Replicaset
Evolution Of MongoDB Replicaset
 
Logstash
LogstashLogstash
Logstash
 
Solr Black Belt Pre-conference
Solr Black Belt Pre-conferenceSolr Black Belt Pre-conference
Solr Black Belt Pre-conference
 
Overview of data analytics service: Treasure Data Service
Overview of data analytics service: Treasure Data ServiceOverview of data analytics service: Treasure Data Service
Overview of data analytics service: Treasure Data Service
 

Mehr von Ezra Zygmuntowicz (9)

Where do I put this data? #lessql
Where do I put this data? #lessqlWhere do I put this data? #lessql
Where do I put this data? #lessql
 
Railsconf
RailsconfRailsconf
Railsconf
 
Erlangfactory
ErlangfactoryErlangfactory
Erlangfactory
 
Ruby Deployment
Ruby DeploymentRuby Deployment
Ruby Deployment
 
Merb + Nanite
Merb + NaniteMerb + Nanite
Merb + Nanite
 
Vertebra
VertebraVertebra
Vertebra
 
Vertebra
VertebraVertebra
Vertebra
 
Merb Core
Merb CoreMerb Core
Merb Core
 
Custom Mongrel Handlers: Learning how to walk the dog
Custom Mongrel Handlers: Learning how to walk the dogCustom Mongrel Handlers: Learning how to walk the dog
Custom Mongrel Handlers: Learning how to walk the dog
 

Kürzlich hochgeladen

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 

Kürzlich hochgeladen (20)

How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
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...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 

Redis: REmote DIctionary Server

  • 1. Redis REmote DIctionary Server Ezra Zygmuntowicz #redis twitter: @ezmobius
  • 2. • Fast, in memory key/value store • STRING, LIST, SET & ZSET data types • Persistence via async snapshots or AOF • Perfect Data Structure/State/Cache Server
  • 4. Data Structure Server Key:String => Value:String
  • 5. Data Structure Server Key:String => Value:String Key:String => Value:List
  • 6. Data Structure Server Key:String => Value:String Key:String => Value:List Key:String => Value:Set
  • 7. Data Structure Server Key:String => Value:String Key:String => Value:List Key:String => Value:Set Key:String => Value:Zset
  • 8. Operations on any Type • Exists, Del, Type • Keys, Randomkey • Rename, RenameNX • Dbsize, Select, Move, Flushdb, Flushall • TTL, Expire
  • 9. Operations on STRING’s • Get, Set, GetSet, SetNX • Mget, Mset, MgetNX, MsetNX • Incr, Incrby • Decr, Decrby
  • 10. Operations on LISTS’s • Atomic Operations: • Push/Pop • Index (array indexing) • Lrange, Ltrim, Llen • Blpop, Brpop • RpopLpush, BRpopLpush
  • 11. Operations on SET’s • Sadd, Srem, Spop, Smove • Scard, Sismember, Smembers, Srandmember • Sinter, Sinterstore, Sunion, Sunionstore • Sdiff, Sdiffstore
  • 12. Operations on ZSET’s • Zadd, Zrem, Zincrby • Zrange, Zrevrange • Zrangebyscore, Zcard • Zscore, Zremrangebyscore
  • 13. Seems cool, but what are the use cases? • Memcached on Steroids • Tag Clouds, Leaderboards • Stat collections, circular log buffers • Share state between processes • A/B testing • REDIStribute your load
  • 15. Example: Tagging SADD article:42 magick SADD article:42 unicorns SADD article:42 rainbows
  • 16. Example: Tagging SADD article:42 magick SADD article:42 unicorns SADD article:42 rainbows SADD article:12 magick SADD article:12 bar SADD article:12 qux SADD article:12 foo
  • 17. Example: Tagging SADD article:42 magick SADD article:42 unicorns SADD article:42 rainbows SADD article:12 magick SADD article:12 bar SADD article:12 qux SADD article:12 foo SINTER article:42 article:12 #=> magick
  • 18. Example: Fair Work Scheduler
  • 19. Example: Fair Work Scheduler
  • 20. Example: Fair Work Scheduler Each worker node periodically issues: ZADD worker:nodes 1.5 hostname 1.5 is the load ave of the host
  • 21. Example: Fair Work Scheduler Each worker node listens for work with: BLPOP hostname 10
  • 22. Example: Fair Work Scheduler When a producer wants to issue a work request: ZRANGE worker:nodes 0 2 returns top 3 least loaded nodes
  • 23. Example: Fair Work Scheduler Pick a random node out of the 3 least loaded nodes in order to add jitter so we don’t overload hosts
  • 24. Example: Fair Work Scheduler Then issue the work request: LPUSH hostname {“work”: {“foo”: “bar”}}
  • 25. Example: Fair Work Scheduler This setup uses ZSETS and the load average as a score in order to evenly distribute load across a farm of worker instances listening for jobs with BLPOP
  • 27. Example: AMQP message de-dupe Route messages through 2 separate rabbitmq brokers for redundancy Use redis for message de-dupe by tagging messages with a guid Use guid as key into redis Use SETNX when setting the guid key so first one wins and second messages gets discarded as already received
  • 28. Other Ideas • Distributed Lock Manager for process coordination • Full Text Inverted Index Lookups • Caching with extra smarts using lists, sets and atomic ops on said structures • Share data structures between multiple processes like a blackboard/tuplespace
  • 29. Speed • 110k GETS/SETS/second on average linux box • Mostly faster then memcached for same ops • Event Driven, can handle thousands of clients with epoll/kqueue support • Ops happen in memory, persistence is async so everything is very fast
  • 30. Persistence • Async Snapshots with configurable triggers • Append Only File: AOF • Redis 2.0 Virtual Memory
  • 31. Replication • Built in Master -> Slave Async replication • Create replication chains as needed
  • 32. Sharding • Client side sharding (like memcached) • Consistent ring hashing • Special case keys “foo{tags}” for operations on keys that must live on the same server in ruby client
  • 33. Redactor • Simple Actor Library based around Redis