How many connections can my server handle?

Heleman Vargas3 years ago

I have my server configured to support 50,000 connections. Currently I work with approximately 800 GPS gt06 devices and from time to time the Traccar application crashes and I receive the error:

 exceptionCaught() event was fired, and it reached at the tail of the pipeline. It usually means the last handler in the pipeline did not handle the exception. - Too many open files - IOException (...)

I have seen this error in other forum posts and it all comes down to the optimization settings: Optimization

but it does not match the number of devices that I have with my current configuration:

root@traccar-prod:~# cat /proc/$(pidof java)/limits | grep "open files"
Max open files            50000                50000                files
root@traccar-prod:~# ulimit -n
50000

in /etc/sysctl.conf :

vm.max_map_count = 250000
fs.file-max = 250000
net.ipv4.ip_local_port_range = 1024 65535
root@traccar-prod:~# cat /etc/systemd/system/traccar.service
[Unit]
Description=traccar
After=network.target

[Service]
Type=simple
WorkingDirectory=/opt/traccar
ExecStart=/opt/traccar/jre/bin/java -Xmx2G -jar tracker-server.jar conf/traccar.xml
SyslogIdentifier=traccar
SuccessExitStatus=143
LimitNOFILE=50000

It strikes me that when I am ready the connections continue to increase and seem to accumulate:

root@traccar-prod:~# netstat | grep ESTABLISHED | grep 5023 | wc -l
9357

any ideas to solve?

Anton Tananaev3 years ago

Have you configured a timeout?

Heleman Vargas3 years ago

hi Anton, thanks for the prompt reply. I don't have any timeout settings in my traccar.xml file, apparently the solution is there. How would this parameter be applied in my configuration?

[protocol].timeout
<entry key='gt06.timeout'>600</entry>

value delivered in seconds for a 10 minute setting. it is right?

Anton Tananaev3 years ago

Correct. You can also use server.timeout if you want it to apply to all protocols.

Heleman Vargas3 years ago

thank you very much Anton! I think that's the solution, I'll try it!

Castillo3 years ago

@Heleman Vargas

Please, give us an update if it fix your problem

Heleman Vargas3 years ago

Issue resolved! this parameter solved the problem:

<entry key = 'server.timeout'> 600 </entry>

Thanks a lot!