1. Main direction: In the source project to find all references to InputStream or other streams, to see if it is used up, normal close off, it is recommended here to put the flow close to the finally block, so the exception will also go to the close stream.
2. Secondary direction: Session or other useful to the socket code, carefully check to see if there is no resources to release the place
Also attached:
The following 2 instructions in Linux show that 1024 of the system default open files is not sufficient to support the test, adjust to 4096 accordingly .
The following script is executed at the peak time of system access as root user, and the possible results are as follows:
# Lsof-n|awk ' {print$2} ' |sort|uniq-c |sort-nr|more
1170 32229
57 24244
57 24231
56 24264
The first column is the number of open file handles and the second column is the process number.
# Ps-aef|grep 32229
Root 32229 1 10:58 pts/0 00:09:17/usr/java/jdk1.6.0_32/bin/java-djava.util.logging.config.file=/kmsapp/apache -tomcat-6.0.35_engine/conf/logging.properties-xms512m-xmx2048m-djava.util.logging.manager= Org.apache.juli.classloaderlogmanager-djava.endorsed.dirs=/kmsapp/apache-tomcat-6.0.35_engine/endorsed- Classpath/kmsapp/apache-tomcat-6.0.35_engine/bin/bootstrap.jar-dcatalina.base=/kmsapp/apache-tomcat-6.0.35_ engine-dcatalina.home=/kmsapp/apache-tomcat-6.0.35_engine-djava.io.tmpdir=/kmsapp/apache-tomcat-6.0.35_engine/ Temporg.apache.catalina.startup.Bootstrap start
found that the Tomcat process opened up to a maximum number of file handles, and it opened the number of 1170 file handles, exceeding the default value of 1024.
so you should set the value to 4096, so if you want to make a permanent adjustment, follow these 2 steps:
1. Modify/etc/security/limits.conf
modify its content through vi/etc/security/limits.conf, and add it at the end of the file (values can be defined yourself):
* Soft nofile = 4096
* Hard nofile = 4096
2. Modify/etc/profile
through Vi/etc/profile modifications, add the following at the end:
ulimit-n4096
and then log back in to take effect.