Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    Senior Coder
    Join Date
    Dec 2004
    Location
    Essex, UK
    Posts
    2,636
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How does Facebook store all of that information?

    Hello! It seems my last post here was 2006, when I kind-of went 'off' web development... apologies for that!

    As it is something I want to go back into, I figured I may as well ask this question which has been puzzling me!

    How does a site such as Facebook store all of the data created?

    There is so much going on - 'like's', comments, wall posts, etc.

    Sure, I realise user information will be stored in a MYSQL database, but how do they store for instance the fact one user likes another users' particular status update, or a comment on one particular photo?

    Any information on the subject would be greatly appreciated as I'd like to do a bit of learning really!

  • #2
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    They likely have tables for each type of data and then they probably have a column that keeps track of the user who commented on such photo. They know what photo by the photo id in the address bar. They store the comment, the id of the user who made the comment and the id of the photo in likely another table and when it comes time to know the comments they look up the comments table and display them for the particular photo. That is just a brief example of how its likely done but its similar with the other data on the site.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #3
    Master Coder
    Join Date
    Apr 2003
    Location
    in my house
    Posts
    5,211
    Thanks
    39
    Thanked 201 Times in 197 Posts
    Is it likely to be MySQL or could it perhaps be oracle or one of the others?

    bazz
    "The day you stop learning is the day you become obsolete"! - my late Dad.

    Why do some people say "I don't know for sure"? If they don't know for sure then, they don't know!
    Useful MySQL resource
    Useful MySQL link

  • #4
    Senior Coder
    Join Date
    Dec 2004
    Location
    Essex, UK
    Posts
    2,636
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks, I guess I underestimated how big their database could be!

    Bazz - pretty sure I read somewhere before that they do use MySQL.

    Actually I just had another quick search and found this on their blog:
    "Although Facebook's data is stored in MySQL database servers, we use a large number of memcached servers to store copies of the data. Memcached is much faster and able to keep up with requests quicker than the databases themselves can keep up."

    I might do some more reading!

  • #5
    Senior Coder
    Join Date
    Dec 2004
    Location
    Essex, UK
    Posts
    2,636
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I just found this which (although a bit out of date now) is quite interesting -


  • #6
    New Coder
    Join Date
    Oct 2008
    Location
    UK
    Posts
    20
    Thanks
    0
    Thanked 1 Time in 1 Post
    Quote Originally Posted by mark87 View Post
    I just found this which (although a bit out of date now) is quite interesting -
    That diagram is quite useful for answering the more general question of your original post which really boils down to 'how do you store complex information, such as human relationships and interactions, in a computer.' Bear in mind as well that the diagram is a class diagram, not a db diagram.

    Of course, in reality, Facebook's actual data structure will be many magnitudes more complex than a database with 20 tables.
    Alibaabaa.co.uk - for aimless ramblings on technology and other minutia.

  • #7
    Rockstar Coder
    Join Date
    Jun 2002
    Location
    USA
    Posts
    9,074
    Thanks
    1
    Thanked 328 Times in 324 Posts
    Interesting thread, that class diagram is pretty interesting too.

    I'd hope as their site has grown and new features have been added that their database schema was designed with this in mind. So that adding new features would be easy, but it could also be that their database schema is a total mess.
    OracleGuy


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •