-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Network transport (2) - TCP/KCP protocol can be switched by cfg #1895
feat: Network transport (2) - TCP/KCP protocol can be switched by cfg #1895
Conversation
e133727
to
a2089b8
Compare
.github/workflows/test-lint.yml
Outdated
|
||
- name: Free Disk Space (Ubuntu) | ||
uses: jlumbroso/free-disk-space@main | ||
with: | ||
android: false | ||
dotnet: true | ||
haskell: false | ||
large-packages: false | ||
docker-images: false | ||
swap-storage: false | ||
|
||
- name: Setup Go, tools and caching |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(maybe it needs some better fix, It looks like, the linter cache is growing and growing)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@michaljurecko We are encoutering this issue in other PRs. Should we disable caching if the linter cache is growing? Currently I do not have much space to investigate it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jachym-tousek-keboola Petr needs the fix, I am mergin it, you comment will be addresed in next PRs, if any.
807d4f0
to
2acaa38
Compare
2acaa38
to
df4487b
Compare
df4487b
to
323d96d
Compare
internal/pkg/service/stream/storage/level/local/diskwriter/network/transport/transport_kcp.go
Show resolved
Hide resolved
internal/pkg/service/stream/storage/level/local/diskwriter/network/transport/util.go
Show resolved
Hide resolved
internal/pkg/service/stream/storage/level/local/diskwriter/network/transport/transport_kcp.go
Show resolved
Hide resolved
c.SetACKNoDelay(true) // send data immediately, needed for bigger payloads | ||
c.SetNoDelay(1, 10, 2, 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For context, why?
During testing of upper layers, I found that writing 100MB
takes 5s
to write.
It didn't fit in any way with the previous experiments that I did when I was choosing the protocol.
That's why I added the TCP protocol there, for comparison.
Finally, after a few hours, I realized that I forgot to set SetACKNoDelay(true)
, which makes the difference.
Otherwise, it waits for the next sending window, triggered by a timer.
It makes sense for small messages that are smaller than an UDP packet (~1KB), but for our 10KB+ records it slows down the write (we have buffers in the pipeline).
Stream Kubernetes Diff [CI]Between Expand--- /tmp/artifacts/test-k8s-state.old.json.processed.kv 2024-07-10 06:42:14.169618260 +0000
+++ /tmp/artifacts/test-k8s-state.new.json.processed.kv 2024-07-10 06:42:14.617623054 +0000
@@ -13 +13 @@
-<ConfigMap/stream-config>.data["config.yaml"] = "###############################################################################################...
+<ConfigMap/stream-config>.data["config.yaml"] = "###############################################################################################...
@@ -194 +194 @@
-<Deployment/stream-api>.spec.template.spec.containers[0].image = "docker.io/keboola/stream-api:95f6057-1720593118";
+<Deployment/stream-api>.spec.template.spec.containers[0].image = "docker.io/keboola/stream-api:582ec36-1720593493";
@@ -352 +352 @@
-<Deployment/stream-http-source>.spec.template.spec.containers[0].image = "docker.io/keboola/stream-api:95f6057-1720593118";
+<Deployment/stream-http-source>.spec.template.spec.containers[0].image = "docker.io/keboola/stream-api:582ec36-1720593493";
@@ -507 +507 @@
-<Deployment/stream-storage-coordinator>.spec.template.spec.containers[0].image = "docker.io/keboola/stream-api:95f6057-1720593118";
+<Deployment/stream-storage-coordinator>.spec.template.spec.containers[0].image = "docker.io/keboola/stream-api:582ec36-1720593493";
@@ -1186,2 +1186,2 @@
-<Pod/stream-api-<hash>>.spec.containers[0].image = "docker.io/keboola/stream-api:95f6057-1720593118";
-<Pod/stream-api-<hash>>.spec.containers[0].image = "docker.io/keboola/stream-api:95f6057-1720593118";
+<Pod/stream-api-<hash>>.spec.containers[0].image = "docker.io/keboola/stream-api:582ec36-1720593493";
+<Pod/stream-api-<hash>>.spec.containers[0].image = "docker.io/keboola/stream-api:582ec36-1720593493";
@@ -1506 +1506 @@
-<Pod/stream-etcd-0>.spec.containers[0].env[21].value = "new";
+<Pod/stream-etcd-0>.spec.containers[0].env[21].value = "existing";
@@ -1748 +1748 @@
-<Pod/stream-etcd-1>.spec.containers[0].env[21].value = "new";
+<Pod/stream-etcd-1>.spec.containers[0].env[21].value = "existing";
@@ -2056,2 +2056,2 @@
-<Pod/stream-http-source-<hash>>.spec.containers[0].image = "docker.io/keboola/stream-api:95f6057-1720593118";
-<Pod/stream-http-source-<hash>>.spec.containers[0].image = "docker.io/keboola/stream-api:95f6057-1720593118";
+<Pod/stream-http-source-<hash>>.spec.containers[0].image = "docker.io/keboola/stream-api:582ec36-1720593493";
+<Pod/stream-http-source-<hash>>.spec.containers[0].image = "docker.io/keboola/stream-api:582ec36-1720593493";
@@ -2436,2 +2436,2 @@
-<Pod/stream-storage-coordinator-<hash>>.spec.containers[0].image = "docker.io/keboola/stream-api:95f6057-1720593118";
-<Pod/stream-storage-coordinator-<hash>>.spec.containers[0].image = "docker.io/keboola/stream-api:95f6057-1720593118";
+<Pod/stream-storage-coordinator-<hash>>.spec.containers[0].image = "docker.io/keboola/stream-api:582ec36-1720593493";
+<Pod/stream-storage-coordinator-<hash>>.spec.containers[0].image = "docker.io/keboola/stream-api:582ec36-1720593493";
@@ -2663 +2663 @@
-<Pod/stream-storage-writer-reader-0>.spec.containers[0].image = "docker.io/keboola/stream-api:95f6057-1720593118";
+<Pod/stream-storage-writer-reader-0>.spec.containers[0].image = "docker.io/keboola/stream-api:582ec36-1720593493";
@@ -2739 +2739 @@
-<Pod/stream-storage-writer-reader-0>.spec.containers[1].image = "docker.io/keboola/stream-api:95f6057-1720593118";
+<Pod/stream-storage-writer-reader-0>.spec.containers[1].image = "docker.io/keboola/stream-api:582ec36-1720593493";
@@ -2910 +2910 @@
-<Pod/stream-storage-writer-reader-1>.spec.containers[0].image = "docker.io/keboola/stream-api:95f6057-1720593118";
+<Pod/stream-storage-writer-reader-1>.spec.containers[0].image = "docker.io/keboola/stream-api:582ec36-1720593493";
@@ -2986 +2986 @@
-<Pod/stream-storage-writer-reader-1>.spec.containers[1].image = "docker.io/keboola/stream-api:95f6057-1720593118";
+<Pod/stream-storage-writer-reader-1>.spec.containers[1].image = "docker.io/keboola/stream-api:582ec36-1720593493";
@@ -3038 +3038 @@
-<Pod/stream-storage-writer-reader-1>.spec.volumes[0].persistentVolumeClaim.claimName = "medium-001-stream-storage-writer-reader-1";
+<Pod/stream-storage-writer-reader-1>.spec.volumes[0].persistentVolumeClaim.claimName = "fast-001-stream-storage-writer-reader-1";
@@ -3041 +3041 @@
-<Pod/stream-storage-writer-reader-1>.spec.volumes[1].persistentVolumeClaim.claimName = "slow-001-stream-storage-writer-reader-1";
+<Pod/stream-storage-writer-reader-1>.spec.volumes[1].persistentVolumeClaim.claimName = "medium-001-stream-storage-writer-reader-1";
@@ -3044 +3044 @@
-<Pod/stream-storage-writer-reader-1>.spec.volumes[2].persistentVolumeClaim.claimName = "fast-001-stream-storage-writer-reader-1";
+<Pod/stream-storage-writer-reader-1>.spec.volumes[2].persistentVolumeClaim.claimName = "slow-001-stream-storage-writer-reader-1";
@@ -3228 +3228 @@
-<ReplicaSet/stream-api-<hash>>.spec.template.spec.containers[0].image = "docker.io/keboola/stream-api:95f6057-1720593118";
+<ReplicaSet/stream-api-<hash>>.spec.template.spec.containers[0].image = "docker.io/keboola/stream-api:582ec36-1720593493";
@@ -3393 +3393 @@
-<ReplicaSet/stream-http-source-<hash>>.spec.template.spec.containers[0].image = "docker.io/keboola/stream-api:95f6057-1720593118";
+<ReplicaSet/stream-http-source-<hash>>.spec.template.spec.containers[0].image = "docker.io/keboola/stream-api:582ec36-1720593493";
@@ -3555 +3555 @@
-<ReplicaSet/stream-storage-coordinator-<hash>>.spec.template.spec.containers[0].image = "docker.io/keboola/stream-api:95f6057-1720593118";
+<ReplicaSet/stream-storage-coordinator-<hash>>.spec.template.spec.containers[0].image = "docker.io/keboola/stream-api:582ec36-1720593493";
@@ -3596,0 +3597,12 @@
+<Secret/sh.helm.release.v1.stream-etcd.v2> = {};
+<Secret/sh.helm.release.v1.stream-etcd.v2>.apiVersion = "v1";
+<Secret/sh.helm.release.v1.stream-etcd.v2>.data = {};
+<Secret/sh.helm.release.v1.stream-etcd.v2>.kind = "Secret";
+<Secret/sh.helm.release.v1.stream-etcd.v2>.metadata = {};
+<Secret/sh.helm.release.v1.stream-etcd.v2>.metadata.labels = {};
+<Secret/sh.helm.release.v1.stream-etcd.v2>.metadata.labels.name = "stream-etcd";
+<Secret/sh.helm.release.v1.stream-etcd.v2>.metadata.labels.owner = "helm";
+<Secret/sh.helm.release.v1.stream-etcd.v2>.metadata.labels.version = "2";
+<Secret/sh.helm.release.v1.stream-etcd.v2>.metadata.name = "sh.helm.release.v1.stream-etcd.v2";
+<Secret/sh.helm.release.v1.stream-etcd.v2>.metadata.namespace = "stream";
+<Secret/sh.helm.release.v1.stream-etcd.v2>.type = "helm.sh/release.v1";
@@ -3862 +3874 @@
-<StatefulSet/stream-etcd>.spec.template.spec.containers[0].env[21].value = "new";
+<StatefulSet/stream-etcd>.spec.template.spec.containers[0].env[21].value = "existing";
@@ -4099 +4111 @@
-<StatefulSet/stream-storage-writer-reader>.spec.template.spec.containers[0].image = "docker.io/keboola/stream-api:95f6057-1720593118";
+<StatefulSet/stream-storage-writer-reader>.spec.template.spec.containers[0].image = "docker.io/keboola/stream-api:582ec36-1720593493";
@@ -4172 +4184 @@
-<StatefulSet/stream-storage-writer-reader>.spec.template.spec.containers[1].image = "docker.io/keboola/stream-api:95f6057-1720593118";
+<StatefulSet/stream-storage-writer-reader>.spec.template.spec.containers[1].image = "docker.io/keboola/stream-api:582ec36-1720593493";
(see artifacts in the Github Action for more information) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good but how did you compare TCP and KCP? Did you write some benchmarks?
There is test, which logs write duration, see code. If you want, write a benchmark, but as I wrote, it will not be sufficiently descriptive on localhost. I only needed such a simple comparison to find the issue, so the test was enough. |
Jira: https://keboola.atlassian.net/browse/PSGO-597
See #1894
Changes:
TCP/KCP
protocol can be switched by configuration.TCP
.KCP is on
localhost
2-3x slower than TCP, but it is expected.dataSize = 100MB
- both protocols are fast enough up to500MB/s
on localhost.Read more (
quic
is another R-UDP protocol, the principle is the same):