This is an automated email from the ASF dual-hosted git repository.
yjhjstz pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudberry.git
The following commit(s) were added to refs/heads/main by this push:
new c13c5c06e2d gpfdist: Increase socket buffers when compression is
enabled
c13c5c06e2d is described below
commit c13c5c06e2d27c6f1b0a7b2ea5acb2c5b7e13a5b
Author: Jianghua Yang <[email protected]>
AuthorDate: Thu Jun 26 16:20:45 2025 +0000
gpfdist: Increase socket buffers when compression is enabled
When gpfdist operates with compression, the data flow can become
"bursty". The compression engine may produce large chunks of data at
once, which can fill the default system socket buffers quickly. This
is especially true on high-bandwidth or high-latency networks.
If the TCP socket buffer (SO_SNDBUF) is too small, it can cause the
`write()` call to block, stalling the compression pipeline and leading
to poor performance. A small receive buffer (SO_RCVBUF) on the gpfdist
side can similarly cause TCP backpressure that stalls the sender.
---
src/bin/gpfdist/gpfdist.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/src/bin/gpfdist/gpfdist.c b/src/bin/gpfdist/gpfdist.c
index 4a38bc21a58..ab3a5b159c4 100644
--- a/src/bin/gpfdist/gpfdist.c
+++ b/src/bin/gpfdist/gpfdist.c
@@ -2325,6 +2325,22 @@ static void do_accept(int fd, short event, void* arg)
closesocket(sock);
goto failure;
}
+
+ if (opt.compress)
+ {
+ int recv_buf_size = 128 * 1024; /* 128KB receive buffer */
+ int send_buf_size = 128 * 1024; /* 128KB send buffer */
+
+ if (setsockopt(sock, SOL_SOCKET, SO_RCVBUF,
(void*)&recv_buf_size, sizeof(recv_buf_size)) == -1)
+ {
+ gwarning(NULL, "Setting SO_RCVBUF to 128KB failed,
using system default");
+ }
+
+ if (setsockopt(sock, SOL_SOCKET, SO_SNDBUF,
(void*)&send_buf_size, sizeof(send_buf_size)) == -1)
+ {
+ gwarning(NULL, "Setting SO_SNDBUF to 128KB failed,
using system default");
+ }
+ }
if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (void*) &on, sizeof(on))
== -1)
{
gwarning(NULL, "Setting SO_REUSEADDR on socket failed");
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]