Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Redis

 Redis

A Quick Intro

Akshay Rawat

April 16, 2013
Tweet

Other Decks in Programming

Transcript

  1. DATA STRUCTURES Strings, Lists, Sets, Sorted Sets, Hashes IPC Shared

    Memory, MQs, Semaphores, PubSub Caching Expiration, Eviction Policies
  2. Time Complexity O(1) < O(log(n)) < O(n) < O(n^2) ..

    Containers String, Doubly Linked Lists, Skip Lists, Hash Tables ... Guaranteed, Mathematically Predictable Specialized C data structures Varies based on storage pattern
  3. LIST Data Structure: Doubly Linked Lists Strengths: Time Complexity O(1)

    operations LPUSH LPOP RPUSH RPOP LPUSHX RPUSHX LTRIM Capped collections: Logs, Activity Feeds
  4. LIST Strengths: IPC operations BLPOP BRPOP BRPOPLPUSH Blocking Atomic EM

    implementations Light weight APMQ replacement
  5. SET Strengths: Set Operations SINTER SUNION SISMEMBER Is a friend?

    Common Friends. All friends of A & B. People who bought this, also bought ... Data filtering - eg. Blog Tags, N Dimension
  6. SORTED SET Strengths: Scores and Ranks ZRANGEBYSCORE ZRANGE ZCOUNT ZRANK

    ZREMRANGEBYSCORE ZREMRANGEBYRANK Leader boards - Top something lists. Priority Queues
  7. IPC Named Channels. ActiveSupport Notifications like API Pub Sub SUBSCRIBE

    PSUBSCRIBE PUBLISH Simple Semaphores / Distributed Locks String SETNX
  8. In Short Redis is feature rich, but not a swiss

    knife ~Time & Memory complexity Single Threaded / Single Core Utilization Memory complexity is a funky blackbox Persistence strategy - a work in progress