3 ms·
If this was required, the solution wouldn't be too bad. There is a latency penalty, but in a normal browser on a normal computer, FB doesn't feel that close to
by toast0 6y ago
If this was required, the solution wouldn't be too bad. There is a latency penalty, but in a normal browser on a normal computer, FB doesn't feel that close to the latency minimums as it is.
Option A) client sends feed request to all regulatory domains and mixes results itself. Downside is either you'd always see the tail content from all regions, or client would have fetched content it doesn't display. Also, if client has to contact a load balancer in the regulatory domain directly, you're at the mercy of the client's international transit which is often worse than FB's.
Option B), like option A, but client sends feed request to nearest server, nearest server bifurcates the request to one per regulatory domain. If regulatory domain is local, satisfy request (with all the sharded queries), otherwise send it to a request processor with local data and do the processing there. Feed request processor mixes the data. Downside, extra memory used holding results waiting for the remote regions to respond and managing more requests in progress. You could get tricky and use recent response times to try to get all responses back around the same time, and reduce the time where you had some region's data in memory, but not all of them, but that's probably silly.
Both of these are more work than the current scheme, and nobody likes regulation requiring more work, but still. Figuring out where things are permitted to be stored when they involve people in multiple domains sounds like a headache though. And actually splitting the data once the parameters are clear doesn't sound like my kind of fun either.
Disclosure: I worked at FB, but not with FB user data.
- evanelias 6y agoAs someone who spent a decade working on databases and scalability at multiple social networks (including FB), I believe this problem is substantially more difficult than you're taking into consideration here. Viewing a couple pages of my news feed randomly just now, I see content from a mix of friends in the U.S., Ireland, Germany, the U.K., and Hong Kong. The content is algorithmically ranked and sorted, and then paginated. Similar situation with viewing comments on popular pages, which may span many countries. If ranking/sorting is performed either client-side (your option A) or even in a nearby aggregation server (B), each and every user-facing pageload of N posts/comments/whatever would need to fetch the worst-case of N entries from each regulatory domain, and then re-rank/sort/paginate the aggregation of them. This presents numerous significant problems: not just network latency on every single page load (which would be severe), but also bandwidth consumption, memory, and cpu wherever the aggregation/ranking are being performed. I don't think your option A is even feasible for a worldwide social network, with many users in countries where less powerful devices are prevalent. Even option B would have scary implications for the worldwide increase in network bandwidth consumption alone. And that's not even considering the problem of how you migrate one of the largest data sets in human history from a non-geo-sharded topology to a geo-sharded one. Worst-case, multiply all of this effort (and bandwidth impact) by every single multi-national social network, publishing platform, and user-generated content site/app/product. The GDPR-compliance efforts of 2017-2018, which were quite substantial at all of these companies, would look like peanuts in comparison.