Identify requests from clients uniquely so you can ignore duplicate requests when client retries
Clients send requests to servers but might not get a response. It's impossible for clients to know if the response was lost or the server crashed before processing the request. To make sure its request is processed, the client has to resend the request.
If a server had already processed the request and crashed after that, servers will get duplicate requests from the client when it retries.
Identify a client uniquely by assigning a unique ID to each client.
When the server receives a request, it checks if the request with the given request number from the same client is already processed. If it finds a saved response, it returns the same response to the client, without processing the request again.
for more details go to Chapter 15 of the online ebook at oreilly.com
This pattern is part of Patterns of Distributed Systems
23 November 2023