FS#36653 - [samba] TCP_CORK option needs to be added to 'static const smb_socket_option socket_options[]'

Attached to Project: Arch Linux
Opened by Eric Wang (enihcam) - Saturday, 24 August 2013, 08:55 GMT
Last edited by Tobias Powalowski (tpowa) - Thursday, 10 October 2013, 14:26 GMT
Task Type Feature Request
Category Packages: Extra
Status Closed
Assigned To Tobias Powalowski (tpowa)
Architecture All
Severity High
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 1
Private No

Details

Description:
In 'static const smb_socket_option socket_options[]'@/lib/util/util_net.c, we
need to add:

"
{"TCP_CORK", IPPROTO_TCP, TCP_CORK, 0, OPT_BOOL},
"

Imagine that the application using sendfile() transfers bulk data. Application
protocols usually require sending some information that helps interpret the
data first, known as a header. Typically, the header is small, and the
TCP_NODELAY is set on the socket. The packet with the header will be
transmitted immediately and, in some cases (depending on internal packet
counters), it could even cause a request of acknowledgement that this packet
was successfully received by the other side. Thus, the transfer of bulk data
will be delayed and unnecessary network traffic exchanged. **In particular, to
minimize the number of network operations, the sendfile() syscall should be
used together with the TCP/IP option called TCP_CORK.** We recommend setting
the TCP_CORK option when you're sure that you will be sending multiple data
sets together (such as header and a body of HTTP response), with no delays
between them. This can greatly benefit the performance of WWW, FTP, and file
servers, as well as simplifying your life.

Additional info:
I sent this request to samba team but they are not willing to add it because TCP_CORK is 'of course very Linux-specific', or I need to provide the patch myself.
https://bugzilla.samba.org/show_bug.cgi?id=10111

I just don't know how to make patch, but I know it's at 'static const smb_socket_option socket_options[]'@/lib/util/util_net.c, please add

{"TCP_CORK", IPPROTO_TCP, TCP_CORK, 0, OPT_BOOL},

I also add the TCP_CORK optimization guide to https://wiki.archlinux.org/index.php/Samba/Tips_and_tricks#Performance Optimization

Thanks!
This task depends upon

Closed by  Tobias Powalowski (tpowa)
Thursday, 10 October 2013, 14:26 GMT
Reason for closing:  Won't implement
Comment by Eric Wang (enihcam) - Monday, 26 August 2013, 09:59 GMT
From fc6c28a55568f874e233686aaa38f832008afa80 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Jacke?= <bj@sernet.de>
Date: Mon, 26 Aug 2013 10:45:49 +0200
Subject: [PATCH] util: allow setting TCP_CORK / TCP_NOPUSH socket options

this might be usefull boost performance when "use sendfile" is enabled

See bug #10111
---
lib/util/util_net.c | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/lib/util/util_net.c b/lib/util/util_net.c
index 83afda4..7729828 100644
--- a/lib/util/util_net.c
+++ b/lib/util/util_net.c
@@ -775,6 +775,12 @@ static const smb_socket_option socket_options[] = {
#ifdef TCP_NODELAY
{"TCP_NODELAY", IPPROTO_TCP, TCP_NODELAY, 0, OPT_BOOL},
#endif
+#ifdef TCP_CORK
+ {"TCP_CORK", IPPROTO_TCP, TCP_CORK, 0, OPT_BOOL},
+#endif
+#ifdef TCP_NOPUSH
+ {"TCP_NOPUSH", IPPROTO_TCP, TCP_NOPUSH, 0, OPT_BOOL},
+#endif
#ifdef TCP_KEEPCNT
{"TCP_KEEPCNT", IPPROTO_TCP, TCP_KEEPCNT, 0, OPT_INT},
#endif
--
1.8.3.4

Comment by Tobias Powalowski (tpowa) - Thursday, 10 October 2013, 14:26 GMT
I'll not add a custom patch without being accepted upstream.

Loading...