![]() ![]() otype specifies the possible keys and value type. Additionally, each object/node can have a list of key-value pairs. The id column stores the unique id of the object. In the following sections, object and node mean the same thing. ![]() Surprisingly, Facebook uses only two database tables to represent the social graph that captures the activities of its one billion users, object table and association table. The nodes between Cathey and the comment indicates that Cathey is the author.įinally, when David likes the comments, 2 new edges are added to the social graph that shows David likes the comment. The edge between the post and the comment shows that the comment node is the comment to the post. A new node the represents the comment is added to the social graph. When the user Cathey adds a comment to the post, it will also change the social graph. The edges between Bob and the post means that the post tagged the user Bob. The edges between Alice and the post represents that Alice authored the post. 4 new edges are added to the social graph as well. A new node representing the Post is added to the social graph. When the user Alice creates the post, the following changes will be applied to the social graph. (Edges that represent friendship between Alice and Bob etc. Inside the Facebook system, node is referred to as object.) There are 2 edges between each pair of the users that represents one is a friend of the other. (otype is an abbreviation for object type. For instance, the node representing the user Alice has ID 105 and otype as User. Inside the social graph, 4 nodes already exist, 1 for each user. Assume the users, Alice, Bob, Cathey and David are already friends. The post, comment and like will result a few changes to the social graph, as illustrated in the figured below. The user Cathey comments on the post, which David likes. For example, one edge could mean that a particular user created a particular post.įor example, let’s imagine that the user Alice creates a post and tags the user Bob, as illustrated below. An edge represents the relationships between the nodes.A node represents an entity, such a user, a post, a comment and a location.There are two elements inside a social graph, nodes and edges. How Facebook scaled its infrastructure, including servers, cache and databases, to serve 1 billion reads and millions of writes per second.įacebook stores majority, if not all, of users’ data, such as profiles, friends, posts and comments, inside a single giant social graph.How the social graph is modeled and stored, that is, the database schema adopted by Facebook.In this blog, I will mainly discuss two aspects of Facebook’s backend system: Facebook has more than 1 billion active users who record their relationships, share their interests, upload and comment on text, images and videos. There is no need for an introduction to Facebook. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |