What is the 'best' way to fetch a bunch of documents assuming that I have a list of IDs
I know I could try various things but at small scale probably all options have similar performance. So far I have tried nothing - just read docs
Maybe there is no 'best' way but what would be the trade-offs between various methods (speed, cost, overall throughput,...)
Sigh - I knew this would get down voted - along the lines of 'what have you tried', 'we wont write your code for you' etc. I cannot do meaningful perf analysis till I have thousands of parallel requests coming simultaneously on terabytes of data. I swear I am not lazy or unwilling to put work in , just dont want to get into production and find I have perf issues and then be told 'why on earth did you do it that way?'
Some general tips on the best way to perform reads with DocumentDB.
ReadDocumentAsync
will be the best way to do this, across multiple threads each fetching a document using partition key
and id
. Each read is 1 RU per 1KB document, and under 10 ms at p99.SELECT * FROM c WHERE c.partitionKey = 'pk' AND c.id IN ('1','2',..., 'N')
will be more efficient, i.e. fewer connections from the client, and also fewer RUs on the server side (typically < 1 RU per document returned).If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With