Redis e Memcached - Daniel Naves - Omnilogic

Post on 03-Nov-2014

10 views 1 download

Tags:

description

 

Transcript of Redis e Memcached - Daniel Naves - Omnilogic

Redis vs MemcachedDaniel Naves de Carvalho - daniel@omnilogic.com.br

OmniLogicOmniLogic

• Since nov/2009

• Data-Mining

• Computational Intelligence

• Optimization

• Business Intelligence

MemcachedMemcached

• Free & open source

• High-performance

• Distributed memory object caching system

• Generic in nature, but intended for use in speeding up dynamicweb applications by alleviating database load.

• In-memory key-value store for small chunks of arbitrary data (strings,objects from database calls, API calls etc)

• At heart it is a simple Key-Value store

Memcached - ClientsMemcached - Clients

• C / C++• PHP• Java• Python• Ruby• Perl• Windows/.NET• MySQL• PostgreSQL• Erlang• Lua• Lisp• ColdFusion• OCaml• Io• etc

FeaturesFeatures

• Simple Key-Value Store

• Servers are disconected from each other

• Forgetting data is a feature(LRU)

• O(1)

Redis vs MemcachedRedis vs MemcachedRedis Memcached

In Memory x x

Persistent x

Atomic x x

Consistent x x

Replication x

Authentication x

Key / Value x x

Key Enumeration x

Key / Value buckets x

Redis vs MemcachedRedis vs MemcachedRedis Memcached

Maximum Key Length 2^31bytes 250 bytes

Maximum String size 512m 1m

Data Structures x

Channel Pub/Sub x

Consistent hasing x x

Memory Usage 10-20% less

Speed(Single Instance, Multicore)

100.000 req/s 125.000 req/s

Speed(Multiple Instances, Single Thread)

200.000 req/s 200.000 req/s

Redis – Real Use CasesRedis – Real Use Cases

• RReal-time model-prediction cachingeal-time model-prediction caching

• Page fragments caching

• Jobs Queue

Redis – Network layoutRedis – Network layout

Page fragments cachingPage fragments caching

• Speedup +5x

• Low memory usage

• Faster than pre-render file caching

Jobs QueueJobs Queue

• Easy to maintain

• Persistent

• Multi-queue multi-workers

ResqueResque

RReal-time model-prediction cachingeal-time model-prediction caching

• Speed-up +100x

• Faster sorting vs Lib Sorting

• Easy to maintain

• Scales horizontally

Questions???