Implement overflow placement for JetStream streams.

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>
This commit is contained in:
Derek Collison
2022-01-06 12:59:39 -08:00
parent ccc9e1621d
commit 52da55c8c6
16 changed files with 676 additions and 352 deletions

View File

@@ -1,4 +1,4 @@
// Copyright 2013-2019 The NATS Authors
// Copyright 2013-2022 The NATS Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
@@ -2417,11 +2417,10 @@ type JSInfo struct {
Disabled bool `json:"disabled,omitempty"`
Config JetStreamConfig `json:"config,omitempty"`
JetStreamStats
APICalls int64 `json:"current_api_calls"`
Streams int `json:"total_streams,omitempty"`
Consumers int `json:"total_consumers,omitempty"`
Messages uint64 `json:"total_messages,omitempty"`
Bytes uint64 `json:"total_message_bytes,omitempty"`
Streams int `json:"streams"`
Consumers int `json:"consumers"`
Messages uint64 `json:"messages"`
Bytes uint64 `json:"bytes"`
Meta *MetaClusterInfo `json:"meta_cluster,omitempty"`
// aggregate raft info
@@ -2576,7 +2575,6 @@ func (s *Server) Jsz(opts *JSzOptions) (*JSInfo, error) {
accounts = append(accounts, info)
}
s.js.mu.RUnlock()
jsi.APICalls = atomic.LoadInt64(&s.js.apiCalls)
if mg := s.js.getMetaGroup(); mg != nil {
if ci := s.raftNodeToClusterInfo(mg); ci != nil {