My usual approach is to pick the identifier that is always accessible for a request (e.g. account ID

My usual approach is to pick the identifier that is always accessible for a request (e.g. account ID) and
hash(id) % N
to get the DB to use. And then do the normal thing you would do using that DB.

I want to re-iterate though, that if as you say you are 2 years away from this load and hitting the limit, you might as well just leave it for later. But, sharding in general doesn't mean one per user as many folks assume (and some docs/posts say). It's up to you and your data model to find something that works within your needs. If you are going to full-blown one DB per user, using Durable Objects directly is more suited.
Was this page helpful?