- 浏览: 159312 次
- 性别:
- 来自: 北京
文章分类
最新评论
-
追求幸福:
每增加一个新的activity, 都要为这个activity指 ...
关于setContentView -
雨过天晴0521:
感谢第一位留言的网友, 我会坚持下去
ADB push的用法 -
小光棍:
謝謝。整理出來的東西真有用!!
ADB push的用法
Issue:
How do I set the maximum number of files allowed to be open on a system
Resolution:
The current setting for maximum number of open files can be viewed with the command:
ulimit -n
This number indicates the maximum number of files normal users (i.e. non-root) can have open in a single session. Note that for the root user, ulimit -n will sometimes output 1024 even after following the procedure to increase the maximum number of open files. This won't effect root's ability to open large numbers of files, as only normal users are bound by this value.
To increase the maximum number of open files beyond the default of 1024, two changes to the system may be necessary. In these examples, we will increase the maximum number of open files to the arbitrary value of 2048. All changes need to be made by the root user and users will need to log out and log back in before the changes will take effect.
1. Configure the system to accept the desired value for maximum number of open files Check the value in /proc/sys/fs/file-max to see if it is larger than the value needed for the maximum number of open files:
# cat /proc/sys/fs/file-max
If the value isn't large enough, echo an appropriate number into the variable and add the change to /etc/sysctl.conf to make it persistent across reboots. If the number is already larger than the value you wish to use, skip to step 2.
# echo 2048 > /proc/sys/fs/file-max
and edit /etc/sysctl.conf to include the line:
fs.file-max = 2048
2. Set the value for maximum number of open files In the file /etc/security/limits.conf, below the commented line that reads
#<domain> <type> <item> <value>
add this line:
* - nofile 2048
This line sets the default number of open file descriptors for every user on the system to 2048. Note that the "nofile" item has two possible limit values under the <type> header: hard and soft. Both types of limits must be set before the change in the maximum number of open files will take effect. By using the "-" character, both hard and soft limits are set simultaneously.
The hard limit represents the maximum value a soft limit may have and the soft limit represents the limit being actively enforced on the system at that time. Hard limits can be lowered by normal users, but not raised and soft limits cannot be set higher than hard limits. Only root may raise hard limits.
When increasing file limit descriptors, you may want to simply double the value. For example, if you need to increase the default value of 1024, increase the value to 2048 first. If you need to increase it again, try 4096, etc.
==================================================================
1。ulimit -a 查看系统目前资源限制的设定。
[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) 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
[root@test security]#
通过以上命令,我们可以看到open files 的最大数为1024
那么我们可以通过一下命令修改该参数的最大值
2. ulimit -n 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 -p [进程的 pid]来查看系统当前打开的文件资源,可以了解不同时期系统的文件资源的使用情况,可根据情况进行系统资源的配置。
===================================================================
从这里学到的linux的命令
查看进程所占的文件描述符 lsof -p 390 | wc -l
查看系统的各种资源限制或者更改这个限制 ulimit -a
How do I set the maximum number of files allowed to be open on a system
Resolution:
The current setting for maximum number of open files can be viewed with the command:
ulimit -n
This number indicates the maximum number of files normal users (i.e. non-root) can have open in a single session. Note that for the root user, ulimit -n will sometimes output 1024 even after following the procedure to increase the maximum number of open files. This won't effect root's ability to open large numbers of files, as only normal users are bound by this value.
To increase the maximum number of open files beyond the default of 1024, two changes to the system may be necessary. In these examples, we will increase the maximum number of open files to the arbitrary value of 2048. All changes need to be made by the root user and users will need to log out and log back in before the changes will take effect.
1. Configure the system to accept the desired value for maximum number of open files Check the value in /proc/sys/fs/file-max to see if it is larger than the value needed for the maximum number of open files:
# cat /proc/sys/fs/file-max
If the value isn't large enough, echo an appropriate number into the variable and add the change to /etc/sysctl.conf to make it persistent across reboots. If the number is already larger than the value you wish to use, skip to step 2.
# echo 2048 > /proc/sys/fs/file-max
and edit /etc/sysctl.conf to include the line:
fs.file-max = 2048
2. Set the value for maximum number of open files In the file /etc/security/limits.conf, below the commented line that reads
#<domain> <type> <item> <value>
add this line:
* - nofile 2048
This line sets the default number of open file descriptors for every user on the system to 2048. Note that the "nofile" item has two possible limit values under the <type> header: hard and soft. Both types of limits must be set before the change in the maximum number of open files will take effect. By using the "-" character, both hard and soft limits are set simultaneously.
The hard limit represents the maximum value a soft limit may have and the soft limit represents the limit being actively enforced on the system at that time. Hard limits can be lowered by normal users, but not raised and soft limits cannot be set higher than hard limits. Only root may raise hard limits.
When increasing file limit descriptors, you may want to simply double the value. For example, if you need to increase the default value of 1024, increase the value to 2048 first. If you need to increase it again, try 4096, etc.
==================================================================
1。ulimit -a 查看系统目前资源限制的设定。
[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) 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
[root@test security]#
通过以上命令,我们可以看到open files 的最大数为1024
那么我们可以通过一下命令修改该参数的最大值
2. ulimit -n 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 -p [进程的 pid]来查看系统当前打开的文件资源,可以了解不同时期系统的文件资源的使用情况,可根据情况进行系统资源的配置。
===================================================================
从这里学到的linux的命令
查看进程所占的文件描述符 lsof -p 390 | wc -l
查看系统的各种资源限制或者更改这个限制 ulimit -a
发表评论
-
(转)linux防火墙的启动和关闭
2013-08-29 14:14 641昨天在linux服务器上装了一个tomcat,整个过程很顺利, ... -
(转)linux下如何更改主机名
2013-08-16 18:50 984如何修改linux主机名才能生效? 很多人使用hostnam ... -
(转)如何查看linux闲置和占用的内存
2013-08-07 16:33 741在Linux下查看内存我们一般用free命令, 也可以加-m参 ... -
win7下安装cygwin
2013-08-06 15:56 17421.win7 64bit也要下载32bit的setup-x86 ... -
yum install 安装失败
2013-08-06 12:44 1834问题1:今天运行oracle11g ... -
(转) 深入了解JVM
2013-06-14 15:31 819在社会化分工、软件行 ... -
(转)如何让让Linux下程序永远在后台执行
2013-02-28 11:29 916Unix/Linux下一般想让某个程序在后台运行,很多都是使用 ... -
常用linux命令收集
2013-02-18 14:35 6961.(转)如何修改linux主机名? 用hostname命令 ... -
[转]How to determine the exit status of Linux and UNIX command
2012-12-01 21:36 799Shell: How to determine the exi ... -
如何查看父进程
2012-11-01 15:17 1707看父进程PPID和子进程PID [root@silver-i ... -
(转)Solaris 10 常用命令
2012-09-20 16:12 1346如何查看当前在线用户? 可以使用who和finger显示当前 ... -
Linux 常用网络命令介绍
2012-05-31 15:26 87今天在安装完vsphere后配置centOS虚拟机, 安装 ... -
如何查看Linux的版本位数
2012-03-06 11:35 1148方法1. getconf LONG_BIT and getco ... -
[转]CPU位数、操作系统位数和编译器位数关系
2011-09-22 09:58 1007随着近来AMD和Intel的64位CPU以及 Microsof ... -
如何判断Solaris和SolarisX86是运行在32位还是64位模式下
2011-09-21 17:53 1170-bash-3.00$ man isainfo Reforma ... -
sed替换properties文件的值
2011-09-01 20:16 2910oracle9.properties文件内容如下, 想要将us ... -
自动化安装和启动DS脚本
2011-08-10 18:31 1014#!/bin/sh #fabric broker pat ... -
执行*.sh时出现bad interpreter错误
2011-08-04 11:57 858出现bad interpreter:No such f ...
相关推荐
The construction of such systems involves many distributed design choices. The end products (e.g., recommendation systems, medical analysis tools, real-time game engines, speech recognizers) thus ...
<br/>If you use Linux professionally, this book can dramatically increase your efficiency, productivity, and marketability. If you're involved with deploying or managing Linux in the enterprise, ...
This paper proposes that how to increase the efficiency of a solar PV energy system by the advancement in conventional DC to DC Boost converter. This paper also proposes the study of open loop ...
An initiative of the Free Standards Group, the Linux Standard Base (LSB) is a set of standards designed to increase compatibility among Linux distributions and enable applications to run on any LSB-...
* significant / considerable / noticeable / substantial / dramatic:表示数量变化的显著性,例如:“There was a significant increase in the number of students.” * significantly / considerably / ...
Selecting a number of phases can increase component counts and costs, which begs the question, how many phases are needed? What benefit do a given number of phases for a certain power requirement ...
Use copied and selected text in macros to dramatically increase the power and flexibility of UltraEdit macros Run a macro or script from the command line We are often asked if it is possible to run an...
In response to the current problems of aging in China, unbalanced labor ...has a positive effect on China’s economic development, the alleviation of aging, and the increase in the number of laborers.
number of applications, and many revisions in the various sections of the book. I have been fortunate to have had outstanding reviewers and their suggestions have led to many important improvements in...
full laziness and SK combinators., Finally, the third part describes the G-machine, a sophisticated implementation of graph reduction, which provides a dramatic increase in performance over the ...
ResetPipeRequestRetryCount controls the maximum number of times that FTDIBUS tries to reset a pipe on which an error has occurred. ResetPipeRequestRetryCount defaults to 50. It may be necessary to ...
Q:Find the number of tuples in the customer relation. Q:Find the number of depositors in the bank. Q:Find the number of depositors for each branch. Q:Find all customers who have a loan at the bank but...
Paging is represented by a number of counters including page faults/sec, page input/sec and page output/sec. Page faults/sec include soft and hard page faults where as the page input/output counters ...
An ISP earns its money by charging each of the the ISPs that connect to the IXP a relatively small fee, which may depend on the amount of traffic sent to or received from the IXP. 15. Google's ...
And with the ongoing explosive growth of the cloud computing world – the vast majority of which is being built with Linux – the scope of the opportunities will only increase. Whether or not you end...
robot, and the bioinspired neural network neural activity value computational cost and time cost will increase sharply with the increase of the number of neurons. This paper explores an improved 3D ...
Chapter 3, “The Tools of the Trade,” presents the Linux open-source development tools that are used throughout the book. The GNU compiler, assembler, linker, and debugger are used in the book for ...