The other answers here are great, I just would point out that Facebook are likely using a Graph Database to link you to your activities. It is much faster for this kind of application. All actual data for each of those nodes would be stored in something like MySQL or PostgreSQL.