This is the code to create sockets (it has 3 public IPs on the same eth0):
Code:
socket = new Socket(ip.AddressFamily, SocketType.Stream, ProtocolType.Tcp)
{
// Turn off Nagle's algorithm since it degrades performance in most HttpClient scenarios.
NoDelay = true,
ReceiveBufferSize = respbufferSize,
SendBufferSize = reqbufferSize,
ExclusiveAddressUse = false,
Ttl = time_out,//64
};
socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true);
socket.Bind(endPoints[DateTime.UtcNow.Ticks%endPoints.Length]);
await socket.ConnectAsync(ip, context.DnsEndPoint.Port, cancellationToken).ConfigureAwait(false);
NetworkStream ns = new NetworkStream(socket, ownsSocket: true);
return ns;
also i do set the following system params:
Code:
/sbin/sysctl -w net.core.somaxconn=65536
/sbin/sysctl -w net.ipv4.ip_local_port_range="1024 65535"
/sbin/sysctl -w net.ipv4.tcp_tw_reuse=1
/sbin/sysctl -w net.ipv4.tcp_fin_timeout=15
Bookmarks