Are there any examples of concurrent reading / writing for KV storage?

I would like to have concurrent read / write for multiple KV keys. I can’t seem to find it online. Can anyone please provide the examples for it? Thanks.

Basically if I need to wait for the read, it needs around 10ms for each read, which is kind of slow. How do I perform concurrent reads?

What do you mean by examples of concurrent? You would use the standard async methods for multiple promises. Not really a KV question…

I haven’t done it, but I’m pretty sure matteo is right.

You should be able to just do something like
kv1 = KV.get(‘1’);
kv2 = KV.get(‘2’);

And you can do similar for writing.

From Wrangler / API there is bulk writing, but not from a worker (

Hi @matteo, @david.gagne,

I tried doing this, but accessing from workers is strangely synchronous. The duration of the code snippet below increases linearly with the number of items in keys

let keys = [key1, key2, ... ]
let kvValues = [];
for (const key of keys) {
    var val = KV.get(key);
kvValues = await Promise.all(kvValues);

Do you know if an asynchronous way to read multiple keys is available? If so, could you please point me the right way? I searched as much as I could online, but couldn’t find anything.