Skip to content

Feat Sharding Replication#484

Merged
conico974 merged 16 commits intoopennextjs:mainfrom
conico974:feat/double-sharding
Mar 25, 2025
Merged

Feat Sharding Replication#484
conico974 merged 16 commits intoopennextjs:mainfrom
conico974:feat/double-sharding

Conversation

@conico974
Copy link
Copy Markdown
Collaborator

@conico974 conico974 commented Mar 21, 2025

Implements sharding replication for the Durable Object tag cache.
Instead of being sharded only based on the tag, each shard will now also be replicated
This allow to scale way more (virtually infinitely)
A single tag could be read from any of the N random replicas associated with the tag shard.
On write we still need to write to every single replicas associated with this tag shard

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Mar 21, 2025

🦋 Changeset detected

Latest commit: d94c23b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@opennextjs/cloudflare Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Mar 21, 2025

Open in Stackblitz

pnpm add https://pkg.pr.new/@opennextjs/cloudflare@484

commit: d94c23b

Comment thread packages/cloudflare/src/api/do-sharded-tag-cache.ts Outdated
Comment thread packages/cloudflare/src/api/do-sharded-tag-cache.ts Outdated
Comment thread packages/cloudflare/src/api/do-sharded-tag-cache.ts Outdated
Copy link
Copy Markdown
Contributor

@vicb vicb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!
A few nits related to naming

@conico974 conico974 force-pushed the feat/double-sharding branch from 62994a5 to 0829f86 Compare March 24, 2025 10:23
@conico974 conico974 requested a review from vicb March 24, 2025 14:02
Copy link
Copy Markdown
Contributor

@vicb vicb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should be careful with naming things correctly to ease later evolutions and maintenance of the code.

I think we have shards, replicas and DOs.

Each shards has a soft and hard variant.
Those variants are replicated to distinct DOs when enableShardReplication is true.

I added a few inline comments, let's iterate.

Thanks!

Comment thread .changeset/modern-laws-happen.md Outdated
Comment thread examples/e2e/app-router/open-next.config.ts Outdated
Comment thread packages/cloudflare/src/api/do-sharded-tag-cache.ts
Comment thread packages/cloudflare/src/api/do-sharded-tag-cache.ts Outdated
Comment thread packages/cloudflare/src/api/do-sharded-tag-cache.ts Outdated
Comment thread packages/cloudflare/src/api/do-sharded-tag-cache.ts Outdated
Comment thread packages/cloudflare/src/api/do-sharded-tag-cache.ts Outdated
Comment thread packages/cloudflare/src/api/do-sharded-tag-cache.ts Outdated
Comment thread packages/cloudflare/src/api/do-sharded-tag-cache.ts
Comment thread packages/cloudflare/src/api/cloudflare-context.ts Outdated
@conico974 conico974 changed the title Feat double sharding Feat Sharding Replication Mar 24, 2025
Comment thread packages/cloudflare/src/api/do-sharded-tag-cache.ts
Comment thread packages/cloudflare/src/api/do-sharded-tag-cache.ts Outdated
Comment thread packages/cloudflare/src/api/do-sharded-tag-cache.ts Outdated
Comment thread packages/cloudflare/src/api/do-sharded-tag-cache.ts Outdated
Comment thread packages/cloudflare/src/api/do-sharded-tag-cache.ts Outdated
Comment thread packages/cloudflare/src/api/do-sharded-tag-cache.ts Outdated
Comment thread packages/cloudflare/src/api/do-sharded-tag-cache.ts Outdated
Comment thread packages/cloudflare/src/api/do-sharded-tag-cache.ts
@conico974 conico974 requested a review from vicb March 25, 2025 11:14
Comment thread packages/cloudflare/src/api/do-sharded-tag-cache.ts Outdated
Copy link
Copy Markdown
Contributor

@vicb vicb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, thanks a lot for the updates 🚀

@conico974 conico974 merged commit 6ce5643 into opennextjs:main Mar 25, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants