Cloudflare DevelopersCD
Cloudflare Developers4mo ago
67 replies
Marak

Building Pub-Sub with Durable Objects

Can anyone suggest a potential architecture using Durable Objects in order to create a "BuddyList" functionality? The goal here is to be able to propagate status updates ( online / offline ) at scale to all users belonging to the BuddyList.

Our current design uses a DO instance per user and our setStatus() DO method utilizes a fan-out with batch concurrency in order to iterate through each "buddy" of a user, fetching the buddy's remote DO instance in order to push the status state.

Does that make sense? We've found the fan-out is brittle, timeouts happen, probable issues with fan-out storms. Retries with back-offs aren't great either. We don't really have the luxury of a status update failing.

I think the question is generalized as how could we design a pub-sub using DOs? I'm at a bit of a cross-roads here trying to figure out the best solution. In our previous system ( before CF ), we used a Redis cluster to maintain buddylist state and this solution worked well for buddylists up to 1,000 members in size.
Was this page helpful?