Windows Azure Storage REST API: Conditional PUT operations by using the If-Match request header

As you may know using Windows Azure storage service REST API you can perform conditional PUToperations by using the If-Match request header on your client code. 

Here is an interesting scenario:  

You have two clients and they both are modifying the same resource by sending the same if-match header. Lets assuming that both client requests reach Azure service at exactly the same time. What will happen?

You might want to know how does Windows Azure handle this concurrency control in a distributed environment.

 

Here are the details:

The correct answer is "only one client will succeed". In above scenario, it is certain that only one client succeeds, and the other client receiving a 412 (precondition failed) response.

This is because, each update creates a new ETag for the object, so only one update will match and conditional operation succeed and the other one get precondition failed response. 

Each update is a single transaction, so the concurrent operations will behave as though one of them happened after the other.