Skip to content

Commit

Permalink
Updated server constants, e.g., resyncperiod, QPS, burst, etc., for b…
Browse files Browse the repository at this point in the history
…etter performance

Signed-off-by: Lintong Jiang <[email protected]>
  • Loading branch information
Lintong Jiang committed Dec 12, 2020
1 parent 3371898 commit 8df7800
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 15 deletions.
4 changes: 3 additions & 1 deletion pkg/cmd/backupdriver/cli/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"context"
"fmt"
server2 "github.com/vmware-tanzu/astrolabe/pkg/server"
"github.com/vmware-tanzu/velero-plugin-for-vsphere/pkg/buildinfo"
"github.com/vmware-tanzu/velero-plugin-for-vsphere/pkg/constants"
"log"
"net/http"
Expand All @@ -44,7 +45,6 @@ import (
pluginInformers "github.com/vmware-tanzu/velero-plugin-for-vsphere/pkg/generated/informers/externalversions"
"github.com/vmware-tanzu/velero-plugin-for-vsphere/pkg/snapshotmgr"
"github.com/vmware-tanzu/velero-plugin-for-vsphere/pkg/utils"
"github.com/vmware-tanzu/velero/pkg/buildinfo"
"github.com/vmware-tanzu/velero/pkg/client"
"github.com/vmware-tanzu/velero/pkg/cmd/util/signals"
"github.com/vmware-tanzu/velero/pkg/metrics"
Expand Down Expand Up @@ -195,6 +195,8 @@ func newServer(f client.Factory, config serverConfig, logger *logrus.Logger) (*s
logger.Errorf("Failed to get client config")
return nil, err
}
clientConfig.QPS = config.clientQPS
clientConfig.Burst = config.clientBurst

// kubeClient is the client to the current cluster
// (vanilla, guest, or supervisor)
Expand Down
4 changes: 2 additions & 2 deletions pkg/cmd/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ const (
DefaultMetricsAddress = ":8085"

// server's client default qps and burst
DefaultClientQPS float32 = 20.0
DefaultClientBurst int = 30
DefaultClientQPS float32 = 100.0
DefaultClientBurst int = 100

DefaultProfilerAddress = "localhost:6060"
DefaultInsecureFlag bool = true
Expand Down
17 changes: 6 additions & 11 deletions pkg/cmd/datamgr/cli/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"fmt"
"github.com/vmware-tanzu/astrolabe/pkg/common/vsphere"
server2 "github.com/vmware-tanzu/astrolabe/pkg/server"
"github.com/vmware-tanzu/velero-plugin-for-vsphere/pkg/buildinfo"
"github.com/vmware-tanzu/velero-plugin-for-vsphere/pkg/constants"
"log"
"net/http"
Expand All @@ -43,10 +44,8 @@ import (
pluginInformers "github.com/vmware-tanzu/velero-plugin-for-vsphere/pkg/generated/informers/externalversions"
"github.com/vmware-tanzu/velero-plugin-for-vsphere/pkg/snapshotmgr"
"github.com/vmware-tanzu/velero-plugin-for-vsphere/pkg/utils"
"github.com/vmware-tanzu/velero/pkg/buildinfo"
"github.com/vmware-tanzu/velero/pkg/client"
"github.com/vmware-tanzu/velero/pkg/cmd/util/signals"
velero_clientset "github.com/vmware-tanzu/velero/pkg/generated/clientset/versioned"
"github.com/vmware-tanzu/velero/pkg/metrics"
"github.com/vmware-tanzu/velero/pkg/util/logging"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down Expand Up @@ -143,7 +142,6 @@ type server struct {
metricsAddress string
kubeClientConfig *rest.Config
kubeClient kubernetes.Interface
veleroClient velero_clientset.Interface
pluginClient plugin_clientset.Interface
pluginInformerFactory pluginInformers.SharedInformerFactory
kubeInformerFactory kubeinformers.SharedInformerFactory
Expand Down Expand Up @@ -216,19 +214,17 @@ func getVCConfigParams(config serverConfig, params map[string]interface{}, logge

func newServer(f client.Factory, config serverConfig, logger *logrus.Logger) (*server, error) {
logger.Infof("data manager server is started")
kubeClient, err := f.KubeClient()
if err != nil {
return nil, err
}

veleroClient, err := f.Client()
clientConfig, err := f.ClientConfig()
if err != nil {
return nil, err
}
clientConfig.QPS = config.clientQPS
clientConfig.Burst = config.clientBurst

clientConfig, err := f.ClientConfig()
kubeClient, err := kubernetes.NewForConfig(clientConfig)
if err != nil {
return nil, err
return nil, errors.WithStack(err)
}

pluginClient, err := plugin_clientset.NewForConfig(clientConfig)
Expand Down Expand Up @@ -287,7 +283,6 @@ func newServer(f client.Factory, config serverConfig, logger *logrus.Logger) (*s
namespace: f.Namespace(),
metricsAddress: config.metricsAddress,
kubeClient: kubeClient,
veleroClient: veleroClient,
pluginClient: pluginClient,
pluginInformerFactory: pluginInformers.NewSharedInformerFactoryWithOptions(pluginClient, constants.ResyncPeriod, pluginInformers.WithNamespace(f.Namespace())),
kubeInformerFactory: kubeinformers.NewSharedInformerFactory(kubeClient, 0),
Expand Down
2 changes: 1 addition & 1 deletion pkg/constants/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const (

const (
// Duration after which Reflector resyncs CRs and calls UpdateFunc on each of the existing CRs.
ResyncPeriod = 30 * time.Second
ResyncPeriod = 10 * time.Minute

DefaultSecretResyncPeriod = 5 * time.Minute
)
Expand Down

0 comments on commit 8df7800

Please sign in to comment.