From fed899ed4a625d124a881a2da67430be5d15325c Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Wed, 27 Mar 2024 14:36:01 +0100 Subject: pkg/rpctype: make RPC compression optional RPC compression take up to 10% of CPU time in profiles, but it's unlikely to be beneficial for local VM runs (we are mostly copying memory in this case). Enable RPC compression based on the VM type (local VM don't use it, remove machines use it). --- vm/vmimpl/vmimpl.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'vm/vmimpl/vmimpl.go') diff --git a/vm/vmimpl/vmimpl.go b/vm/vmimpl/vmimpl.go index a9afdc1f1..bd565c8aa 100644 --- a/vm/vmimpl/vmimpl.go +++ b/vm/vmimpl/vmimpl.go @@ -129,16 +129,18 @@ func (err InfraError) InfraError() (string, []byte) { } // Register registers a new VM type within the package. -func Register(typ string, ctor ctorFunc, allowsOvercommit bool) { +func Register(typ string, ctor ctorFunc, allowsOvercommit, netCompression bool) { Types[typ] = Type{ - Ctor: ctor, - Overcommit: allowsOvercommit, + Ctor: ctor, + Overcommit: allowsOvercommit, + NetCompression: netCompression, } } type Type struct { - Ctor ctorFunc - Overcommit bool + Ctor ctorFunc + Overcommit bool + NetCompression bool } type ctorFunc func(env *Env) (Pool, error) -- cgit mrf-deployment