How LinkedIn Uses Memcached
Memcached is an open-source memory system for Web applications. Websites use memcached on their servers to gain more flexibility in how applications access memory. WordPress, LiveJournal, Wikipedia, Craigslist and LinkedIn are among the websites that employ memcached to keep up with users' demands as the sites becomes busier and more popular.
-
Memcached
-
Memcached works by pooling the available memory on your servers. Instead of having three servers with 128 megabytes of memory available apiece, memcached combines the memory into a pool of 384 megabytes. That makes it easier to allocate large blocks of memory wherever they're needed and reduces the risk of small chunks of memory sitting idle on one server. All data is stored and retrieved from the same spot in memory, no matter which server a user accesses, speeding up the servers' ability to answer requests.
LinkedIn
-
LinkedIn launched as a business networking site in 2003 with 350 members. Within a year it had 500,000 members, and by 2010 it had exceeded 65 million. The tremendous success brought challenges with it: Like other popular websites, LinkedIn had to scale -- keep service efficient to cope with the increased demand -- in order to stay successful. One solution to scaling was to create caches of data to provide users with information.
-
Caches
-
When a website refers a user request to the server, the server searches in its memory, finds the data requested, and returns it. As site use scales upward, the number of requests the server deals with increases, which slows down response time and adds to the bandwidth required. Caches ease the demand on LinkedIn's servers by storing information that's been accessed recently or repeatedly requested by different users. It's easier and faster for LinkedIn to retrieve data from the cache than the servers, which improves the request response time.
LinkedIn Design
-
LinkedIn engineers state that simply increasing the size of the database isn't a good solution to scaling the system because scaling databases requires adding hardware. Instead, they built the system around a data bus that routes replicated data and stores copies of the most frequently used information in the cache. The cache system employs memcached because it provides a large pool of cheap memory. The caches handle most user requests, with the databases picking up those the cache can't answer.
-