ipnserver and logpolicy: configure zstd with low-memory settings.
The compressed blobs we send back and forth are small and infrequent, which doesn't justify the 8MB * GOMAXPROCS memory that was being allocated. This was the overwhelming majority of memory use in tailscaled. On my system it goes from ~100M RSS to ~15M RSS (which is still suspiciously high, but we can worry about that more later). Signed-off-by: Avery Pennarun <apenwarr@tailscale.com>
This commit is contained in:
parent
d074ec6571
commit
db051fb013
|
@ -113,7 +113,11 @@ func Run(rctx context.Context, logf logger.Logf, logid string, opts Options, e w
|
|||
return fmt.Errorf("NewLocalBackend: %v", err)
|
||||
}
|
||||
b.SetDecompressor(func() (controlclient.Decompressor, error) {
|
||||
return zstd.NewReader(nil)
|
||||
return zstd.NewReader(nil,
|
||||
zstd.WithDecoderLowmem(true),
|
||||
zstd.WithDecoderConcurrency(1),
|
||||
zstd.WithDecoderMaxMemory(65536),
|
||||
)
|
||||
})
|
||||
|
||||
if opts.DebugMux != nil {
|
||||
|
|
|
@ -183,7 +183,11 @@ func New(collection string) *Policy {
|
|||
PrivateID: newc.PrivateID,
|
||||
Stderr: logWriter{console},
|
||||
NewZstdEncoder: func() logtail.Encoder {
|
||||
w, err := zstd.NewWriter(nil)
|
||||
w, err := zstd.NewWriter(nil,
|
||||
zstd.WithEncoderLevel(zstd.SpeedFastest),
|
||||
zstd.WithEncoderConcurrency(1),
|
||||
zstd.WithWindowSize(8192),
|
||||
)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue