Skip to content

Commit

Permalink
Revert "storage: promote experimental-memory-mlock flag."
Browse files Browse the repository at this point in the history
This reverts commit b8b764c.
  • Loading branch information
jmao-dd committed Jan 26, 2025
1 parent b8b764c commit 0ae9c72
Showing 5 changed files with 4 additions and 19 deletions.
5 changes: 1 addition & 4 deletions server/config/config.go
Original file line number Diff line number Diff line change
@@ -184,15 +184,12 @@ type ServerConfig struct {

DowngradeCheckTime time.Duration

// MemoryMlock enables mlocking of etcd owned memory pages.
// ExperimentalMemoryMlock enables mlocking of etcd owned memory pages.
// The setting improves etcd tail latency in environments were:
// - memory pressure might lead to swapping pages to disk
// - disk latency might be unstable
// Currently all etcd memory gets mlocked, but in future the flag can
// be refined to mlock in-use area of bbolt only.
MemoryMlock bool `json:"memory-mlock"`
// ExperimentalMemoryMlock has the same effect as MemoryMlock
// TODO: delete in v3.7
ExperimentalMemoryMlock bool `json:"experimental-memory-mlock"`

// ExperimentalTxnModeWriteWithSharedBuffer enable write transaction to use
12 changes: 2 additions & 10 deletions server/embed/config.go
Original file line number Diff line number Diff line change
@@ -471,17 +471,12 @@ type Config struct {

ExperimentalDowngradeCheckTime time.Duration `json:"experimental-downgrade-check-time"`

// MemoryMlock enables mlocking of etcd owned memory pages.
// ExperimentalMemoryMlock enables mlocking of etcd owned memory pages.
// The setting improves etcd tail latency in environments were:
// - memory pressure might lead to swapping pages to disk
// - disk latency might be unstable
// Currently all etcd memory gets mlocked, but in future the flag can
// be refined to mlock in-use area of bbolt only.
MemoryMlock bool `json:"memory-mlock"`

// ExperimentalMemoryMlock has the same effect as MemoryMlock in v3.6.
// Deprecated in v3.6 and will be decommissioned in v3.7.
// TODO: Delete in v3.7
ExperimentalMemoryMlock bool `json:"experimental-memory-mlock"`

// ExperimentalTxnModeWriteWithSharedBuffer enables write transaction to use a shared buffer in its readonly check operations.
@@ -587,8 +582,7 @@ func NewConfig() *Config {
BcryptCost: uint(bcrypt.DefaultCost),
AuthTokenTTL: 300,

PreVote: true,
MemoryMlock: false,
PreVote: true,

loggerMu: new(sync.RWMutex),
logger: nil,
@@ -808,8 +802,6 @@ func (cfg *Config) AddFlags(fs *flag.FlagSet) {
fs.DurationVar(&cfg.ExperimentalWarningApplyDuration, "experimental-warning-apply-duration", cfg.ExperimentalWarningApplyDuration, "Time duration after which a warning is generated if request takes more time.")
fs.DurationVar(&cfg.WarningUnaryRequestDuration, "warning-unary-request-duration", cfg.WarningUnaryRequestDuration, "Time duration after which a warning is generated if a unary request takes more time.")
fs.DurationVar(&cfg.ExperimentalWarningUnaryRequestDuration, "experimental-warning-unary-request-duration", cfg.ExperimentalWarningUnaryRequestDuration, "Time duration after which a warning is generated if a unary request takes more time. It's deprecated, and will be decommissioned in v3.7. Use --warning-unary-request-duration instead.")
fs.BoolVar(&cfg.MemoryMlock, "memory-mlock", cfg.MemoryMlock, "Enable to enforce etcd pages (in particular bbolt) to stay in RAM.")
// TODO: delete in v3.7
fs.BoolVar(&cfg.ExperimentalMemoryMlock, "experimental-memory-mlock", cfg.ExperimentalMemoryMlock, "Enable to enforce etcd pages (in particular bbolt) to stay in RAM.")
fs.BoolVar(&cfg.ExperimentalTxnModeWriteWithSharedBuffer, "experimental-txn-mode-write-with-shared-buffer", true, "Enable the write transaction to use a shared buffer in its readonly check operations.")
fs.BoolVar(&cfg.ExperimentalStopGRPCServiceOnDefrag, "experimental-stop-grpc-service-on-defrag", cfg.ExperimentalStopGRPCServiceOnDefrag, "Enable etcd gRPC service to stop serving client requests on defragmentation.")
1 change: 0 additions & 1 deletion server/embed/etcd.go
Original file line number Diff line number Diff line change
@@ -208,7 +208,6 @@ func StartEtcd(inCfg *Config) (e *Etcd, err error) {
CorruptCheckTime: cfg.CorruptCheckTime,
CompactHashCheckTime: cfg.CompactHashCheckTime,
PreVote: cfg.PreVote,
MemoryMlock: cfg.MemoryMlock,
Logger: cfg.logger,
ForceNewCluster: cfg.ForceNewCluster,
EnableGRPCGateway: cfg.EnableGRPCGateway,
2 changes: 0 additions & 2 deletions server/etcdmain/help.go
Original file line number Diff line number Diff line change
@@ -107,8 +107,6 @@ Member:
Write timeout set on each rafthttp connection
--feature-gates ''
A set of key=value pairs that describe server level feature gates for alpha/experimental features. Options are:` + "\n " + strings.Join(features.NewDefaultServerFeatureGate("", nil).KnownFeatures(), "\n ") + `
--memory-mlock 'false'
Enable to enforce etcd pages (in particular bbolt) to stay in RAM.
Clustering:
--initial-advertise-peer-urls 'http://localhost:2380'
3 changes: 1 addition & 2 deletions server/storage/backend.go
Original file line number Diff line number Diff line change
@@ -50,8 +50,7 @@ func newBackend(cfg config.ServerConfig, hooks backend.Hooks) backend.Backend {
// permit 10% excess over quota for disarm
bcfg.MmapSize = uint64(cfg.QuotaBackendBytes + cfg.QuotaBackendBytes/10)
}
// TODO: remove the cfg.ExperimentalMemoryMlock part in v3.7
bcfg.Mlock = cfg.MemoryMlock || cfg.ExperimentalMemoryMlock
bcfg.Mlock = cfg.ExperimentalMemoryMlock
bcfg.Hooks = hooks
return backend.New(bcfg)
}

0 comments on commit 0ae9c72

Please sign in to comment.