-
Notifications
You must be signed in to change notification settings - Fork 879
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
On linux systems bump up gc_thresholds so to lower the probability of running with neighbor table overflow issues Signed-off-by: Flavio Crisciani <flavio.crisciani@docker.com>
- Loading branch information
Flavio Crisciani
committed
Jun 1, 2017
1 parent
2e99f06
commit a59c4dc
Showing
3 changed files
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package overlay | ||
|
||
import ( | ||
"io/ioutil" | ||
"path" | ||
"strings" | ||
|
||
"github.com/Sirupsen/logrus" | ||
) | ||
|
||
var sysctlConf = map[string]string{ | ||
"net.ipv4.neigh.default.gc_thresh1": "8192", | ||
"net.ipv4.neigh.default.gc_thresh2": "49152", | ||
"net.ipv4.neigh.default.gc_thresh3": "65536", | ||
} | ||
|
||
// writeSystemProperty writes the value to a path under /proc/sys as determined from the key. | ||
// For e.g. net.ipv4.ip_forward translated to /proc/sys/net/ipv4/ip_forward. | ||
func writeSystemProperty(key, value string) error { | ||
keyPath := strings.Replace(key, ".", "/", -1) | ||
return ioutil.WriteFile(path.Join("/proc/sys", keyPath), []byte(value), 0644) | ||
} | ||
|
||
func applyOStweaks() { | ||
for k, v := range sysctlConf { | ||
if err := writeSystemProperty(k, v); err != nil { | ||
logrus.Errorf("error setting the kernel parameter %s = %s, err: %s", k, v, err) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
// +build !linux | ||
|
||
package overlay | ||
|
||
func applyOStweaks() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters