NonFunc-Reliability
Last updated
Was this helpful?
Last updated
Was this helpful?
No missing
No duplication
Limitations: Suppose that after step3 and confirm that the user is online, the user becomes offline, or the network between user and server becomes disconnected. In these cases, the server would either get stuck in a resending loop.
From reliability perspective, it is always better to save the message first.
IM server sends the message in step 7, but does not actually know whether client B successfully receive it.
Cons:
Here completeness check actually assume that the sequence id is continuously increasing, which is hard to achieve in a distributed system setting.
The continuously increasing id could be replaced with two ids (the later id contains a reference to a previous id).
Problem:
In the above flowchart, client B retrieves offline message from client A. And this process will repeat for each of its contact
Optimization ways:
Only fetch the number of offline messages for each friend. Only when the user enters the conversation, load actual messages.
Pull all offline messages sent to client B at once. Then dedupe and categorize by senderId.
In practice, this solution is preferred over 1 because it reduces number of round trips.
If there are too many messages to pull for offline users, then could separate messages into different pages.
When use paging, to avoid too many applayer acknowledgement packages, the next page could be used as the acknowledge for previous page.