AzAsIsGoD
AzAsIsGoD
CDCloudflare Developers
Created by AzAsIsGoD on 10/31/2023 in #workers-help
Latency Cloudflare Workers + Workers KV
Hello guys. Just doing a few tests and the latency is around 110-200ms after a cold start. I'm pinging the host with 3ms roundtrip. The code in index.ts is async fetch(request: Request, env: Env, ctx: ExecutionContext): Promise<Response> { const { pathname } = new URL(request.url); let value = await env.test.get("test"); if (pathname === "/api/kv") { if (value === null) { await env.test.put("test", "1"); } else { await env.test.put("test", (parseInt(value) + 1).toString()).then(() => { value = value === null ? "0" : (parseInt(value) + 1).toString(); }).catch((r) => { return new Response('fail to update'); }); } return new Response(value); } return new Response(''); }, Is this latency in the normal range?
2 replies