mirror of
https://github.com/kemko/nomad.git
synced 2026-01-06 02:15:43 +03:00
Merge pull request #2427 from hashicorp/f-gc-limit
Limit parallelism during garbage collection
This commit is contained in:
@@ -310,6 +310,7 @@ func (a *Agent) clientConfig() (*clientconfig.Config, error) {
|
||||
|
||||
// Set the GC related configs
|
||||
conf.GCInterval = a.config.Client.GCInterval
|
||||
conf.GCParallelDestroys = a.config.Client.GCParallelDestroys
|
||||
conf.GCDiskUsageThreshold = a.config.Client.GCDiskUsageThreshold
|
||||
conf.GCInodeUsageThreshold = a.config.Client.GCInodeUsageThreshold
|
||||
conf.NoHostUUID = a.config.Client.NoHostUUID
|
||||
|
||||
@@ -54,6 +54,7 @@ client {
|
||||
collection_interval = "5s"
|
||||
}
|
||||
gc_interval = "6s"
|
||||
gc_parallel_destroys = 6
|
||||
gc_disk_usage_threshold = 82
|
||||
gc_inode_usage_threshold = 91
|
||||
no_host_uuid = true
|
||||
|
||||
@@ -202,6 +202,10 @@ type ClientConfig struct {
|
||||
// collection
|
||||
GCInterval time.Duration `mapstructure:"gc_interval"`
|
||||
|
||||
// GCParallelDestroys is the number of parallel destroys the garbage
|
||||
// collector will allow.
|
||||
GCParallelDestroys int `mapstructure:"gc_parallel_destroys"`
|
||||
|
||||
// GCInodeUsageThreshold is the inode usage threshold beyond which the Nomad
|
||||
// client triggers GC of the terminal allocations
|
||||
GCDiskUsageThreshold float64 `mapstructure:"gc_disk_usage_threshold"`
|
||||
@@ -524,6 +528,7 @@ func DefaultConfig() *Config {
|
||||
ClientMaxPort: 14512,
|
||||
Reserved: &Resources{},
|
||||
GCInterval: 1 * time.Minute,
|
||||
GCParallelDestroys: 2,
|
||||
GCInodeUsageThreshold: 70,
|
||||
GCDiskUsageThreshold: 80,
|
||||
},
|
||||
@@ -929,6 +934,9 @@ func (a *ClientConfig) Merge(b *ClientConfig) *ClientConfig {
|
||||
if b.GCInterval != 0 {
|
||||
result.GCInterval = b.GCInterval
|
||||
}
|
||||
if b.GCParallelDestroys != 0 {
|
||||
result.GCParallelDestroys = b.GCParallelDestroys
|
||||
}
|
||||
if b.GCDiskUsageThreshold != 0 {
|
||||
result.GCDiskUsageThreshold = b.GCDiskUsageThreshold
|
||||
}
|
||||
|
||||
@@ -344,6 +344,7 @@ func parseClient(result **ClientConfig, list *ast.ObjectList) error {
|
||||
"gc_interval",
|
||||
"gc_disk_usage_threshold",
|
||||
"gc_inode_usage_threshold",
|
||||
"gc_parallel_destroys",
|
||||
"no_host_uuid",
|
||||
}
|
||||
if err := checkHCLKeys(listVal, valid); err != nil {
|
||||
|
||||
@@ -71,6 +71,7 @@ func TestConfig_Parse(t *testing.T) {
|
||||
ParsedReservedPorts: []int{1, 10, 11, 12, 100},
|
||||
},
|
||||
GCInterval: 6 * time.Second,
|
||||
GCParallelDestroys: 6,
|
||||
GCDiskUsageThreshold: 82,
|
||||
GCInodeUsageThreshold: 91,
|
||||
NoHostUUID: true,
|
||||
|
||||
@@ -212,6 +212,7 @@ func TestConfig_Merge(t *testing.T) {
|
||||
ParsedReservedPorts: []int{1, 2, 3},
|
||||
},
|
||||
GCInterval: 6 * time.Second,
|
||||
GCParallelDestroys: 6,
|
||||
GCDiskUsageThreshold: 71,
|
||||
GCInodeUsageThreshold: 86,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user