Skip to content

Commit

Permalink
Make sending client httpstartstopevents configurable
Browse files Browse the repository at this point in the history
#159

Switching off these events reduces the CPU load on gorouter and
doppler VMS significantly.

These events are of type "timer".

Note that they should not be switched off when the app-autoscaler
is used.
  • Loading branch information
stefanlay authored and ameowlia committed Mar 2, 2021
1 parent 2cacb51 commit 7cdfc48
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 1 deletion.
4 changes: 4 additions & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,8 @@ type Config struct {
PerRequestMetricsReporting bool `yaml:"per_request_metrics_reporting,omitempty"`

SendHttpStartStopServerEvent bool `yaml:"send_http_start_stop_server_event,omitempty"`

SendHttpStartStopClientEvent bool `yaml:"send_http_start_stop_client_event,omitempty"`
}

var defaultConfig = Config{
Expand Down Expand Up @@ -334,6 +336,8 @@ var defaultConfig = Config{
PerRequestMetricsReporting: true,

SendHttpStartStopServerEvent: true,

SendHttpStartStopClientEvent: true,
}

func DefaultConfig() (*Config, error) {
Expand Down
11 changes: 11 additions & 0 deletions config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -639,6 +639,17 @@ backends:
Expect(config.SendHttpStartStopServerEvent).To(BeFalse())
})

It("defaults SendHttpStartStopClientEvent to true", func() {
Expect(config.SendHttpStartStopClientEvent).To(Equal(true))
})

It("sets SendHttpStartStopClientEvent", func() {
var b = []byte(`send_http_start_stop_client_event: false`)
err := config.Initialize(b)
Expect(err).ToNot(HaveOccurred())
Expect(config.SendHttpStartStopClientEvent).To(BeFalse())
})

})

Describe("Process", func() {
Expand Down
1 change: 1 addition & 0 deletions proxy/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ func NewProxy(
DisableCompression: true,
TLSClientConfig: routeServiceTLSConfig,
},
IsInstrumented: cfg.SendHttpStartStopClientEvent,
}

prt := round_tripper.NewProxyRoundTripper(
Expand Down
8 changes: 7 additions & 1 deletion proxy/round_tripper/dropsonde_round_tripper.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ func (d *dropsondeRoundTripper) CancelRequest(r *http.Request) {
type FactoryImpl struct {
BackendTemplate *http.Transport
RouteServiceTemplate *http.Transport
IsInstrumented bool
}

func (t *FactoryImpl) New(expectedServerName string, isRouteService bool) ProxyRoundTripper {
Expand All @@ -52,5 +53,10 @@ func (t *FactoryImpl) New(expectedServerName string, isRouteService bool) ProxyR
TLSClientConfig: customTLSConfig,
TLSHandshakeTimeout: template.TLSHandshakeTimeout,
}
return NewDropsondeRoundTripper(newTransport)
if t.IsInstrumented {
return NewDropsondeRoundTripper(newTransport)
} else {
return newTransport
}

}

0 comments on commit 7cdfc48

Please sign in to comment.