Β© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
Cloudflare DevelopersCD
Cloudflare Developersβ€’3y agoβ€’
6 replies
Kris

Long-running worker performance

I've implemented a background sync worker, triggered by a queue. It calls an external, paginated API (dozens of sub-requests) and performs 100s of SQL queries using the socket API.

This works wonderfully, but it's very slow. Where a local execution might take 2-3 seconds, in production it takes over 60. Some syncs are ~5 minutes.

Any tips on how to diagnose the slowdown in production, or where to look to optimize? Off the top of my head, the source could be:

1. Roundtrips to/from the DB server (which is local in dev, and supabase.co in prod)
2. Worker CPU speed (don't think I'm doing anything too CPU intensive, but there is some list processing)
3. Sub-request (or socket) latencies
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

How long can a worker be running/stay alive?
Cloudflare DevelopersCDCloudflare Developers / workers-and-pages-help
3y ago
Long running ingest
Cloudflare DevelopersCDCloudflare Developers / workers-and-pages-help
16mo ago
Orchestrate long running workers
Cloudflare DevelopersCDCloudflare Developers / workers-and-pages-help
3y ago
Worker performance issue on start
Cloudflare DevelopersCDCloudflare Developers / workers-and-pages-help
3mo ago