Sample Header Ad - 728x90

How does instagram handle top likes when there are millions of likes for a particular post?

0 votes
1 answer
920 views
Under each Instagram post is a text like this : > friendA, friendB and 32,312 others liked this post Saving count of likes in a column can be an easy way to get related data. But the fact that Instagram shows specific results based on each persons friends, makes me wonder how do they do that ? retrieving and processing such a many to many relationship of user's follows with potentially millions of likes for a post sounds like a huge resource heavy action that even Facebook might have trouble handling. And it certainly happens server side for two reasons: A) When there are millions of likes, it would've taken minutes before all like data was downloaded by user. B) You can see that Instagram returns top likes from backend. for example for this post Justin Bieber's page there is a request to this endpoint Instagram Api endpoint which returns an object including : like_count 3213371 has_liked false top_likers [ "friendA" ] So my question is what tricks do they use to have this functionality at scales ?
Asked by Pooya Estakhri (149 rep)
Jun 27, 2022, 06:56 AM
Last activity: Jun 27, 2022, 12:22 PM