Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement overflow placement for JetStream streams. #2771

Merged
merged 4 commits into from Jan 7, 2022
Merged

Conversation

derekcollison
Copy link
Member

This allows stream placement to overflow to adjacent clusters.
We also do more balanced placement based on resources (store or mem). We can continue to expand this as well.
We also introduce an account requirement that stream configs contain a MaxBytes value.

We now track account limits and server limits more distinctly, and do not reserver server resources based on account limits themselves.

Signed-off-by: Derek Collison derek@nats.io

/cc @nats-io/core

@derekcollison derekcollison force-pushed the overflow branch 3 times, most recently from d889de0 to d96e3f3 Compare January 7, 2022 00:49
This allows stream placement to overflow to adjacent clusters.
We also do more balanced placement based on resources (store or mem). We can continue to expand this as well.
We also introduce an account requirement that stream configs contain a MaxBytes value.

We now track account limits and server limits more distinctly, and do not reserver server resources based on account limits themselves.

Signed-off-by: Derek Collison <derek@nats.io>
// If we have additional clusters to try we can retry.
if ci != nil && len(ci.Alternates) > 0 {
if rg := js.createGroupForStream(ci, cfg); rg != nil {
s.Warnf("Retrying cluster placement for stream '%s > %s'", result.Account, result.Stream)
Copy link
Contributor

Choose a reason for hiding this comment

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

we should probably increment some stat counter when this happens and maybe send an advisory, and maybe clarify why this being retried here rather than just saying its being retried. And include where the placement is being done instead in the log (and advisory)

Copy link
Member Author

Choose a reason for hiding this comment

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

This is on the meta leader, and placement is most likely elsewhere, and determined by the server that housed the client request originally. So not sure what value there is there.

Also, the reason for moving will be resource limitations, which should be well known through monitoring and observability.

Copy link
Contributor

Choose a reason for hiding this comment

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

ok, maybe just some extra info in the log then to indicate its this, a user who come across this for the first time would not have any idea what it relates to

Copy link
Member Author

Choose a reason for hiding this comment

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

Possibly if they were doing no monitoring at all of their system to see it ran out of resources. What would you add to the description that you think would be helpful in a system like NGS? Or any super cluster tbh.

Copy link
Contributor

@ripienaar ripienaar Jan 7, 2022

Choose a reason for hiding this comment

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

Retrying cluster placement for stream 'X > Y'` due to insufficient resources in cluster C? probably dont need to log the cluster name

Copy link
Member Author

Choose a reason for hiding this comment

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

That works, thanks.

Copy link
Member Author

Choose a reason for hiding this comment

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

Note though that this is the not happy path where the meta-leader guesses wrong around placement, either due to concurrent requests, dropped updates around reserved or real usage etc.

In the happy path we have no logging at all atm.

server/jetstream_cluster.go Show resolved Hide resolved
server/events.go Show resolved Hide resolved
Memory uint64 `json:"memory"`
Store uint64 `json:"storage"`
ReservedMemory uint64 `json:"reserved_memory"`
ReservedStore uint64 `json:"reserved_storage"`
Copy link
Contributor

Choose a reason for hiding this comment

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

Can these changes really be done at this point given semver?

Copy link
Member Author

Choose a reason for hiding this comment

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

We discussed yesterday, not totally sure yet, but the reserved portions were incorrect and needed to be fixed. The one issue identified would be the nats cli most likely.

Copy link
Member

Choose a reason for hiding this comment

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

Is it deliberate that you removed the ,omitempty? (for both ReservedMemory and ReservedStore)

Copy link
Member

Choose a reason for hiding this comment

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

Could you comment on this question: "Is it deliberate that you removed the ,omitempty? (for both ReservedMemory and ReservedStore)"

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes it was deliberate based on feedback and my usage from varz/jsz and statusz stuff.

Copy link
Member

Choose a reason for hiding this comment

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

Ok

Signed-off-by: Derek Collison <derek@nats.io>
Memory uint64 `json:"memory"`
Store uint64 `json:"storage"`
ReservedMemory uint64 `json:"reserved_memory"`
ReservedStore uint64 `json:"reserved_storage"`
Copy link
Member

Choose a reason for hiding this comment

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

Is it deliberate that you removed the ,omitempty? (for both ReservedMemory and ReservedStore)

server/jetstream_api.go Outdated Show resolved Hide resolved
server/jetstream_api.go Outdated Show resolved Hide resolved
server/jetstream_cluster.go Outdated Show resolved Hide resolved
Signed-off-by: Derek Collison <derek@nats.io>
Copy link
Member

@kozlovic kozlovic left a comment

Choose a reason for hiding this comment

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

LGTM

Signed-off-by: Derek Collison <derek@nats.io>
Copy link
Member

@kozlovic kozlovic left a comment

Choose a reason for hiding this comment

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

LGTM

@derekcollison derekcollison merged commit 08ff14a into main Jan 7, 2022
@derekcollison derekcollison deleted the overflow branch January 7, 2022 19:03
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.

None yet

3 participants