app/vminsert: add -rpc.disableCompression command-line flag for reducing CPU usage at the cost of higher network bandwidth usage

This commit is contained in:
Aliaksandr Valialkin 2019-05-24 12:51:07 +03:00
parent b23352dc9e
commit f37903adb3

View file

@ -1,6 +1,7 @@
package netstorage
import (
"flag"
"fmt"
"sync"
"time"
@ -12,6 +13,8 @@ import (
"github.com/VictoriaMetrics/metrics"
)
var disableRPCCompression = flag.Bool(`rpc.disableCompression`, false, "Disable compression of RPC traffic. This reduces CPU usage at the cost of higher network bandwidth usage")
// sendWithFallback sends buf to storage node sn.
//
// It falls back to sending data to another storage node if sn is currently
@ -101,6 +104,9 @@ func (sn *storageNode) dial() error {
}
compressionLevel := 1
if *disableRPCCompression {
compressionLevel = 0
}
bc, err := handshake.VMInsertClient(c, compressionLevel)
if err != nil {
_ = c.Close()