Moxi - Memcached Proxy

60
moxi a memcached pr oxy

description

moxi is a memcached proxy with several features which can help keep the memcached contract whole in complicated environments. It also brings several optimizations to memcached deployments, without requiring any changes to the application software using memcached. For more, visit: http://labs.northscale.com/moxi/

Transcript of Moxi - Memcached Proxy

Page 1: Moxi - Memcached Proxy

moxia memcached proxy

Page 2: Moxi - Memcached Proxy

who

• steve yen

• dustin sallings

• matt ingenthron

Page 3: Moxi - Memcached Proxy

rhymes with foxy

Page 4: Moxi - Memcached Proxy

open source

Page 5: Moxi - Memcached Proxy

multithreaded C

Page 6: Moxi - Memcached Proxy

standing on the shoulders of giants

• libmemcached

• memcached

• libevent

Page 7: Moxi - Memcached Proxy

apache

web stack

php php php php

memcached memcached memcached

Page 8: Moxi - Memcached Proxy

apache

choose your weapons

php RoR Django perl

memcached memcached memcached

Page 9: Moxi - Memcached Proxy

apache

php then...

php php php php

memcached memcached memcached

Page 10: Moxi - Memcached Proxy

apache

connection mesh

php php php php

memcached memcached memcached

Page 11: Moxi - Memcached Proxy

apache

moxi

php php php php

moxi

memcached memcached memcached

Page 12: Moxi - Memcached Proxy

apache

moxi connections

php php php php

moxi

memcached memcached memcached

Page 13: Moxi - Memcached Proxy

apache

moxi connections

php php php php

moxi

memcached memcached memcached

Page 14: Moxi - Memcached Proxy

apache

moxi connections

php php php php

moxi

memcached memcached memcached

configurableconcurrency

Page 15: Moxi - Memcached Proxy

apache

protocol conversion

php php php php

ascii protocol

ascii protocol

moxi

memcached memcached memcached

Page 16: Moxi - Memcached Proxy

apache

protocol conversion

php php php php

ascii protocol

binary protocolascii protocol

moxi

memcached memcached memcached

Page 17: Moxi - Memcached Proxy

apache

auth’ed connections

php php php php

moxi

memcached memcached memcached

binary protocolauth’ed

Page 18: Moxi - Memcached Proxy

apache

consistent hashing

php php php php

moxi

memcached memcached memcached

Page 19: Moxi - Memcached Proxy

apache

consistent hashing

php php php php

memcached memcached memcached

a new server!

memcached

moxi

Page 20: Moxi - Memcached Proxy

apache

management channel

php php php php

a new server!

moxidynamic reconfigurations

and statistics

memcached memcached memcachedmemcached

Page 21: Moxi - Memcached Proxy

GET de-duplication

get item:2421

get item:2421

get item:2421

Page 22: Moxi - Memcached Proxy

apache

GET de-duplication

get a b c

memcached

get c d e

get a b c d e

get b c d

moxi

instead of...get a b cget b c dget c d e

Page 23: Moxi - Memcached Proxy

apache

front cache

php php php php

moxifront cache

memcached memcached memcached

Page 24: Moxi - Memcached Proxy

apache

front cache

php php php php

moxifront cache

memcached memcached memcached

Page 25: Moxi - Memcached Proxy

apache

front cache

php php php php

moxifront cache

Prefix-based. For limited number of hot items.

Served withouthitting wire.

Simple expirations.Meant for replication

friendly content.

memcached memcached memcached

Page 26: Moxi - Memcached Proxy

front cache

moxi moxi moxi

hot items replicated across many front caches.

memcached memcached memcached

Page 27: Moxi - Memcached Proxy

front cache

moxi moxi moxi

hot items replicated across many front caches.

memcached memcached memcached

Page 28: Moxi - Memcached Proxy

front cache

moxi moxi moxi

hot items replicated across many front caches.lazily.

memcached memcached memcached

Page 29: Moxi - Memcached Proxy

failure handling

moxi moxi moxi

memcached memcached memcached

Page 30: Moxi - Memcached Proxy

failure handling

moxi moxi moxi

memcached memcached memcached

for hiccups: configurable retry counts.then send misses and ERROR back to clients

Page 31: Moxi - Memcached Proxy

failure handling

memcached

for deep failures (and for planned server changes)dynamic reconfiguration messages

memcachedmemcached memcached

mgmtchannel

moxi moxi moxi

Page 32: Moxi - Memcached Proxy

failure handling

memcachedmemcached memcached

mgmtchannel

for deep failures (and for planned server changes)dynamic reconfiguration messages

