You haven't told us the purpose behind the tweak. Do you intend to increase, decrease or clamp the window size? Why?

On linux, setting socket buffers is subject to global net.core.rmem_max and wmem_max sysctl's.

If you do not specify (and therefore lock) the per-socket values via SO_RCVBUF, then linux tcp implementation will dynamically adjust the buffer size within the limits of net.ipv4.tcp_rmem and tcp_wmem. On my system, the tcp_rmem[2] is substantially higher than rmem_max...

The tcp window and buffer allocation should follow the actual need, depending on misc. factors such as memory pressure, link characteristics, remote behavior and so on. Linux kernel is open source. Go on and take a look at net/core/sock.c, net/ipv4/tcp{,_input,_output}.c, etc.

Again, is this to maximize single connection throughput? You could have other issues that prevent full link utilization. Linux supports multiple congestion control algorithms, so that's another thing to play with.


In reply to Re^3: changing tcp parameters when establishing connection by Anonymous Monk
in thread changing tcp parameters when establishing connection by iThunder

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.