Reputation: 723
I've setup an Azure batch process to read multiple csv files at the same time and write to Azure DocumentDb. I need a suggestion on the consistency level that fits the best for me.
I read through the consistency levels document(http://azure.microsoft.com/en-us/documentation/articles/documentdb-consistency-levels/) but am unable to relate my business case to the options provided in there.
My process
Get Document by Id
-If found then will pull a copy of the document, update changes and replace it.
-If not found, create a new entry.
Upvotes: 0
Views: 742
Reputation: 142
if your writes and reads are from the same process (or you can share an instance of the documentclient) then session consistency will give you the best performance while ensuring you get consistent reads. This is because each SDK manages the session tokens ensuring that the read goes to a replica that has seen the write. Even if you don't do this, in your case the write will fail if you use the same document id. Within a collection, document ids are guaranteed to be unique.
Short version - session consistency (the default) is probably a good choice.
Upvotes: 4