© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
Cloudflare DevelopersCD
Cloudflare Developers•3mo ago•
2 replies
josula

Worker performance issue on start

🔑KVWorkers
Can anyone help me understand what my worker is doing there for the first 850ms before it hits
kv_getWithMetadata
kv_getWithMetadata
? In my code we are literally just starting the request, checking if the request is cachable (tiny synchronous function), create a cacheKey (tiny synchronous function) and then check in our KV cache if the cachekey exists. I timed these functions and they basically take just <5ms to exectly. Before we hit the
env.CACHE_KV.getWithMetadata
env.CACHE_KV.getWithMetadata
850ms pass still though (see screenshot)?!

I tried to debug this in every possible way but I simply cannot make sense of it...

export default {
  async fetch(req, env, ctx) {

    if (!isCacheableRequest(req)) {
      return nextWorker.fetch(req, env, ctx)
    }
    const cacheKey = getCacheKey(req)
    try {
      const cached = await env.CACHE_KV.getWithMetadata(cacheKey, "arrayBuffer") => 850ms have already passed here. How?
export default {
  async fetch(req, env, ctx) {

    if (!isCacheableRequest(req)) {
      return nextWorker.fetch(req, env, ctx)
    }
    const cacheKey = getCacheKey(req)
    try {
      const cached = await env.CACHE_KV.getWithMetadata(cacheKey, "arrayBuffer") => 850ms have already passed here. How?
image.png
Cloudflare Developers banner
Cloudflare DevelopersJoin
Welcome to the official Cloudflare Developers server. Here you can ask for help and stay updated with the latest news
85,042Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Run file on worker start
Cloudflare DevelopersCDCloudflare Developers / workers-and-pages-help
3y ago
Long-running worker performance
Cloudflare DevelopersCDCloudflare Developers / workers-and-pages-help
3y ago
Worker KV issue
Cloudflare DevelopersCDCloudflare Developers / workers-and-pages-help
5mo ago
Worker DNS issue
Cloudflare DevelopersCDCloudflare Developers / workers-and-pages-help
2y ago