[Spice-devel] Untested idea: enlarge the TCP send buffer (server), receive buffer (client)

Yaniv Kaul ykaul at redhat.com
Mon Feb 13 13:27:38 PST 2012


On 02/13/2012 10:47 PM, Yaniv Kaul wrote:
> For both LAN (high bandwidth, high performance) and WAN (high latency) 
> perhaps it may be worthwhile to increase (via socket options) the TCP 
> receive (on the client) and send (on the server) buffers for the 
> display channel? It will cause:
> - bigger TCP window (which is good for both cases above)
> - some waste of memory (negligible,  I think it's enough to increase 
> to 256K or so for each).
>
> I suspect it might make a difference especially in video streaming.
>
> It's a simple patch (I hope - via setsockopt()  ) and does not require 
> feature negotiation, but I'm not sure I have the tools to test such 
> change.
>
> Thoughts?
> Y.
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel

Compile tested only, on the server:

diff --git a/server/reds.c b/server/reds.c
index 828ba65..6c52c2a 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -2696,6 +2696,7 @@ static RedLinkInfo 
*reds_init_client_connection(int socket)
      RedsStream *stream;
      int delay_val = 1;
      int flags;
+    int sndsize = 256 * 1204;

      if ((flags = fcntl(socket, F_GETFL)) == -1) {
          red_printf("accept failed, %s", strerror(errno));
@@ -2712,6 +2713,11 @@ static RedLinkInfo 
*reds_init_client_connection(int socket)
              red_printf("setsockopt failed, %s", strerror(errno));
          }
      }
+    if (setsockopt(socket, SOL_SOCKET, SO_SNDBUF, (char *)&sndsize, 
(int)sizeof(sndsize)) == -1) {
+       if (errno != ENOTSUP) {
+           red_printf("setsockopt for SO_SNDBUF failed, %s", 
strerror(errno));
+       }
+    }

      link = spice_new0(RedLinkInfo, 1);
      stream = spice_new0(RedsStream, 1);



More information about the Spice-devel mailing list