If you call βPasteβ to insert documents one at a time, there is a circular network trip for each document. If you call InsertBatch to insert documents into packages, a round trip through the network is required for each batch instead of each document. InsertBatch is more efficient than Insert because it reduces the number of network trips.
Suppose you had to insert 1,000,000 documents, you could analyze the number of network trips for different lot sizes:
- lot size 1: 1,000,000 round trips.
- lot size 10: 100,000 round trips.
- lot size 100: 10,000 round trips.
- lot size 1000, 1000 round trips.
- etc...
So you see that even a lot size of up to 10 has already eliminated 90% of network bypasses, and a lot size of 100 has removed 99% of network bypasses.
This is a somewhat simplified analysis because it ignores the fact that as the lot size increases, message sizes are more or less accurate.
I do not think that there is any optimal lot size. I would say that larger batches are more efficient, but as soon as you have 10-100 documents per batch, you will have small performance improvements with larger batches.
source share