moxi moxi moxi

memcached

Page 33: Moxi - Memcached Proxy

draining and filling

memcached memcached

mgmtchannel

lazily migrate items from old server to new server

memcachedmemcached

moxi moxi moxi

draining filling

Page 34: Moxi - Memcached Proxy

draining and filling

memcached memcached

mgmtchannel

N time later, just use filled server only

memcachedmemcached

moxi moxi moxi

drained filled

Page 35: Moxi - Memcached Proxy

timeout

Page 36: Moxi - Memcached Proxy

timeout• if a request takes more than X millisecs,

moxi should return a miss or error

Page 37: Moxi - Memcached Proxy

blackhole configuration

• GET’s become misses

• SET’s become error

• clients never wait, such as trying to make a connection to a non-existent memcached

Page 38: Moxi - Memcached Proxy

client...session[‘shopping-cart’] = user_cart;

sends... set session:123456 some_big_value

receives STORED.

continues on its way.

moxi...

receives... set session:123456 some_big_value

sees a match with configurable prefix “session:”

responds with STORED to client.

forwards to memcached asynchronously.

fire & forget SET

Page 39: Moxi - Memcached Proxy

inside moxi

• memcached

• libevent

• libmemcached

Page 40: Moxi - Memcached Proxy

inside moxi

libevent

drive_machineprotocol state machine

item manager

slabber

ascii protocol handler

binary protocol handler

memcached

hashtable

Page 41: Moxi - Memcached Proxy

inside moxi

libevent

drive_machineprotocol state machine

item manager

slabber

ascii protocol handler

ascii proxy upstream

protocol handler

binary proxy downstream

protocol handler

ascii proxy downstream

protocol handler

binary protocol handler

memcached proxy

dyna-config

libmemcached

matcherfrontcache

hashtable

Page 42: Moxi - Memcached Proxy

inside moxi

libevent

drive_machineprotocol state machine

item manager

slabber

ascii protocol handler

ascii proxy upstream

protocol handler

binary proxy downstream

protocol handler

ascii proxy downstream

protocol handler

binary protocol handler

memcached proxy

dyna-config

libmemcached

matcherfrontcache

hashtable

Page 43: Moxi - Memcached Proxy

moxi embeds memcached

libevent

drive_machineprotocol state machine

item manager

slabber

ascii protocol handler

ascii proxy upstream

protocol handler

binary proxy downstream

protocol handler

ascii proxy downstream

protocol handler

binary protocol handler

memcached proxy

dyna-config

libmemcached

matcherfrontcache

hashtable

Page 44: Moxi - Memcached Proxy

moxi’s can talk to themselves

but, they think they’re talking to memcached

moxi moxi moxi

Page 45: Moxi - Memcached Proxy

memcached

moxi moxi moxi

and, they still think they’re talking to just memcached

moxi’s can talk to themselvesand to memcached

Page 46: Moxi - Memcached Proxy

memcached memcached

moxi moxi moxi

and, they still think they’re talking to just memcached

moxi’s can talk to themselvesand to memcached

Page 47: Moxi - Memcached Proxy

memcached memcached memcached

moxi moxi moxi

and, they still think they’re talking to just memcached

moxi’s can talk to themselvesand to memcached

Page 48: Moxi - Memcached Proxy

memcached tokyotyrant

memcachedb

moxi moxi moxi

and, they still think they’re talking to just memcached

moxi’s can talk to themselvesand to memcached(*)

Page 49: Moxi - Memcached Proxy

starting

• memcached -m 512

• moxi -m 512 -z [configkey]

memcachedcommand-line

moxicommand

line

Page 50: Moxi - Memcached Proxy

when can I get moxi?

Page 51: Moxi - Memcached Proxy

today

• upcoming features

• draining/filling - August 2009

• everything else is done

• Available Now

Page 52: Moxi - Memcached Proxy

where can I get moxi?

Page 53: Moxi - Memcached Proxy

links

• getting moxi

• http://labs.northscale.com/moxi

• read, join list

[email protected]

Page 54: Moxi - Memcached Proxy

support, training

• available from NorthScale, Inc.

[email protected]

• 888.399.5509

[email protected]

Page 55: Moxi - Memcached Proxy

questions?

Page 57: Moxi - Memcached Proxy
Page 58: Moxi - Memcached Proxy

talking to itselfoptimization

Page 59: Moxi - Memcached Proxy

stats aggregation

moxi

memcached memcached memcached

broadcasts “stats”. sums the responses.

Page 60: Moxi - Memcached Proxy

flush_all

moxi

memcached memcached memcached

broadcasts “flush_all” to memcached servers