-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathhints.go
44 lines (37 loc) · 1.23 KB
/
hints.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package main
import (
"io/ioutil"
"strconv"
"strings"
log "github.com/sirupsen/logrus"
)
func hints() {
hintVMDirtyBackgroundRatio()
hintVMDirtyExpireCentisecs()
}
func hintVMDirtyBackgroundRatio() {
content, err := ioutil.ReadFile("/proc/sys/vm/dirty_background_ratio")
if err != nil {
return
}
value, err := strconv.ParseInt(strings.TrimRight(string(content), "\n"), 10, 32)
if err != nil {
return
}
if value == 10 {
log.Info("You seem to use default value of vm.dirty_background_ratio. This parameter indicates how many percent of available memory can be used for holding dirty pages (pending writes). To save some I/O by background merging you might want to increase this value.")
}
}
func hintVMDirtyExpireCentisecs() {
content, err := ioutil.ReadFile("/proc/sys/vm/dirty_expire_centisecs")
if err != nil {
return
}
value, err := strconv.ParseInt(strings.TrimRight(string(content), "\n"), 10, 32)
if err != nil {
return
}
if value == 3000 {
log.Info("You seem to use default value of vm.dirty_expire_centisecs. This parameter indicates maximum lifetime of dirty page before being forced to be written to disk (in centiseconds). To save some I/O by background merging you might want to increase this value.")
}
}