educative.io

Educative

Who will generate the increasing number for twitter_id?

One or two centralized nodes?
If it is the case, it is a single point of failure. If use two, it may not be the strictly ordered by timestamp.

Each service nodes itself?


Type your question above this line.

Course: https://www.educative.io/collection/5668639101419520/5649050225344512
Lesson: https://www.educative.io/collection/page/5668639101419520/5649050225344512/5741031244955648

Yes, if there is only one aggregate server, it will be a single point of failure. That is why we have many, and any one of them should be able to service timeline making requests. A load-balancer can select which aggregate server to use. (Any aggregate server can do the job because it can contact DB shards to collect the required state.). Now, if tweet-Id has wall-clock time in it (as specified in the lecture) and we assume that clocks across servers are synchronized (at least at a second granularity), then tweet ordering will match real wall-clock ordering except for those tweets that came in, at the same second (in that case time bits for all tweets in a specific second will be the same, and only sequence no will be different. So, in other words, we used an artificial order in that case). Now, synchronizing clocks in a distributed system is not a trivial problem but is doable.
Thank you for your feedback.