H-A-251: bind a state's bucket once for the process, not before every read
The runtime asked the bucket's stream info before every get, put, delete and listing, so each state read was two answers on the bus (a third of the night's flood came this way, ten thousand reads per sweep). A Conn is one account's connection; it now keeps one binding per bucket, shared by concurrent askers, and binds again once when the bus says the bucket is gone. Builds: design 47 H H-A-251
This commit is contained in:
@@ -203,6 +203,13 @@ type Conn struct {
|
||||
waits map[string]map[chan string]bool
|
||||
// inboxSaid is when a refused answer publish was last said, by subject (answerRefused).
|
||||
inboxSaid map[string]time.Time
|
||||
// bound is each state's binding, kept for the process and bound again only when the bus says its bucket is gone
|
||||
// (state.go, design 47 H lead answers H-A-251): one Conn is one account's connection, so a binding is per account
|
||||
// and bucket.
|
||||
bindMu sync.Mutex
|
||||
bound map[string]*binding
|
||||
// bind binds one bucket: jetstream's KeyValue (a stream-info request on the bus) unless a test replaces it.
|
||||
bind func(ctx context.Context, bucket string) (jetstream.KeyValue, error)
|
||||
}
|
||||
|
||||
// answered is one subject the runtime answers on: what to subscribe again with, and how often it was
|
||||
|
||||
Reference in New Issue
Block a user