WAS下的应用系统,在对其他性能开至较大时出现系统无法返回的情况,查看日志错误为Too Many Open Files.
处理方法如下:
1. ulimit -a 查看系统目前资源限制的设定。
[root@test security]# ulimit -a /*etc/security*/
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
file size (blocks, -f) unlimited
max locked memory (kbytes, -l) unlimited
max memory size (kbytes, -m) unlimited
open files (-n) 1024
pipe size (512 bytes, -p) 8
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) 7168
virtual memory (kbytes, -v) unlimited
通过以上命令,我们可以看到open files 的最大数为1024
那么我们可以通过一下命令修改该参数的最大值
ulimit -HSn 4096
[root@test security]# ulimit -n 4096
[root@test security]# ulimit -a
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
file size (blocks, -f) unlimited
max locked memory (kbytes, -l) unlimited
max memory size (kbytes, -m) unlimited
open files (-n) 4096
pipe size (512 bytes, -p) 8
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) 7168
virtual memory (kbytes, -v) unlimited
使用lsof |wc -l进行监控
修改etc/profile,添加一行,则重启生效
检查/proc/sys/fs/file-max文件来确认最大打开文件数
这样的优化后 lsof -p $java_pid|wc -l可以跑到4千以上都不会抛出too many open files。
打开的文件句柄是在 /proc/sys/fs/file-nr
lsof -n |awk '{print $2}'|sort|uniq -c |sort -nr|more
# cat /proc/sys/fs/file-max 如果设置值太小, 修改文件/etc/sysctl.conf的变量到合适的值。 这样会在每次重启之后生效。 如果设置值够大,跳过下步。 # echo 2048 > /proc/sys/fs/file-max 。编辑文件/etc/sysctl.conf,插入下行:fs.file-max = 8192
在/etc/security/limits.conf文件中设置最大打开文件数, 下面是一行提示:
#<domain> <type> <item> <value> 添加如下这行。
* - nofile 8192
这行设置了每个用户的默认打开文件数为2048。 注意"nofile"项有两个可能的限制措施。就是<type>项下的hard和soft。 要使修改过得最大打开文件数生效,必须对这两种限制进行设定。 如果使用"-"字符设定<type>, 则hard和soft设定会同时被设定。
/etc/sysctl.conf
添加:
# Decrease the time default value for tcp_fin_timeout connection
net.ipv4.tcp_fin_timeout = 30
# Decrease the time default value for tcp_keepalive_time connection
net.ipv4.tcp_keepalive_time = 1800
# Turn off tcp_window_scaling
net.ipv4.tcp_window_scaling = 0
# Turn off the tcp_sack
net.ipv4.tcp_sack = 0
#Turn off tcp_timestamps
net.ipv4.tcp_timestamps = 0
然后 service network restart,这些都和TCP sockets有关的优化。
另外需要在 /etc/rc.d/rc.local里添加已使得重启的时候生效。
echo "30">/proc/sys/net/ipv4/tcp_fin_timeout
echo "1800">/proc/sys/net/ipv4/tcp_keepalive_time
echo "0">/proc/sys/net/ipv4/tcp_window_scaling
echo "0">/proc/sys/net/ipv4/tcp_sack
echo "0">/proc/sys/net/ipv4/tcp_timestamps
2. 标准 stdio 函数库可用的 FILE 结构数目导致数量过载
3. 引起文件描述符打开的JAVA函数:BufferReader
发表评论
-
控制台SESSIONOUT
2010-09-17 13:04 1137通过配置文件来修改WAS控制台Session过期时间的方法 ... -
SOCKET 异常类型
2010-03-30 16:42 1741Error code Meaning ... -
Transaction Introduce
2010-03-30 14:01 1120Transaction 什么是Transaction? ... -
DB2 死锁
2010-03-26 10:33 4220解决“SQL0911N 因为死锁 ... -
WAS 事物引起的错误
2010-03-25 17:13 2465一、性能故障的现 ... -
案例分析
2010-03-16 16:53 1585系统上线后偶有宕机, ... -
Remote Rendering portlet hangs on socketRead0()
2010-03-16 16:46 1937当我们在JAVACORE文件中发现很多WEBCONTAINER ... -
WAS Portal Theme Development And Configuration
2010-03-12 22:37 1300我们先介绍一下主题和 ... -
Portal 主题部署
2010-03-12 22:21 1373部署定制的主题和外 ... -
应用服务器出现错误的原因简析
2010-03-11 22:19 873磁盘已满 导致 ... -
急性者的性能优化
2010-03-05 11:02 880引言 如果您是这样一个人:启动并运行 WebSphere ... -
控制台安全性破解
2010-03-04 23:05 949常在河边走,哪有不湿鞋,WebSphere管理中最让人 ... -
查看WAS版本
2010-03-04 22:39 2617一、查看WAS版本的方式:1、命令行 cd $WAS_HOM ... -
WAS设置编码方式
2010-03-04 22:29 4371当安装了webSphere的小型机的默认编码不是GBK ... -
WAS 6.1 的类加载四
2010-03-04 12:35 109212.5.2 步骤 2:添加一个EJB模块和工具JAR ... -
WAS的类加载机制三
2010-03-04 12:34 141712.3.1 类加载策略 ... -
WAS的类加载机制二
2010-03-04 12:33 90412.2 概览Websphere 类加载器 注意:每一个 ... -
WAS的类加载机制一(包含JVM的类加载机制.转载)
2010-03-04 12:29 1079abstract:本文截取IBM 红皮书《WebSpher ...
相关推荐
Linux下运行tomcat或者was出现java.net.SocketException: 打开的文件过多错误 tomcat报“too many open files”的错误,解决办法如下:
大并发时后台报too many open files - 这个问题是由于系统打开文件数量限制导致的。 - 可以通过调整操作系统的文件描述符限制来解决,例如使用`ulimit -n`命令。 ##### 3. 修改`/ehr/weblogic11/user_projects/...
has been almost too successful at making remote files indistinguishable from local files. For instance, a program that backs up files on a local disk to tape needs to avoid stumbling into NFS file...
Too many open files (打开文件过多) 当程序尝试同时打开的文件数量超过了操作系统允许的限制时,会遇到这个错误。这可能是因为没有正确关闭不再需要的文件,或者一次性打开了大量文件。优化文件处理逻辑,确保...
Made the color of the Startup page darker (was too bright on some monitors). Can now change or reset the color of the Startup page by clicking the 'Options' button on the Startup page. Fixed some ...
8. Too many files are open - 打开的文件太多 9. Receive and send data error - 接收和发送数据错误 10. online processing - 在线处理 这些短语涵盖了常见的计算机错误提示、系统组件和网络通信问题,有助于提高...
This was due to a problem where it would be freed automatically if there was a problem with the ArchiveStream when trying to open it as a zip file (possibly corrupt). Best practice is that ...
minihtml: Fixed a stack overflow on Windows with too many unclosed tags API: Added Phantom and PhantomSet API: Added ViewEventListener API: Added View.is_primary() API: Added EventListener.on_hover...
'Too many open files' Some platforms don't provide enough file handles to run CLucene properly. To solve this, increase the open file limit: On Solaris: ulimit -n 1024 set rlim_fd_cur=1024 ...
* Multi-select files in project-view (when "double-click to open" is configured in Environment Settings) * Resource files are treated as ordinary files now * Updates in "Project Options/Files" code * ...
This project aims to create a fully open-source Brushless Drive Controller. Where is the hardware --------------------- The hardware design files got split into a separate repository on github called...
reading system was implemented to read files with any type of (unspecified) delimiter between the data columns + if a data file was not read correctly, the filename in the status bar showed the ...
+ Property AcceptFiles was added to TsFilenameEdit and TsDirectoryEdit controls (dragging files to controls) + OnDrawDay event added to the TsDateEdit component * Improved PngHints editor * Solved...
Disassembler: Several disassembler instructions had a comma too many or too few ,fixed those Disassembler: Fixed the description for ret # Disassembler/Debug: Fixed the address that is being edited ...
* use new pkcs11.h from scute with an open source license * add support for sha2 to pkcs15-crypt * add piv-tool for managing piv cards * add muscle driver (still work in progress) * improved oberthur ...
how many files have changed and allow you to quickly open eg. file or project history, or the commit dialog. The dynamic toolbar is very developer friendly, so you can easily create your own ...
o Added 'Recent Config Files' menu, which allows you to easily open the last 10 configuration files that you used. * Version 2.61 o Added GB and Automatic to the 'File Size Unit' option. * ...
.\Source\Include (was Delphi\Vc32) .inc files (including OverbyteIcsDefs.inc) .\Source\Extras (was Delphi\Vc32) Extra source code not built into packages .\Source\zobj125 (was Delphi\Vc32) ZLIB C OBJ ...
C++ is the main development language used by many of Google's open-source projects. As every C++ programmer knows, the language has many powerful features, but this power brings with it complexity, ...
With sample files and help, as well as ample remarks.<END><br>9 , pb_test.zip Test project illustrating high performance Data Access for SQL Server using ADO command objects and Stored Procedures ...