There are three things today that an application needs to survive in today’s demanding world: scale, security, and performance.
It is because of both scale and performance that Memcached has become such a popular solution in modern application architectures. It aids in scalability by offloading database requests, which naturally increases the capacity of the database to answer queries not answerable by Memcached. It improves performance, of course, by providing very fast responses to queries that in turn, are able to be returned to the user with greater alacrity.
From Memcached's site:
Memcached is a free & open source, high-performance , distributed memory object caching system , generic in nature, but intended for use in speeding up dynamic web applications by alleviating database load.
Memcached is an in-memory key-value store for small chunks of arbitrary data (strings, objects) from results of database calls, API calls, or page rendering.
It’s in-memory, which makes it fast. Disk I/O is one of the most latency-incurring actions on any given system, so eliminating the need to go to disk to seek out data–which is pretty much a requirement in a database system–is critical to improving performance. And it’s based on key-value pairs, the basis for NoSQL databases which have arisen in response to the need to speed up access to traditional relational databases (like MySQL, Microsoft SQL, and Oracle) that are far more complex under the covers.
Basically, it’s an excellent addition to app architectures seeking a performance (and capacity) boost. Given that 60% of developers in an informal survey at AWS re:Invent in 2014 said performance was their biggest database challenge, it’s easy to understand why systems like Redis ( another NoSQL option for which 27% of developers in the same survey said they chose for “speed” or “performance” ) and Memcached are popular today.
That said, Memcached servers suffer from a few shortcomings: they’re a single point of failure, they don’t scale so great, and they suffer from network interface saturation. These are problematic because if the system fails, requests fall-back to the database. And if the database scaled and performed well enough to satisfy consumers (and developers) then Memcached wouldn’t be deployed in the first place, would it? It’s likely to cause outages–both the real kind (database has crashed) and the perceived outages that happen thanks to timeouts caused by overwhelmed servers. Similarly, network interface saturation is going to cause all sorts of performance issues that arise from any other kind of congestion–time outs and increased latency–that, once onset begins, will continue to compound until the app is pretty much unusable.
In other words, the availability and performance of Memcached is as critical as the availability and performance of the app it was put in place to assist.
Which is where We (the corporate F5 ‘we’) come in.
BIG-IP can, of course, load balance the heck out of web traffic in general, but did you know it can distribute load across an array of Memcached servers?
Yup, it sure can. It can also provide the redundancy (failover) necessary to avoid the single point of failure problem, and has greater network interface capacity (and can aggregate multiple interfaces) meaning it can address the problem of interface saturation.
But back to the scaling, BIG-IP has the visibility (because it’s a full proxy) necessary to extract Memcached key values from its binary protocol and then consistently (persistently) distribute requests to the appropriate Memcached server. This is basically a very simple sharding pattern, in the network, using Memcached servers chosen based on the use of CARP (Cache Array Routing Protocol) to hash the Memcached key and select the best pool member for delivery. Once the Memcached server has been elected for a particular key, the consistency inherent in CARP ensures that subsequent requests for that key-value pair will be directed to the same Memcached server.
For those of you who want to give it a try, check out this iApp template for deploying Memcached request routing on BIG-IP .