Skip to content

(v2.12?) [ADD] allow stream placement to evict servers#6138

Merged
neilalexander merged 1 commit intonats-io:mainfrom
ramonberrutti:add-stream-exclude-tags
May 22, 2025
Merged

(v2.12?) [ADD] allow stream placement to evict servers#6138
neilalexander merged 1 commit intonats-io:mainfrom
ramonberrutti:add-stream-exclude-tags

Conversation

@ramonberrutti
Copy link
Copy Markdown
Contributor

NATS introduces the server tag !jetstream, enabling the eviction of JetStream assets.
This same approach can be extended to streams.

This PR introduces the ability to evict specific servers from streams.

Signed-off-by: Ramon Berrutti ramonberrutti@gmail.com

@ramonberrutti ramonberrutti requested a review from a team as a code owner November 17, 2024 15:20
@derekcollison
Copy link
Copy Markdown
Member

You can peer remove a server from a system during runtime. Does that not solve your needs? The system will also (if possible) select a new peer for the stream peer sets that are affected. Consumers inherit from the same peer set as their parent stream.

@ramonberrutti
Copy link
Copy Markdown
Contributor Author

Hi @derekcollison

We have two distinct use cases for this feature:

Multi-cloud environments with temporal streams:

In a multi-cloud environment, we need to create temporary streams that are not tied to a specific cloud due to customer contract requirements and performance considerations. While using tags is helpful, the current implementation functions as an all-or-nothing solution. For instance, if we have "AWS," "GCP," and "Azure," we must create combinations of tags for each cloud, such as "aws-gcp," "aws-azure," and "gcp-azure." With this feature, we could instead use a tag like !azure to exclude a specific cloud without creating multiple combinations manually.

Cloud maintenance and standby nodes:

In scenarios where a specific cloud requires maintenance, we spin up standby nodes in another cloud and migrate the replicas from the affected cloud to the standby nodes. However, we encounter issues where the streams sometimes fail to return to their original nodes even after multiple peer-removal attempts. While this can be mitigated by adding the !jetstream tag to the standby nodes' configuration, allowing the feature to be applied at the stream level would reduce risks and provide greater flexibility.

Happy to provide more context.
Thank you.

@github-actions github-actions bot added the stale This issue has had no activity in a while label Jan 14, 2025
@neilalexander
Copy link
Copy Markdown
Member

Anti-affinity for placement is actually quite an interesting idea, @ripienaar any thoughts here?

@github-actions github-actions bot removed the stale This issue has had no activity in a while label Apr 9, 2025
@ripienaar
Copy link
Copy Markdown
Contributor

Yeah I think this is a pretty good idea for sure

@jnmoyne
Copy link
Copy Markdown
Contributor

jnmoyne commented May 10, 2025

+1

@ramonberrutti
Copy link
Copy Markdown
Contributor Author

Happy to rebase and improve the anti-affinity options if needed.

@neilalexander
Copy link
Copy Markdown
Member

Happy to rebase and improve the anti-affinity options if needed.

If you wouldn't mind rebasing, otherwise looks OK to me!

@ramonberrutti ramonberrutti force-pushed the add-stream-exclude-tags branch from fc62e6c to 291e0d2 Compare May 16, 2025 09:54
@neilalexander
Copy link
Copy Markdown
Member

One final thing, would you be able to fix the sign-offs? They need to be on both the commit messages & the PR description, whereas it looks like they're missing on the commits.

NATS introduces the server tag `!jetstream`, enabling the eviction of JetStream assets.
This same approach can be extended to streams.

This PR introduces the ability to evict specific servers from streams.

Signed-off-by: Ramon Berrutti <ramonberrutti@gmail.com>
@ramonberrutti ramonberrutti force-pushed the add-stream-exclude-tags branch from 291e0d2 to 7add0cc Compare May 16, 2025 10:21
@neilalexander neilalexander changed the title [ADD] allow stream placement to evict servers (v2.12?) [ADD] allow stream placement to evict servers May 16, 2025
Copy link
Copy Markdown
Member

@neilalexander neilalexander left a comment

Choose a reason for hiding this comment

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

LGTM

@neilalexander neilalexander merged commit 7c7bd77 into nats-io:main May 22, 2025
23 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.

5 participants