What is the "open file rlimit" and what value should it have

WolverinDEV

TeaSpeak Team
Staff member
Administrator
Hey,
in this thread well go thru the topic of rlimints and more specific the rlimit for concurrent open files.
if you're lazy to read, just directly skip ahead to point 5.

1. Is a "rlimit"?
"rlimit" just stands for resource limit.
As the longer name already explains, these limits regulate the systems resources a process can use.
In general, each rlimit has a "soft" and a "hard" limit. Soft limits are changeable values by the process itself.
Hard limits, on the other hand, could only be changed by a system administrator or by editing the /etc/security/limits.conf config file.


2. How to change rlimits?
To change rlimits on all Unix based system, you just simply have to use the command "ulimit" or edit the /etc/security/limits.conf config file.
Even thou it's confusing, "ulimit" will change the so-called "rlimits".
A good explanation, how to use the command, could be found here: https://linuxhint.com/linux_ulimit_command/


3. Why does TeaSpeak shows this warning: "Open file rlimit is bellow 16384 [...]"
To understand this error we've to split it up into two parts.
Firstly we've to inspect what the "open file rlimit means" and secondly well gather which value it should have.

3.1 Whats is the "Open file rlimit"?
As you may know, Unix based architectures have this wonderful philosophy: "Everything is a file.".
But as a regulation, so that no process fillups the system with unnecessary stuff like file handles, Linux has a resource limit. In terms of open files its the "open file descriptor limit" or " nofiles".
It's a limit of concurrently open files by one process.

3.2 What should be a good value?
Now the Unix philosophy comes in play. So this also includes every server socket. So for one for every address & port you bind to, you'll have to open a file.
So for every virtual server, you start you need at least one file handle. But because each virtual server could be bound
to multiple addresses, the server mostly requires more file handles. To calculate that, just simply count the addresses each virtual server binds to.
By default, this value should be 2 (Each VS binds to IPv4 & IPv6).

But the webserver, for the web client, will also bind to the given addresses on TCP. This means that the previous value multiplies by 2.
This means with the default configuration each virtual server requires at least 4 file handles.

A more precise calculation of allocated open file handles is listed within this table:
Component namePotential open files
Virtual ServerAs explained above, the formula is like this:
n = <number of binding addresses> * 2
File ServerThe file server could take up to "serverinstance_filetransfer_max_connections" concurrent connections.
This means the same amount of file descriptors. We need to add one as a space descriptor opened for error handling.
This means:
n = <serverinstance_filetransfer_max_connections> + <number of binding addresses> + 1
Query ServerThe query server behaves like the file server.
n = <serverinstance_query_max_connections> + <number of binding addresses> + 1
Conversation SystemThis is highly dependable on your users activity.
All open files will be closed every 5 minutes. One file per conversation will be opened as soon the conversion gets loaded.
So a ruff guess would be for an average server with (10 VS and total 1000 Users):
n = 120
Web Client +
Web voice bridge
This highly depends on the underlying implementation of libnice.
But it should be approximately 3 file handles per clients.
n = 3 * <number of online web clients>
Core SystemThe core system includes the terminal, logging system, etc.
A ruff approximation would be (it also depend on your log settings!):
n = 5
So in total, you see, that by default, without any virtual server the server, TeaSpeak could require up to ~300 open file handles.



That's not really that much and should fit even under the default limit of 1024, but as soon you create more virtual servers, this will problematic.

For exampel an instance with 200 virtual servers could have up to 200 * 4 + 300 = 1200 concurrent open files.
If the rlimit is bellow that, the server will start to disfunction and may crash or hangup.

4. Sum up
I hope this tutorial helps you understand the meaning behind rlimits, especially the Waring TeaSpeak gives at the start of the server if its to low.
But for everybody who is just lazy reading, which you're probably not, else you wouldn't get this far, here is a "quick" fix:

5. Quick fix, for everybody who just wants to get rid of that error.
Just execute this command as the user you're starting TeaSpeak with:
Code:
echo "$USER hard nofile 16384" | sudo tee -a /etc/security/limits.conf
 
Last edited:

REDOSS

TeaSpeak Team
Staff member
TeaTeam
After executing the command the warning message also remains is this normal?
 

REDOSS

TeaSpeak Team
Staff member
TeaTeam
No, it shouldn't what exactly is the message? The values are from interest :)
[2020-03-27 04:14:08] [WARNING ] GLOBL | Open file rlimit is bellow 16384 (4096). Please increase the system file descriptor limits.
[2020-03-27 04:14:08] [WARNING ] GLOBL | Fore more help visit the forum and read this thread (https://forum.teaspeak.de/index.php?threads/2570/).
This warning message appears even after executing the command and restarting the server. :)
 

WolverinDEV

TeaSpeak Team
Staff member
Administrator
Hmm well.... Thats nasty.
Could you may google and if you find the solution inform me ? :D
 

otalportista

Fanatic member
Just:
Code:
echo "* hard nofile 16384" | sudo tee -a /etc/security/limits.conf
Reboot vps and solved :)
its normal
I wrote above that a warning message also remains after executing this command.
Its normal you need reboot for it apply settings.
You can use this command ulimit -Hn for check limit, If you do the command after changing the limit and execute the command afterwards you will see that it will not appear because it needs you to restart the server.

PS: And yes I know but other people may not know
 

REDOSS

TeaSpeak Team
Staff member
TeaTeam
its normal

Its normal you need reboot for it apply settings.
You can use this command ulimit -Hn for check limit, If you do the command after changing the limit and execute the command afterwards you will see that it will not appear because it needs you to restart the server.

PS: And yes I know but other people may not know
Yes, I rebooted when I executed this command, but the warning message did not disappear... I will try to repeat this later, but to be honest, the possible problems with this will not affect me for sure :cool:
 

otalportista

Fanatic member
Yes, I rebooted when I executed this command, but the warning message did not disappear... I will try to repeat this later, but to be honest, the possible problems with this will not affect me for sure :cool:
Yes, and I'm glad that happens, but the answer I gave will certainly help new users!