diff --git a/consul/state_store.go b/consul/state_store.go index 7ae9e4735a..5bbadd4238 100644 --- a/consul/state_store.go +++ b/consul/state_store.go @@ -25,6 +25,7 @@ const ( dbACLs = "acls" dbMaxMapSize32bit uint64 = 128 * 1024 * 1024 // 128MB maximum size dbMaxMapSize64bit uint64 = 32 * 1024 * 1024 * 1024 // 32GB maximum size + dbMaxReaders uint = 4096 // 4K, default is 126 ) // kvMode is used internally to control which type of set @@ -163,6 +164,12 @@ func (s *StateStore) initialize() error { return err } + // Increase the maximum number of concurrent readers + // TODO: Block transactions if we could exceed dbMaxReaders + if err := s.env.SetMaxReaders(dbMaxReaders); err != nil { + return err + } + // Optimize our flags for speed over safety, since the Raft log + snapshots // are durable. We treat this as an ephemeral in-memory DB, since we nuke // the data anyways.