[TECH] HOW DOES FACEBOOK LOGIN WORKS?

Words
386
Reading
2 min
Listen
Play
8y

Have you ever wondered what's going on under the hood when you tap on your blue facebook app on your mobile ? If yes, this is article is for you, otherwise, it might be interesting for you as well (and you should start wondering how things works ! ).

You should already have heard about the Distributed Architectures design and approach for IT infrastructure, where briefly data is no longer stored in a single structure but is replicated across several nodes around the globe. In particular, big companies set up at least 5 replicas for storing replicated data, where 3 of them needs to be dislocated each on a different continent in order to resist even in case of natural disaster. Note, that each center of this 5+ replicas is not a single machine but can be a whole data center building or in smaller environments, a set of machines (nodes of nodes).

This architectural pattern is extremely scalable and flexible because allows to detach easy QUERY operations from UPDATE operations performed by clients. I'll try to be more deep on this.

[Source:jaksa.wordpress.com]

As you can see from image, in an active replication system, all the requestes are directed to the MASTER REPLICA, which will update its status and then broadcast an UPDATE STATUS to all the other replica slaves, waiting back for an ACKNOWLEDGMENT. On the other side, in a passive replication system there is no master replica who handles all the requests, but clients are directly connected to a "random" (not random, geographically closest ) replica where data is updated or retrieved.

Now, Facebook simply uses an hybrid approach, since if you have to write an update status you are connected to the main replica, otherwise if you just open the app for scrolling the feed you are connected to a generic replica.
You can check yourself this behaviour because if you type a status, exit from the application and restart immediately you might not see your updated status because the replica where you are connected to, might not have received the status update yet from the master.
Again, if you open simultaneously the app from your mobile and from a desktop connected with uour home line you might see different feeds, this because you might not are connected to the same replica !

[TECH] HOW DOES FACEBOOK LOGIN WORKS? | Ecency