• Sunil Muthuswamy's avatar
    hv_sock: perf: Allow the socket buffer size options to influence the actual socket buffers · ac383f58
    Sunil Muthuswamy authored
    Currently, the hv_sock buffer size is static and can't scale to the
    bandwidth requirements of the application. This change allows the
    applications to influence the socket buffer sizes using the SO_SNDBUF and
    the SO_RCVBUF socket options.
    
    Few interesting points to note:
    1. Since the VMBUS does not allow a resize operation of the ring size, the
    socket buffer size option should be set prior to establishing the
    connection for it to take effect.
    2. Setting the socket option comes with the cost of that much memory being
    reserved/allocated by the kernel, for the lifetime of the connection.
    
    Perf data:
    Total Data Transfer: 1GB
    Single threaded reader/writer
    Results below are summarized over 10 iterations.
    
    Linux hvsocket writer + Windows hvsocket reader:
    |---------------------------------------------------------------------------------------------|
    |Packet size ->   |      128B       |       1KB       |       4KB       |        64KB         |
    |---------------------------------------------------------------------------------------------|
    |SO_SNDBUF size | |                 Throughput in MB/s (min/max/avg/median):                  |
    |               v |                                                                           |
    |---------------------------------------------------------------------------------------------|
    |      Default    | 109/118/114/116 | 636/774/701/700 | 435/507/480/476 |   410/491/462/470   |
    |      16KB       | 110/116/112/111 | 575/705/662/671 | 749/900/854/869 |   592/824/692/676   |
    |      32KB       | 108/120/115/115 | 703/823/767/772 | 718/878/850/866 | 1593/2124/2000/2085 |
    |      64KB       | 108/119/114/114 | 592/732/683/688 | 805/934/903/911 | 1784/1943/1862/1843 |
    |---------------------------------------------------------------------------------------------|
    
    Windows hvsocket writer + Linux hvsocket reader:
    |---------------------------------------------------------------------------------------------|
    |Packet size ->   |     128B    |      1KB        |          4KB        |        64KB         |
    |---------------------------------------------------------------------------------------------|
    |SO_RCVBUF size | |               Throughput in MB/s (min/max/avg/median):                    |
    |               v |                                                                           |
    |---------------------------------------------------------------------------------------------|
    |      Default    | 69/82/75/73 | 313/343/333/336 |   418/477/446/445   |   659/701/676/678   |
    |      16KB       | 69/83/76/77 | 350/401/375/382 |   506/548/517/516   |   602/624/615/615   |
    |      32KB       | 62/83/73/73 | 471/529/496/494 |   830/1046/935/939  | 944/1180/1070/1100  |
    |      64KB       | 64/70/68/69 | 467/533/501/497 | 1260/1590/1430/1431 | 1605/1819/1670/1660 |
    |---------------------------------------------------------------------------------------------|
    Signed-off-by: default avatarSunil Muthuswamy <sunilmut@microsoft.com>
    Reviewed-by: default avatarDexuan Cui <decui@microsoft.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    ac383f58
hyperv_transport.c 25.1 KB