I am building another open source project for quite a while now, one that will bring much value and users to Cloudflare Workers. However, I am stuck on a problem that I really wasn’t expecting; poor KV READ performance.
My worker is configured properly in the sense of, use waitUntil for PUT operations and such, however the READ performance is very, very poor. When fetching from the KV, the response time varies between 200ms to even 400, and 800 ms. That is double, triple the amount of time that’s needed to reply from the server itself.
- Each Key is a long-ish string like:
a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y,...
- Each Value is plain text in size around 500kb/1Mb - 2Mb max.
What would be the issue here? I read about “Cold Reads” and such, but it makes no sense. I repeated the READ operations several times and tested from various locations (countries) and the response does not improve. It’s very erratic and not consistent at all.
So my questions are:
- Does the Key length affect the READ/fetch time?
- Does the Value size affect the READ/fetch time?
Unfortunately I cannot use “cache” functionality of KV or either the Cache API. I need to read these KV values as needed. In theory, KV consistent READS should be very fast, even faster if READ often. That is not the case, at all.
I would appreciate if someone from Cloudflare could reply.