Compare commits
2 Commits
v0.107.0-b
...
2044-gc
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
781f011419 | ||
|
|
45745943a5 |
@@ -47,6 +47,12 @@ type configuration struct {
|
|||||||
RlimitNoFile uint `yaml:"rlimit_nofile"` // Maximum number of opened fd's per process (0: default)
|
RlimitNoFile uint `yaml:"rlimit_nofile"` // Maximum number of opened fd's per process (0: default)
|
||||||
DebugPProf bool `yaml:"debug_pprof"` // Enable pprof HTTP server on port 6060
|
DebugPProf bool `yaml:"debug_pprof"` // Enable pprof HTTP server on port 6060
|
||||||
|
|
||||||
|
// The value for SetGCPercent.
|
||||||
|
// SetGCPercent sets the garbage collection target percentage:
|
||||||
|
// a collection is triggered when the ratio of freshly allocated data
|
||||||
|
// to live data remaining after the previous collection reaches this percentage.
|
||||||
|
MemGCPercent uint8 `yaml:"mem_gc_percentage"`
|
||||||
|
|
||||||
// TTL for a web session (in hours)
|
// TTL for a web session (in hours)
|
||||||
// An active session is automatically refreshed once a day.
|
// An active session is automatically refreshed once a day.
|
||||||
WebSessionTTLHours uint32 `yaml:"web_session_ttl"`
|
WebSessionTTLHours uint32 `yaml:"web_session_ttl"`
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import (
|
|||||||
"os/signal"
|
"os/signal"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
"runtime/debug"
|
||||||
"strconv"
|
"strconv"
|
||||||
"sync"
|
"sync"
|
||||||
"syscall"
|
"syscall"
|
||||||
@@ -209,6 +210,11 @@ func run(args options) {
|
|||||||
log.Info("Configuration file is OK")
|
log.Info("Configuration file is OK")
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if config.MemGCPercent != 0 {
|
||||||
|
debug.SetGCPercent(int(config.MemGCPercent))
|
||||||
|
log.Debug("Set SetGCPercent=%d", config.MemGCPercent)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 'clients' module uses 'dnsfilter' module's static data (dnsfilter.BlockedSvcKnown()),
|
// 'clients' module uses 'dnsfilter' module's static data (dnsfilter.BlockedSvcKnown()),
|
||||||
|
|||||||
2
main.go
2
main.go
@@ -40,7 +40,7 @@ func memoryUsage() {
|
|||||||
// periodically call "debug.FreeOSMemory" so
|
// periodically call "debug.FreeOSMemory" so
|
||||||
// that the OS could reclaim the free memory
|
// that the OS could reclaim the free memory
|
||||||
go func() {
|
go func() {
|
||||||
ticker := time.NewTicker(15 * time.Second)
|
ticker := time.NewTicker(5 * time.Minute)
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case t := <-ticker.C:
|
case t := <-ticker.C:
|
||||||
|
|||||||
Reference in New Issue
Block a user