You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Eric LeBlanc <in...@igt.net> on 2005/02/06 17:03:09 UTC
[users@httpd] Understanding fd
Hello!
Since some time, we experienced some troubles with "Too many open files"
in log files.
So, to analyze this situation, we wanted to know many files that are
opened by Apache. We can't rely on "lsof", because this command show the
memory mapping too.
First solution: we was doing a "ls -l /proc/PID/fd". Surprise, Suprise...
Here the resultat (output truncated for better reading):
10:41 0 -> /dev/null
10:41 1 -> /dev/null
10:41 2 -> /var/log/error_log
10:41 5 -> /path/to/logs/mod_jserv.log
10:41 6 -> /path/to/logs/mod_jserv.log
10:41 7 -> /path/to/logs/mod_jserv.log
[...]
10:41 117 -> /path/to/logs/mod_jserv.log
10:41 118 -> /path/to/logs/rewrite_log
10:41 119 -> /path/to/logs/rewrite_log
10:41 120 -> /path/to/logs/rewrite_log
[...]
10:41 333 -> /path/to/logs/rewrite_log
10:41 334 -> /var/log/access_log
As we can see, we have ~334 fd for each process. We have between
300 to 1020 of httpd running process.
So, to have a better idea of how many this system have open files, with
these commands:
----------------------------------------------
NB=0
for i in `ls -d /proc/[0123456789]*`
do
let NB=$NB+$(ls -l /proc/$i/fd |wc -l)
done
echo $NB
125435
----------------------------------------------
Does this system __really_ opened 125 000 files (and the majority is the
SAME file, such as rewrite_log and mod_jserv.log) ? That make no
sense... To verify that, I do:
[root@ANONYMOUS proc]# cat /proc/sys/fs/file-nr
4466 3507 65535
4466-3507 = 959 fd actually used. This number is far from 125 000.... ;-)
Can anyone explain me in more details why I have ~350 fd in
/proc/PIDOFHTTPD/fd, and the value of the system is below 1000 fd ?
Btw, we removed the log section in each virtual host configuration. Only
the main log in httpd.conf will be used. Also, we increased the bash's
ulimit, from 1024 to 4096 open files.
I just want to understand the difference between the total of fd in
/proc/PID/fd and the /proc/sys/fs/file-nr.
Thanks.
E.
--
Eric LeBlanc
inouk@igt.net
--------------------------------------------------
UNIX is user friendly.
It's just selective about who its friends are.
==================================================
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org