Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More suitable max open file descriptor limits by default ? #49

Open
centminmod opened this issue Sep 25, 2017 · 2 comments
Open

More suitable max open file descriptor limits by default ? #49

centminmod opened this issue Sep 25, 2017 · 2 comments
Labels
z-enhancement ⬆️ Product Enhancement

Comments

@centminmod
Copy link

With benchmarking and general performance for Nginx Unit and it's processes, maybe a more suitable and higher default max open file descriptor limits is needed ?

On CentOS 7.4 64bit using systemd unitd.service file, the default limits are fairly low with soft/hard limits at 1024/4096.

root      4018  0.0  0.0  16428   516 ?        Ss   00:35   0:00 unit: main [/opt/unit/sbin/unitd]
nginx     4039  0.0  0.0  26672   264 ?        S    00:35   0:00  \_ unit: controller
nginx     4241  0.0  0.0 1165196   40 ?        S    00:36   0:00  \_ unit: "php71domaincom" application
cat /proc/4039/limits
Limit                     Soft Limit           Hard Limit           Units
Max cpu time              unlimited            unlimited            seconds
Max file size             unlimited            unlimited            bytes
Max data size             unlimited            unlimited            bytes
Max stack size            8388608              unlimited            bytes
Max core file size        0                    unlimited            bytes
Max resident set          unlimited            unlimited            bytes
Max processes             7272                 7272                 processes
Max open files            1024                 4096                 files
Max locked memory         65536                65536                bytes
Max address space         unlimited            unlimited            bytes
Max file locks            unlimited            unlimited            locks
Max pending signals       7272                 7272                 signals
Max msgqueue size         819200               819200               bytes
Max nice priority         0                    0              
Max realtime priority     0                    0              
Max realtime timeout      unlimited            unlimited            us
cat /proc/4241/limits
Limit                     Soft Limit           Hard Limit           Units
Max cpu time              unlimited            unlimited            seconds
Max file size             unlimited            unlimited            bytes
Max data size             unlimited            unlimited            bytes
Max stack size            8388608              unlimited            bytes
Max core file size        0                    unlimited            bytes
Max resident set          unlimited            unlimited            bytes
Max processes             7272                 7272                 processes
Max open files            1024                 4096                 files
Max locked memory         65536                65536                bytes
Max address space         unlimited            unlimited            bytes
Max file locks            unlimited            unlimited            locks
Max pending signals       7272                 7272                 signals
Max msgqueue size         819200               819200               bytes
Max nice priority         0                    0              
Max realtime priority     0                    0              
Max realtime timeout      unlimited            unlimited            us

Setting higher defaults

mkdir -p /etc/systemd/system/unitd.service.d
echo -en "[Service]\nLimitNOFILE=262144\nLimitNPROC=16384\n" > /etc/systemd/system/unitd.service.d/limit.conf
systemctl daemon-reload
systemctl restart unitd
root      4559  0.0  0.0  16032   800 ?        Ss   00:54   0:00 unit: main [/opt/unit/sbin/unitd]
nginx     4578  0.0  0.0  26276   720 ?        S    00:54   0:00  \_ unit: controller
nginx     4579  0.0  0.0 341832   912 ?        Sl   00:54   0:00  \_ unit: router
nginx     4642  5.2  2.7 1175440 52152 ?       S    00:57   0:00  \_ unit: "php71domaincom" application
cat /proc/4578/limits
Limit                     Soft Limit           Hard Limit           Units
Max cpu time              unlimited            unlimited            seconds
Max file size             unlimited            unlimited            bytes
Max data size             unlimited            unlimited            bytes
Max stack size            8388608              unlimited            bytes
Max core file size        0                    unlimited            bytes
Max resident set          unlimited            unlimited            bytes
Max processes             16384                16384                processes
Max open files            262144               262144               files
Max locked memory         65536                65536                bytes
Max address space         unlimited            unlimited            bytes
Max file locks            unlimited            unlimited            locks
Max pending signals       7272                 7272                 signals
Max msgqueue size         819200               819200               bytes
Max nice priority         0                    0                
Max realtime priority     0                    0                
Max realtime timeout      unlimited            unlimited            us  
cat /proc/4642/limits
Limit                     Soft Limit           Hard Limit           Units
Max cpu time              unlimited            unlimited            seconds
Max file size             unlimited            unlimited            bytes
Max data size             unlimited            unlimited            bytes
Max stack size            8388608              unlimited            bytes
Max core file size        0                    unlimited            bytes
Max resident set          unlimited            unlimited            bytes
Max processes             16384                16384                processes
Max open files            262144               262144               files
Max locked memory         65536                65536                bytes
Max address space         unlimited            unlimited            bytes
Max file locks            unlimited            unlimited            locks
Max pending signals       7272                 7272                 signals
Max msgqueue size         819200               819200               bytes
Max nice priority         0                    0                
Max realtime priority     0                    0                
Max realtime timeout      unlimited            unlimited            us
@VBart
Copy link
Contributor

VBart commented Sep 25, 2017

It's not expected to show good performance at the current stage of early beta, as the code contains some quirks. So, there's not much sense to benchmark and tune limits for that.

But you're right, for production use and performance testing the limits should be raised.

@VBart VBart added the z-enhancement ⬆️ Product Enhancement label Sep 25, 2017
@centminmod
Copy link
Author

True, though folks will still attempt to benchmark and compare Nginx Unit in early beta to their existing solutions and make early conclusions. And you wouldn't want those conclusions to be limited by something like max open file limits. Though some system admins would easily pinpoint the limitation and make adjustments themselves.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
z-enhancement ⬆️ Product Enhancement
Projects
Status: 📖 Backlog
Development

No branches or pull requests

2 participants