KV calls limit from worker

Hi, I'm reaching the limit of 1000 KV call per worker requests, right now my request will do about 2000 calls. I can reduce the number of calls down to a near 1000+ by using bulk read, but there isn't seems to be any options for bulk writing? I've also submit a form asking to raise the limit, but I don't know what the criteria for that or how ez it's to get. Thank you
3 Replies
DaniFoldi
DaniFoldi4mo ago
Hi, I don't think I know anyone that has an increased subrequest limit, for bulk writes I recommend using the rest api: https://developers.cloudflare.com/api/operations/workers-kv-namespace-write-multiple-key-value-pairs Bear in mind this will have higher latency than writing via the binding, but you can write up to 10k key-value pair per call (still billed as 10k write operations)
Cloudflare API Documentation
Interact with Cloudflare's products and services via the Cloudflare API
tien
tien4mo ago
thank you, how can I do this from within a worker?
DaniFoldi
DaniFoldi4mo ago
you can use fetch() just like you would with any other URL, you'll ned an API key (recommended to be stored as a secret)