mirror of
https://github.com/tailscale/tailscale.git
synced 2025-04-18 12:32:13 +00:00
cmd/tailscaled: SetGCPercent() if GOGC is not set.
This cuts RSS from ~30MB to ~20MB on my machine, after the previous fix to get rid of unnecessary zstd buffers. Signed-off-by: Avery Pennarun <apenwarr@tailscale.com>
This commit is contained in:
parent
db051fb013
commit
f2db4ac277
@ -14,7 +14,9 @@ import (
|
|||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/http/pprof"
|
"net/http/pprof"
|
||||||
|
"os"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
"runtime/debug"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/apenwarr/fixconsole"
|
"github.com/apenwarr/fixconsole"
|
||||||
@ -37,6 +39,14 @@ import (
|
|||||||
const globalStateKey = "_daemon"
|
const globalStateKey = "_daemon"
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
// We aren't very performance sensitive, and the parts that are
|
||||||
|
// performance sensitive (wireguard) try hard not to do any memory
|
||||||
|
// allocations. So let's be aggressive about garbage collection,
|
||||||
|
// unless the user specifically overrides it in the usual way.
|
||||||
|
if _, ok := os.LookupEnv("GOGC"); !ok {
|
||||||
|
debug.SetGCPercent(10)
|
||||||
|
}
|
||||||
|
|
||||||
defaultTunName := "tailscale0"
|
defaultTunName := "tailscale0"
|
||||||
if runtime.GOOS == "openbsd" {
|
if runtime.GOOS == "openbsd" {
|
||||||
defaultTunName = "tun"
|
defaultTunName = "tun"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user