From the official documentation:
"Multiple keys use one network request, which is beneficial for a large number of small records, but not as beneficial when the number of records per node is small, or the data returned per record is very large.
Therefore if I have 4 nodes of ae, how many “are small” operations will be for batch writes enought?
Or I can always use batch writes nevertheless to the count of operations, except batch-max-requests setting
If you have a database cluster with 4 nodes, a batch with 20 records (read or write) will typically be split to 5 records per node… Assuming those are small records, or that a small amount of data is being updated, the trade off may still be worth it for a batch transaction but below that, let’s say if a batch will be split in about 2-3 records per node, it may be more efficient overall to do single record transactions. Best may be to try with your data and simulate both, for example with the
asbench tool and see for yourself on your environment.
If I have 5 different keys, it would be better to do a single write-batch operation or 5 parallell write requests?
For 5 keys against a 4 node cluster, it would definitely make more sense to do 5 single write transactions since each node will get one and one will get two, or something very close to that.
Does creating a batch-write request with small operations make sense for RTT and network optimization?
It does if the number of records per batch per node (total number of records per batch / cluster size) is more than just a few. And for larger records (let’s say over a few KiB), batches also make less sense.