Here is my pseudocode:
int BatchSet(const std::vector<KeyValue> key_values)
{
fdb_database_create_transaction(db, &tr);
for (const auto& kv : key_values)
{
fdb_transaction_set(tr, kv.key, kv.klen, kv.value, kv.vlen);
}
fdb_transaction_commit(tr);
}
And I concurrently start 4000 tasks in 10ms, each task would call BatchSet
1 times with about 1KB data.
The result is interesting, there is obvious stratification in latency of BatchSet
.
First few tasks(about 100) cost 2~10ms, then other few task(about 100) cost 50~60ms, most of left tasks cost 200~250ms.
(And I have also seen a result that the latency increase by 50ms, all the latency are in ranges 2~10ms
, 50~60ms
, 100~110ms
, 150~200ms
…)
Is this result normal? Or any rate limiter to increase the write latency?