5 ms·
I've also experimented with this, unfortunately the 50ms CPU time isn't enough for datasets larger than 1.5MB. And the wasm init add at least 100ms to each requ
by tmikaeld 6y ago
I've also experimented with this, unfortunately the 50ms CPU time isn't enough for datasets larger than 1.5MB. And the wasm init add at least 100ms to each request even when "hot" in cache.
Also, out of a cost perspective, running a VM with SSD for cheap with SQlite will give much more requests than a CF worker for much less.
Adding writes to this is also very limited due to the max 1sec write per KV key limit.
- Cthulhu_ 6y agoMmm, the only use case I can see is equivalent to an in-memory database, which would be faster than embedding sqlite.
- tmikaeld 6y agoI've also tried full-text-search in worker by pre-indexing the content, works very fast even with a JS engine - less than 5ms to make a search in 5MB of text. It runs out of CPU-time at 6MB of index though. There's someone that made a WASM for full-text search too, it's definitely faster and can handle quite a lot more text. https://github.com/wilsonzlin/edgesearch https://github.com/wilsonzlin/edgesearch
- k__ 6y agoCloudflare's "Workers Unbound" don't have that limit.
- tmikaeld 6y agoIt doesn't but it will have latency when loading in the KV keys for every non-cached request.
- bastawhiz 6y agoDon't KV loads not count towards the CPU time of the request?
- tmikaeld 6y agoLoading a KV does not take CPU time, however, loading a KV into a variable does parse the content of the KV which does consume CPU time. Which is why it takes a lot less CPU time to do streaming and even to some degree, a streaming parsing of the content.