-1

I am a new bee in the networking field. I have deployed a website which is built in java. My site's response slows down after increasing TCP/IP connections. I have use below command to check the coneections:_ netstat -an|awk '/tcp/ {print $6}'|sort -nr| uniq -c

And below is the response:- 12804 TIME_WAIT 8 LISTEN 75 ESTABLISHED 571 CLOSE_WAIT

Would you please tell me how these ESTABLISHED connections are increasing and how can I handle these connections.Do we need to handle these connections on application level or server level?

My java application using Postgres DB and running on Linux OS.

Thanks in advance,

2 Answers2

0

You wrote that you deployed a website, but to answer your question more details needed. What server do you use (servlet container)? Each servlet container can be configured with the number of threads which can service your requests. If you add more threads, then your application can become more responsive, but memory consumption will increase. So, you should find the balance.

In Tomcat (which is very popular) you can configure threads in ${tomcat-folder}/conf/server.xml file in <Connector/> tag.
Example for https config:

<Connector port="8443" protocol="org.apache.coyote.http11.Http11AprProtocol"
               maxThreads="1000" SSLEnabled="true" scheme="https" secure="true" clientAuth="false"
               SSLProtocol="TLSv1.2" SSLCertificateFile="/tomcat/tomcat.crt" SSLCertificateKeyFile="/tomcat/tomcat.key"/>

Also, you have to distinguish maxThreads and MaxConnections properties, as described in Tomcat - maxThreads vs maxConnections

0

I have solved this problem by updating the kernel Ubuntu server.Before the update, my Ubuntu 14.04 server was using the 3.13.0-43 version kernel. My issue was fixed after updating the kernel version Linux-headers-4.4.0-116 Now connections are stable on the server.

Thanks