Worker Connections to Origin
Is there an agreed upon method to mux/coalesce Worker HTTP connections to an origin? Under normal circumstances, it seems that the workers are muxing their connections. However, during traffic spikes they can overwhelm the origin with connections - new workers all seem to be establishing connections independently.
Could a Cloudflare load balancer help here as an intermediary hop? Or a tunnel?
5 Replies
Run all requests through a Durable Object, so that you can prevent multiple requests for the same resource to be made?
Though, if this is an issue of cache expiration causing a stampeding herd, maybe you could add a bit of jitter to your cache-control headers to prevent them from all expiring at the same time?
It wouldn't 100% prevent an overload, but it should help a bit
What is the throughput limit on a DO? Does the documented 1,000 req/s apply here? https://developers.cloudflare.com/durable-objects/platform/limits/#how-much-work-can-a-single-durable-object-do
Cloudflare Docs
Limits · Cloudflare Durable Objects docs
Durable Objects are only available on the Workers Paid plan.
I was also curious if adding another resource type in Cloudflare’s network could help here, like a load balancer or an Argo tunnel
That's a technical limit, as in you may be able to run more/less requests, it depends on how much compute you are doing
I wouldn't think so, since LB requires you to have multiple origins
Or well
Adding more origins would help
But I'm guessing that isn't what you are looking for
Could the LB have multiple tunnels as origins? Based on this forum post it seems like tunnels are very efficient with their connection count because they support http2 https://community.cloudflare.com/t/concurrent-requests-limit-for-a-cloudflared-tunnel/281358/2