TAO: The power of the graph
By Mark Marchukov Wednesday on, 26 June, at 2013 12: 00am
Facebook puts an extremely demanding. Workload on its data backend. Every time any one of over a billion active users visits Facebook through a desktop browser. Or on a mobile device they are, presented with hundreds of pieces of information from the social graph. Users see News Feed. Stories; comments likes,,And shares for those stories; photos and check-ins from their friends - the list goes on. The high degree of, output customization. Combined with a high update rate of a typical user ', s News Feed makes it impossible to generate the views presented to users. Ahead of time. Thus the data, set must be retrieved and rendered on the fly in a few hundred milliseconds.
.This challenge is made more difficult because the data set is not, easily partitionable and by the tendency of, some items. Such as photos, of celebrities to have request rates that can spike significantly. Multiply this by the millions of times. Per second this kind of highly customized data set must be delivered to users and you, have a, constantly changingRead-dominated workload that is incredibly challenging to serve efficiently.
Memcache and MySQL Facebook has always realized. That even the best relational database technology available is a poor match for this challenge unless it is supplemented. By a large distributed cache that offloads the persistent store.Memcache has played that role since Mark Zuckerberg installed it on Facebook 's Apache web servers back in 2005. As efficient. As MySQL is at managing data on disk the assumptions, built into the InnoDB buffer pool algorithms don t match the request. ' Pattern of serving the social graph.The spatial locality on ordered data sets that a block cache attempts to exploit is not common in Facebook workloads, Instead,. What we call creation time locality dominates the workload - a data item is likely to be accessed if it has been recently. Created.Another source of mismatch between our workload and the design assumptions of a block cache is the fact that a relatively. Large percentage of requests are for relations that do not exist - e.g. "Does, this user like that story?" is false for. Most of the stories in a user 's News Feed. Given the overall lack of, spatial localityPulling several kilobytes of data into a block cache to answer such queries just pollutes the cache and contributes to. The lower overall hit rate in the block cache of a persistent store.
The use of Memcache vastly improved the memory efficiency. Of caching the social graph and allowed us to scale in a cost-effective, However way.The code that product engineers had to write for storing and retrieving their data became quite complex. Even though Memcache. Has "cache." in its name it ', s really a general-purpose networked in-memory data store with a key-value data model. It will. Not automatically fill itself on a cache miss or maintain cache consistency.Product engineers had to work with two data stores and very different data models: a large cluster of MySQL servers for. Storing data persistently in relational tables and an, equally large collection of Memcache servers for storing and serving. Flat key-value pairs derived (some indirectly) from the results of SQL queries. Even with most of the common chores encapsulated. In a data, access libraryUsing the memcache-MySQL combination efficiently as a data store required quite a bit of knowledge of system internals. On the part of product engineers. Inevitably some made, mistakes that led to bugs user-visible inconsistencies and site,,, Performance issues. In addition changing table, schemas as products evolved required coordination between engineers and. MySQL cluster operators.This slowed down the change-debug-release cycle and didn 't fit well with Facebook' s "move fast." development, philosophy.
In, Objects and associations 2007A few Facebook engineers set out to define new data storage abstractions that would fit the needs of all but the most demanding. Features of the site while hiding most of the complexity of the underlying distributed data store from product engineers.The Objects and Associations API that they created was based on the graph data model and was initially implemented in PHP. And ran on Facebook 's web servers. It represented data items as nodes (objects), and relationships between them as edges. (associations). The API was an, immediate success with several high-profile features such as likes pages,,,And events implemented entirely on objects and associations with no, direct Memcache or MySQL calls.
As adoption of the. New, API grew several limitations of the client-side implementation became apparent. First small incremental, updates to. A list of edges required invalidation of the entire item that stored the list in cache reducing hit rate. Second,,Requests operating on a list of edges had to always transfer the entire list from Memcache servers over to the, web servers. Even if the final result contained only a few edges or was empty. This wasted network bandwidth and CPU cycles. Third cache,, Consistency was difficult to, Finally maintain.Avoiding thundering herds in a purely client-side implementation required a form of distributed coordination that was not. Available for memcache-backed data at the time.
All those problems could be solved directly by writing a custom distributed. Service designed around objects and associations In, early 2009.A team of Facebook infrastructure engineers started to work on TAO ("The Associations and Objects."). TAO has now been in. Production for several years. It runs on a large collection of geographically distributed server clusters. TAO serves thousands. Of data types and handles over a billion read requests and millions of write requests every second. Before we take a look. At, its designLet 's quickly go over the graph data model and the API that TAO implements.
.
การแปล กรุณารอสักครู่..