Skip to content

Commit

Permalink
Don't enable WebSocket compression by default (#912)
Browse files Browse the repository at this point in the history
* Don't enable WebSocket compression by default

Currently there are some problems where the flate writer might take
up more allocations than expected when there are lots of WebSocket
clients.

Signed-off-by: Neil Twigg <[email protected]>

* fix tests

Signed-off-by: Caleb Lloyd <[email protected]>

* feature version bump

Signed-off-by: Caleb Lloyd <[email protected]>

---------

Signed-off-by: Neil Twigg <[email protected]>
Signed-off-by: Caleb Lloyd <[email protected]>
Co-authored-by: Caleb Lloyd <[email protected]>
  • Loading branch information
neilalexander and Caleb Lloyd committed Jun 18, 2024
1 parent 1d561e8 commit 1c224be
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 15 deletions.
2 changes: 1 addition & 1 deletion helm/charts/nats/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ keywords:
- nats
- messaging
- cncf
version: 1.1.12
version: 1.2.0
home: http://github.com/nats-io/k8s
maintainers:
- email: [email protected]
Expand Down
1 change: 0 additions & 1 deletion helm/charts/nats/files/config/websocket.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{{- with .Values.config.websocket }}
port: {{ .port }}
compression: true

{{- if .tls.enabled }}
{{- with .tls }}
Expand Down
4 changes: 2 additions & 2 deletions helm/charts/nats/test/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ config:
websocket:
enabled: true
merge:
compression: false
compression: true
patch: [{op: add, path: /same_origin, value: true}]
mqtt:
enabled: true
Expand Down Expand Up @@ -358,7 +358,7 @@ config:
}
expected.Conf.Value["websocket"] = map[string]any{
"port": int64(8080),
"compression": false,
"compression": true,
"no_tls": true,
"same_origin": true,
}
Expand Down
5 changes: 2 additions & 3 deletions helm/charts/nats/test/ports_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,8 @@ service:
"no_advertise": true,
}
expected.Conf.Value["websocket"] = map[string]any{
"port": int64(1003),
"compression": true,
"no_tls": true,
"port": int64(1003),
"no_tls": true,
}
expected.Conf.Value["mqtt"] = map[string]any{
"port": int64(1004),
Expand Down
10 changes: 4 additions & 6 deletions helm/charts/nats/test/resources_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,8 @@ natsBox:
}

expected.Conf.Value["websocket"] = map[string]any{
"port": int64(8080),
"no_tls": true,
"compression": true,
"port": int64(8080),
"no_tls": true,
}

env := []corev1.EnvVar{
Expand Down Expand Up @@ -513,9 +512,8 @@ natsBox:
expected := DefaultResources(t, test)

expected.Conf.Value["websocket"] = map[string]any{
"port": int64(8080),
"no_tls": true,
"compression": true,
"port": int64(8080),
"no_tls": true,
}

annotations := func() map[string]string {
Expand Down
3 changes: 1 addition & 2 deletions helm/charts/nats/test/tls_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,7 @@ config:
"no_advertise": true,
}
expected.Conf.Value["websocket"] = map[string]any{
"port": int64(8080),
"compression": true,
"port": int64(8080),
}
expected.Conf.Value["mqtt"] = map[string]any{
"port": int64(1883),
Expand Down

0 comments on commit 1c224be

Please sign in to comment.