How to do it...

To tune the kernel for better network performance, execute the following steps (for more information on what the kernel tunables are, read the How it works... section):

  1. Increase the max TCP send and receive socket buffer size:
root@kvm:~# sysctl net.core.rmem_maxnet.core.rmem_max = 212992root@kvm:~# sysctl net.core.wmem_maxnet.core.wmem_max = 212992root@kvm:~# sysctl net.core.rmem_max=33554432net.core.rmem_max = 33554432root@kvm:~# sysctl net.core.wmem_max=33554432net.core.wmem_max = 33554432root@kvm:~#
  1. Increase the TCP buffer limits: min, default, and max number of bytes. Set max to 16 MB for 1 GE NIC, and 32 M or 54 M for 10 GE NIC:
root@kvm:~# sysctl net.ipv4.tcp_rmemnet.ipv4.tcp_rmem = 4096 87380 6291456root@kvm:~# ...

Get KVM Virtualization Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.