Using Couchbase Server to Address Memcached Challenges - Webinar

2,300 views
2,096 views

Published on

Are you dealing with memcached problems like cold cache, heavy contention of RDBMS resources and lack of scale-out flexibility? Learn how A Main Hobbies and several other organizations have successfully replaced memcached tiers with a Couchbase cluster.

Join this webinar to learn about:

The common challenges faced by memcached users
How Couchbase Server can help aleviate those challenges
How other organizations have successfully deployed Couchbase Server to replace their memcached tier
...and more!

Published in: Technology
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
2,300
On SlideShare
0
From Embeds
0
Number of Embeds
40
Actions
Shares
0
Downloads
21
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide
  • If the cache is partitioned
  • If the cache is partitioned
  • 1.  A set request comes in from the application .2.  Couchbase Server responses back that they key is written3. Couchbase Server then Replicates the data out to memory in the other nodes4. At the same time it is put the data into a write que to be persisted to disk
  • 1.  A set request comes in from the application .2.  Couchbase Server responses back that they key is written3. Couchbase Server then Replicates the data out to memory in the other nodes4. At the same time it is put the data into a write que to be persisted to disk
  • 1.  A set request comes in from the application .2.  Couchbase Server responses back that they key is written3. Couchbase Server then Replicates the data out to memory in the other nodes4. At the same time it is put the data into a write que to be persisted to disk
  • 1.  A set request comes in from the application .2.  Couchbase Server responses back that they key is written3. Couchbase Server then Replicates the data out to memory in the other nodes4. At the same time it is put the data into a write que to be persisted to disk
  • 1.  A set request comes in from the application .2.  Couchbase Server responses back that they key is written3. Couchbase Server then Replicates the data out to memory in the other nodes4. At the same time it is put the data into a write que to be persisted to disk
  • In the demo, you just saw blah blahblahUnder the hood, blah blahEarlier today, you saw us walk through a fuller series of steps involving updating clientsWanted to show you here that the progress bar in the UI was showing this activity going on
  • StatsStats timingDemo 3- Stats – check how we are on time.Load: -h localhost -i1000000 –M1000 –m9900 -t8 –K sharon –c500000 -l
  • When memory pressure is building, Couchbase has Managed cached which includes replica items, when memory gets filled up beyond a point, you will backoff the replication or the
  • Chart shows average latency (response times) across varying document sizes (1KB – 16KB)It demonstrates that Couchbase Server is ridiculously fast and responds in microsecond responses. (That is latency is < 100 μsec on a 10gig Ethernet network for documents of all sizes)The network latency has an impact on a 1GIG Ethernet network, however latency is flat/ consistent on a 10GIG Ethernet networkCouchbase Server gives you a consistent, predictable latency at any document size
  • This chart shows Couchbase Server throughput in average operations per second across the number of nodes in a cluster. With 4 nodes, throughput is nearly 1.15 million ops/sec, this means that 1.4 GB/sec is being transferred between the database server and clientOperations are a mix of reads and writes in a 70:30 ratioHigh write throughput is seen even with significant sized 1KB documents This also shows linear throughput as more servers are added to the cluster. 0.62 million ops / sec with 2 nodes and 1.15 million ops / sec with 4 nodes.Demonstrates a shared nothing architecture, all nodes are identical and independentKeys are auto-sharded across the cluster and evenly distributed whether the cluster has 1 node or 8 nodes
  • Using Couchbase Server to Address Memcached Challenges - Webinar

    1. 1. Using Couchbase Server to Solve Memcached Challenges Don Pinto Product Marketing Manager Kendall Bennett CEO, A Main Hobbies Simple. Fast. Elastic. 1
    2. 2. The Problem Web Applications Need to Run Fast! But this usually means …. 2
    3. 3. Your Relational Database Needs Help App App Relational Database And so… 3
    4. 4. You Add a Cache App App Relational Database But that’s still not enough and you still have problems… 4
    5. 5. Agenda• Challenges using Memcached • Cold Cache • Heavy RDBMS Contention • Lack of Scalability • Complex Monitoring• Introducing Couchbase Server• Technical Considerations of Couchbase Server• Solutions to Memcached Challenges• Deployment Options for Couchbase Server• Using Couchbase Server at A Main Hobbies (presented by Kendall Bennett)• Q&A 5
    6. 6. Memcached Reference Architecture User Requests Application Layer Read-Write Requests Cache Misses and Write Requests ... Individual Memcached Nodes RDBMS 6
    7. 7. CHALLENGES WITH MEMCACHED 7
    8. 8. Cold Cache App App Application Individual B E F C D H Memcached Nodes A B C D E F G H RDBMS I J K L Slowdown or collapse of the RDBMS Layer 8
    9. 9. Lack of ScalabilityApplication App App App IndividualMemcached B .. E F .. C D .. H D F Nodes A B C D E F G H RDBMS I J K L Duplicate Information. Explicit Cache Warm-up. Difficult to Invalidate. 9
    10. 10. Lack of Scalability – If partitionedApplication App App App IndividualMemcached A .. D C D E .. H F G I .. L I J L Nodes A B E I C F G H RDBMS D J K L Duplicate Information. Explicit Cache Warm-up. Difficult to Invalidate. 10
    11. 11. Complex Monitoring Complicated Management of Individual Memcached Nodes Lack of Single Consistent View of the Caching Tier 11
    12. 12. COUCHBASE SERVER 12
    13. 13. Couchbase Server: Simple. Fast. Elastic. NoSQL. • Easy scalability • Scale your the database layer without any interruption or change to your application • Grow your cluster from 5 to 25 to 100 nodes and evenly distributed workloads across your cluster • Consistent High Performance • Consistent sub-millisecond response times • High throughput means fewer servers required to serve growing numbers of users • Always on • With high availability features applications are always online • Whether upgrading the database, system software or hardware - zero downtime 13
    14. 14. Memcached tier replacement use-case• Fully memcached protocol compatible. Drop-in replacement• Frequently accessed items kept in memory• Data auto-sharded and replicated across the cluster• Consistent low latency read and write operations• High Throughput• Enjoy the scalability and high-availability advantages of a Couchbase Server cluster• Single view for monitoring across the cluster 14
    15. 15. Replacing a Memcached Tier with a Couchbase Cluster User Requests Application Layer Read-Write Requests Cache Misses and Couchbase! Server Cluster! Write Requests ! ! ! ! ! ! ! ! ! ! ! ! ! ! ACTIVE ! ACTIVE ! ACTIVE ! ! ... ! ! ! ! !REPLICA !REPLICA !REPLICA ! ! ! ! ! ! ! ! ! ! ! ! ! Replication ! ! 15
    16. 16. Single node operations: Couchbase Write 2 Doc 1 App Server 3 2 3 Managed Cache To other node Replication Doc 1 Queue Disk Queue Disk Couchbase Server Node 16
    17. 17. Single node operations: Couchbase Update 2 Doc 1’ App Server 3 2 3 Managed Cache To other node Replication 1 Doc 1’ Queue Disk Queue Disk Doc 1 Couchbase Server Node 17
    18. 18. Single node operations: Couchbase Read 2 Doc 1 GET App Server 3 2 3 Managed Cache To other node Replication Queue Doc 1 Disk Queue Disk Doc 1 Couchbase Server Node 18
    19. 19. Single node operations: Couchbase Cache Eviction 2 Doc 5 3 2 4 6 App Server 3 2 3 Managed Cache To other node Replication Doc 1 Queue Disk Queue Disk Doc 1 Doc 6 Doc 5 Doc 4 Doc 3 Doc 2 Couchbase Server Node 19
    20. 20. Single node operations: Couchbase Cache Miss 2 Doc 1 GET App Server 3 2 3 Managed Cache To other node Replication Queue Doc 1 Doc 5 4 4 Doc Doc Doc 3 2 Doc Disk Queue Disk Doc 1 Doc 6 Doc 5 Doc 4 Doc 3 Doc 2 Couchbase Server Node 20
    21. 21. Cluster wide operations: Add Nodes APP SERVER 1 APP SERVER 2 COUCHBASE CLIENT LIBRARY COUCHBASE CLIENT LIBRARY CLUSTER MAP CLUSTER MAP Read/Write/Update Read/Write/Update SERVER 1 SERVER 2 SERVER 3 SERVER 4 SERVER 5 Active Docs Active Docs Active Docs Active Docs Active Docs Active Docs Doc 5 DOC Doc 4 DOC Doc 1 DOC Doc 3 Doc 2 DOC Doc 7 DOC Doc 3 DOC Doc 6 Doc 9 DOC Doc 8 DOC Doc 6 DOC Replica Docs Replica Docs Replica Docs Replica Docs Replica Docs Replica Docs Doc 4 DOC Doc 6 DOC Doc 7 DOC Doc 7 Doc 1 DOC Doc 3 DOC Doc 9 DOC Doc 9 Doc 8 DOC Doc 2 DOC Doc 5 DOC COUCHBASE SERVER CLUSTER 21
    22. 22. Cluster wide operations: Failover APP SERVER 1 APP SERVER 2 COUCHBASE CLIENT LIBRARY COUCHBASE CLIENT LIBRARY CLUSTER MAP CLUSTER MAP SERVER 1 SERVER 2 SERVER 3 SERVER 4 SERVER 5 Active Docs Active Docs Active Docs Active Docs Active Docs Active Docs Doc 5 DOC Doc 4 DOC Doc 1 DOC Doc 9 DOC Doc 6 DOC Doc 3 Doc 2 DOC Doc 7 DOC Doc 3 Doc 8 DOC Doc 6 DOC Replica Docs Replica Docs Replica Docs Replica Docs Replica Docs Replica Docs Doc 4 DOC Doc 6 DOC Doc 7 DOC Doc 5 DOC Doc 8 DOC Doc 7 Doc 1 DOC Doc 3 DOC Doc 9 DOC Doc 2 DOC Doc 9 COUCHBASE SERVER CLUSTER 22
    23. 23. Monitoring • Real-time traffic graphs • Per bucket, per node and aggregate statistics • Application and inter-node traffic • RAM <-> Disk • REST API 23
    24. 24. Deployment Options 24
    25. 25. Technical Considerations • Ejection instead of eviction • Increased disk and network I/O • Memory pressure and bulk-loading • Sizing changes • Database warm-up 25
    26. 26. COUCHBASE SERVER AT A MAIN HOBBIESHow we use it today and plans for the future Kendall Bennett CEO, A Main Hobbies 26
    27. 27. About Kendall Bennett • Founder and CEO of A Main Hobbies • Leading online internet retailer of radio controlled cars, trucks, helicopters and airplanes • Computer programmer with over 20 years of industry experience • Prior company, SciTech Software, Inc. was a computer software library developer 27
    28. 28. Prior Solution • Database server runs on Linux using MySQL • Web server runs on ASP.NET on Windows using a combination of PHP code compiled with Phalanger and ASP.NET MVC written in C# • Caching was done using the Window File System – Cached SQL result sets and HTML fragments using the disk to speed up page load times - Poor Performance! • Started looking for a high-performance caching solution 28
    29. 29. Using Couchbase Server as a cache • We deployed it live and immediately noticed speed improvements on the web site • With a better caching solution we spent more time improving what we cached for even more performance 29
    30. 30. Using Sentinels to Invalidate the Cache • We needed the ability to invalidate large chunks of the cache quickly based on user events (such as editing a product category, etc). • Keeping track of all the cached entries in a list was the initial solution, but adds a lot of overhead when reading and writing cache entries to update the lists • A better solution is to use sentinel objects to invalidate cache entries • Writing to the cache is extremely fast, as it does nothing but write the actual data • Reading from the cache checks a list of sentinels to see if they have changed since the last read • Writing the most recently read sentinel list is done inside the read before it returns a failure 30
    31. 31. ICacheStore Interface • public interface ICacheStore • { • /// <summary> • /// Writes out a serialized object to the cache • /// </summary> • /// <param name="o">Object to write to the cache</param> • /// <param name="group">Cache group that this item belongs to</param> • /// <param name="key">Key name for this cache item</param> • /// <param name="expiresAt">Optional date/time stamp that the cached item will expire at</param> • void Write( • object o, • string group, • string key, • DateTime? expiresAt); • /// <summary> • /// Reads a serialized object from the cache • /// </summary> • /// <param name="o">Place to return the object read from the cache</param> • /// <param name="group">Cache group that this item belongs to</param> • /// <param name="key">Key name for this cache item</param> • /// <param name="dependencies">List of dependent sentinels this item is dependent on</param> • /// <returns>True if the item was read from the cache, false if not</returns> • bool Read( • out object o, • string group, • string key, • List<string> dependencies = null); • /// <summary> • /// Invalidates all the cache entries for this specific cache sentinel value • /// </summary> • /// <param name="sentinel">Name of the sentinel to invalidate (group name or dependent sentinel)</param> • void InvalidateCache( • string sentinel); • /// <summary> • /// Returns the current value for a cache sentinel. This value will increment on each invalidation • /// so you can tell if it was invalidated if the number changes • /// </summary> • /// <param name="sentinel">Name of the sentinel to read the value for</param> • string GetCacheSentinel( • string sentinel); • } 31
    32. 32. ASP.NET Session State Provider withCouchbase • Previously we stored session data in MySQL with a customer session state provider • To improve performance we moved the session state store to Couchbase using a modified version of the Couchbase ASP.NET library • Session date is stored in persistent Couchbase buckets • Performance is excellent and takes load off of our MySQL server • Security is enhanced as it is not possible for hackers to query the data from the session store for all sessions 32
    33. 33. ASP.NET Output Cache Provider withCouchbase • We wanted a full page cache for our site for spiders such as Google when they crawl it, updated only once per day • ASP.NET has a great Output Cache system already, so we wrote an Output Cache provider for it using Couchbase • Watch out for session Cookies! The ASP.NET Output Cache will not work if the page tries to set a Cookie! • Make sure you disable session when you know a spider is looking (we use Javascript to set a cookie so we know a real browser is looking) 33
    34. 34. Future Directions • Our goal is to replace MySQL for basic site data such as product pages, information pages, etc and store those in a Couchbase persistent NoSQL store • MySQL will be kept for the core transactional component of placing orders and managing inventory levels • That way we can scale the web site more easily as Couchbase can scale out better than MySQL and keep the load down on the MySQL server • We need the ability to index data in the NoSQL store, so we are waiting on Couchbase 2.0 to be released before we move forward 34
    35. 35. More Information • More information can be found on my blog • http://www.AMainHobbies.com/FromTheCEO 35
    36. 36. References• http://www.couchbase.com• http://www.couchbase.com/memcached• http://blog.couchbase.com/understanding-performance- benchmark-published-cisco-and-solarflare-using-couchbase- server(Cisco Performance Benchmark)• http://www.couchbase.com/docs/couchbase-manual- 1.8/couchbase-bestpractice-sizing.html (Sizing Guide)• don@couchbase.com (My email) 36
    37. 37. Coming September 21, 2012 SAN FRANCISCO Featured speakers include: Use promo code WEBINAR and get 10% off. http://www.couchbase.com/couchconf-san-francisco 37
    38. 38. Q&A 38
    39. 39. APPENDIX 39
    40. 40. Key results of Cisco benchmarkCouchbase Server demonstrates• Consistent sub-millisecond latency for mixed workload• High throughput• Linear scalability 40
    41. 41. Consistent low latency with varying doc sizes Consistently low latencies in microseconds for varying documents sizes with a mixed workload 41
    42. 42. High throughput that scales linearly High throughput with 1.4 GB/sec data transfer rate using 4 servers Linear throughput scalability 42

    ×