The code looks pretty decent.
CF Workers and D1 are still not optimal for hosting relays, in my opinion. SQLite in general performs poorly compared to local KV-store based solutions, and D1 has its own issues.
And JS is kind of a terrible runtime for an application like a relay, which does a lot of memory allocations.
Also, isn’t the single DO a bottleneck?
And nice that you have composite indexes. Many relays don’t
Thread collapsed
Yes, you are correct that the current implementation of a single DO can present itself as a bottleneck since it’s single-threaded and caps at 1000 messages per second, but with queuing. However, I am currently working towards a multi-regional and/or a Pub/Sub coordinated integration that should help mitigate that. We’ll see how we go. The alternative would be to strip out the DO like before and not have stateful websocket. It’s been a fun project getting to trial various different methods and edge cloud tech.
Thread collapsed