LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 02-16-2009, 03:53 AM   #1
LinuxLover
Member
 
Registered: Feb 2004
Distribution: Centos 7 x86_64 , Rocky Linux 8 (aarch64)
Posts: 196

Rep: Reputation: 32
how to determinine the appropriate value for fs.file-max


On our astersik server (on Centos 5.0) in pear hours we find message

"Too many open files" frequently



To avoid this we have increase the maximum open file limt in /etc/sysct.conf and current is


[root@vicidialnow ~]# sysctl -p
net.ipv4.ip_forward = 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
kernel.sysrq = 0
kernel.core_uses_pid = 1
net.ipv4.tcp_syncookies = 1
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.shmmax = 4294967295
kernel.shmall = 268435456
fs.file-max = 555910











I want to ask how can I determine maximum apropriate value of fs.file-max for my system.

On what factor this value depend upon.

Is there any other parameter to tune for avoiding the 'Too many open files" message
 
Old 02-17-2009, 03:49 AM   #2
robertjinx
Member
 
Registered: Oct 2007
Location: Prague, CZ
Distribution: RedHat / CentOS / Ubuntu / SUSE / Debian
Posts: 749

Rep: Reputation: 73
I think you should use ulimit and /etc/security/limits.conf and set the values there...

in /etc/security/limits.conf set this:

* soft nofile 4096
* hard nofile 4096

or

ulimit -n 4096 (example)
 
Old 02-17-2009, 07:45 AM   #3
LinuxLover
Member
 
Registered: Feb 2004
Distribution: Centos 7 x86_64 , Rocky Linux 8 (aarch64)
Posts: 196

Original Poster
Rep: Reputation: 32
We can set the limit system wide in sysct.conf

and user wide in limits.conf.


My question is that what maximum value can be use??

what system parameters etc determine this value?
 
Old 02-18-2009, 01:01 AM   #4
LinuxLover
Member
 
Registered: Feb 2004
Distribution: Centos 7 x86_64 , Rocky Linux 8 (aarch64)
Posts: 196

Original Poster
Rep: Reputation: 32
One thing I want to add more in this question when I exceute the command

[root@vicidialnow ~]# lsof |wc -l
5264

It shows 5264 openfiles.

I have set the maximum limit to fs.file-max = 555910

But I still getting the "Too many open files" error int asterisk log files. ????


What reason can be?
 
Old 02-18-2009, 05:31 AM   #5
robertjinx
Member
 
Registered: Oct 2007
Location: Prague, CZ
Distribution: RedHat / CentOS / Ubuntu / SUSE / Debian
Posts: 749

Rep: Reputation: 73
Listen are u sure that is not the user issue with limits. I had the same regarding some application and the problems was that the user was limited to for example 1024 and that users need it more, due to sockets and so on.

For example java applications like tomcat or jboss sometimes needs more open files, by default every user is limited to 1024, so modifying this to lets say 4096 would actually do the trick.

In rest the fs-max I dont think has anything to do with your application asterix, i think the user with which you run this application need to have bigger limits.

Good luck!
 
Old 02-19-2009, 01:50 AM   #6
LinuxLover
Member
 
Registered: Feb 2004
Distribution: Centos 7 x86_64 , Rocky Linux 8 (aarch64)
Posts: 196

Original Poster
Rep: Reputation: 32
dear robertjinx

Your answer is looking more accurate, I try it. and will reply soon.
 
Old 02-19-2009, 04:42 AM   #7
LinuxLover
Member
 
Registered: Feb 2004
Distribution: Centos 7 x86_64 , Rocky Linux 8 (aarch64)
Posts: 196

Original Poster
Rep: Reputation: 32
aoa,

Problem still persist.

I have increased the limit and even rebooted the machine.

# ulimit -a
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
max nice (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 32758
max locked memory (kbytes, -l) 32
max memory size (kbytes, -m) unlimited
open files (-n) 4096
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
max rt priority (-r) 0
stack size (kbytes, -s) 10240
cpu time (seconds, -t) unlimited
max user processes (-u) 32758
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited




Entered the following enty
* soft nofile 4096
* hard nofile 4096

in

/etc/security/limits.conf


Now pictures is as below

Aserisk is running by root user


PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COM
2620 root 15 0 106m 37m 4564 S 32 1.9 12:53.70 asterisk


#ls -l /proc/2620/fd/ |wc -l
1023


#lsof -u root |wc -l
4001



Still facing error

Feb 19 15:16:46 NOTICE[2624] manager.c: Accept returned -1: Too many open files
Feb 19 15:16:46 NOTICE[2624] manager.c: Accept returned -1: Too many open files
Feb 19 15:16:46 NOTICE[2624] manager.c: Accept returned -1: Too many open files



One thing which I am suspecting is that I have set the file open limit size to 4096.

and previous command #lsof -u root |wc -l
4000


indicating that 4000 files are opened by root user.



What maximum limit can I set for ulimit -n ?, mean what parameter memory , files system inodes etc need to be consider before setting its value too HIGH.
 
Old 02-19-2009, 05:55 AM   #8
robertjinx
Member
 
Registered: Oct 2007
Location: Prague, CZ
Distribution: RedHat / CentOS / Ubuntu / SUSE / Debian
Posts: 749

Rep: Reputation: 73
You could try to go to some asterix forum or something. I don't have any experience with this application.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Max file size Felicia23 Linux - Kernel 2 01-28-2009 03:57 AM
mysqldump : Can I split the file up to 2GB max per file? Swakoo Linux - General 10 10-17-2005 04:13 AM
file-max problem I think robinhood1995 Linux - Networking 0 08-02-2002 10:43 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 07:49 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration