[SR-Users] Problem with max tcp connections

Jose Fco. Irles DurĂ¡ josefu at gmail.com
Thu Nov 21 14:46:39 CET 2019


Hi

I have a kamailio 5.1.2 as load balancer and registration offloading,
but I have a problem with the max tcp connections that it can handle.
I suspect that is a linux limit, but I don't find the reason or config.
When that limit arrives, I can't connect to kamailio and I receive
"Connection reset by peer", but I can't view any error message in the
logs.

If I check the connections in kamailio, I view that it have "free" connections:
# kamctl kamcmd core.tcp_info
{
readers: 8
max_connections: 4096
max_tls_connections: 2048
opened_connections: 2655
opened_tls_connections: 0
write_queued_bytes: 0
}


I have this configs in kamailio.conf (related to tcp)
disable_tcp=no
tcp_connection_lifetime=3610
tcp_connect_timeout=5
tcp_crlf_ping=yes
tcp_accept_aliases=no
tcp_keepalive=yes
tcp_keepidle=5
tcp_rd_buf_size=65536
tcp_conn_wq_max=131072
mlock_pages=yes
shm_force_alloc=yes
tcp_max_connections=4096

The shm memory to 256 and the pkg memory to 32.

And, following this doc:
https://github.com/kamailio/kamailio/blob/master/doc/tutorials/tcp_tunning.txt
I have setted this values:
net.ipv4.ip_local_port_range = 1024 65535
net.core.somaxconn = 65535
net.core.netdev_max_backlog = 182757

Also, I had checked the limits for the main process pid:
Limit                     Soft Limit           Hard Limit           Units
Max cpu time              unlimited            unlimited            seconds
Max file size             unlimited            unlimited            bytes
Max data size             unlimited            unlimited            bytes
Max stack size            8388608              unlimited            bytes
Max core file size        unlimited            unlimited            bytes
Max resident set          unlimited            unlimited            bytes
Max processes             unlimited            unlimited            processes
Max open files            1048576              1048576              files
Max locked memory         16777216             16777216             bytes
Max address space         unlimited            unlimited            bytes
Max file locks            unlimited            unlimited            locks
Max pending signals       386297               386297               signals
Max msgqueue size         819200               819200               bytes
Max nice priority         0                    0
Max realtime priority     0                    0
Max realtime timeout      unlimited            unlimited            us

The service is running inside a lxc container, without any resource
limit, connected to the outside word throught macvlan interface.

Where can I find problem source?


Best regards



More information about the sr-users mailing list