Implementing High Availability Caching with Memcached

Click here to load reader

  • date post

  • Category


  • view

  • download


Embed Size (px)


Typical Memcached deployments do not comprehensively address web site requirements for high availability. Depending on your web architecture, a single failure can disable your web caches. This presentation offers real world solutions to solving high availability challenges common to large, dynamic websites with Memcached, specifically: * Options and benefits for deploying high availability services within Memcached * How companies are approaching high availability * Considerations on building and deploying high availability o Recommendations for a typical Memcached environment o Open source tools available o High level costs for deployment

Transcript of Implementing High Availability Caching with Memcached

  • 1. Creating High Availability Services for Your Memcached Environment Presented by:Bill Takacs Director, Product Management 25 August 2009

2. Agenda Overview of Memcached High Availability dened Why HA Memcached Options for HA Memcached Gear6 Solution2 : Copyright 2009 Gear6 Inc. 3. Memcached A high performance, distributed memory objectcaching system, generic in nature, but intended for use in speeding up dynamic web applications byalleviating database load Ref: Big hash table Created by Danga Interactive for Live Journal Signicantly reduced database load Perfect for web sites with high database load In use by Facebook, Twitter, MyYearBook, others3 : Copyright 2009 Gear6 Inc. 4. More on Memcached Takes advantage of available DRAM Open source Distributed under BSD license Server - Current version is 1.4 Many Clients 4 : Copyright 2009 Gear6 Inc. 5. How Does Memcached Work? Client - Server Hash Function Memcached Two stage Key / value pair 5 : Copyright 2009 Gear6 Inc. 6. Memcached Server Slab allocator Libevent based Simple Protocol (no xml) Server has internal hash table Servers are dumb they dont know about each other 6 : Copyright 2009 Gear6 Inc. 7. Memcached Server Limits Key size = (250 bytes) 1MB Limit 32bit/64bit (maximum size of process) LRU Least recently accessed items are cycled out One LRU exists per slab class LRU evictions need not be common Threads? Yes7 : Copyright 2009 Gear6 Inc. 8. Memcached Clients Client hashes key to server list Serializes the object Many client libraries Authentication 8 : Copyright 2009 Gear6 Inc. 9. Commands Storage commands: Set / Add / Replace /Append / Prepend / CAS Retrieval commands: Get / Gets Delete / increment /decrement Stats 9 : Copyright 2009 Gear6 Inc. 10. High Availability High availability: Systemdesign and implementationthat ensures a certainabsolute degree ofoperational continuityduring a given measurementperiod. Organizations OpenSAF Foundation SAFourm HA for Memcache10 : Copyright 2009 Gear6 Inc. 11. Key Concepts Clustering Failover Replication 11 : Copyright 2009 Gear6 Inc. 12. The case for HA Memcache What Memcache is NOT: A persistent data store A database Application specic Clustered A large object cache The intent is if its not in cache hit the DB Great when your sites traffic is small Lets look at the evolution of a site 12 : Copyright 2009 Gear6 Inc. 13. The BeginningWeb Servers MySQLDatabase 13 : Copyright 2009 Gear6 Inc. 14. Web traffic growsMemcached Web Servers Memcached MySQL MemcachedDatabaseDynamic content: Result: Site slows down or worse site unavailable14 : Copyright 2009 Gear6 Inc. 15. Add Memcached as traffic increasesWeb Servers MySQL MemcachedDatabaseMemcached Increases performance but as the site grows so does Memcached 15 : Copyright 2009 Gear6 Inc. 16. Even more traffic Web Servers MySQLDatabasesMemcached Memcached Memcache Server(s)Memcached Reliance on memcached for performance 16 : Copyright 2009 Gear6 Inc. 17. Options for HA MemcachedNot Many DIY Or - Find a solution that leverages memcached thathas high availability features 17 : Copyright 2009 Gear6 Inc. 18. Consistent Hashing Why? How does it work? Where 18 : Copyright 2009 Gear6 Inc. 19. Consistent Hashing - Example PHP Flexihash