• Please be aware: Kaspersky Anti-Virus has been deprecated
    With the upgrade to Plesk Obsidian 18.0.64, "Kaspersky Anti-Virus for Servers" will be automatically removed from the servers it is installed on. We recommend that you migrate to Sophos Anti-Virus for Servers.
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

Question Load testing Apache limited to 250 concurrent users

akira9000

Basic Pleskian
Hi,

Using Plesk Onyx 17.8.11 CentOS 17.5.1804
Quad core 6GB Ram, lots of disk space free

I need to get a machine ready for higher than normal traffic so started testing with Apache Benchmark from my workstation to the VPS with:

ab -n 1000 -c 300 Example Domain

I can only get up to 250 concurrent users before I get the "socket: Too many open files (24)" response.

I have SSH'd and added:

Code:
<IfModule prefork.c>
StartServers 5
MinSpareServers 10
MaxSpareServers 25
MaxClients 500
MaxRequestsPerChild 10000
</IfModule>

<IfModule worker.c>
StartServers 5
MinSpareThreads 10
MaxSpareThreads 25
ThreadsPerChild 50
MaxClients 500
MaxRequestsPerChild 10000
</IfModule>

to the /etc/httpd/conf.d/mpm_prefork.conf

Then rebooted.

I was expecting a concurrent limit of "500". Still the same thing so changed to "MaxClients1000". Still limited to 250 concurrent users on the test. What am I missing?

Thanks.
 
"Too many open files" refers to system limits, not to Apache limits. 250 Apache processes create at least 750 open files, probably more. You need to increase
a) the overall number of max open files in the system
b) the specific number of max open files for the relevant user httpd

Increase the general maximum file descriptor value:
vi /etc/sysctl.conf
Add/modify:
fs.file-max = <high number, e.g. 100000>

Edit /etc/security/limits.conf and add:
nginx soft nofile <high number, e.g. 100000>
nginx hard nofile <high number, e.g. 100000>
root soft nofile <high number, e.g. 100000>
root hard nofile <high number, e.g. 100000>
psaadm soft nofile <high number, e.g. 100000>
psaadm hard nofile <high number, e.g. 100000>
mysql soft nofile <high number, e.g. 100000>
mysql hard nofile <high number, e.g. 100000>
httpd soft nofile <high number, e.g. 100000>
httpd hard nofile <high number, e.g. 100000>

Specifically for Apache also add needed ULIMIT value in /etc/sysconfig/httpd configuration:
Comment out the following section in the /usr/sbin/apachectl

#ULIMIT_MAX_FILES="ulimit -S -n `ulimit -H -n`"
# -------------------- --------------------
# |||||||||||||||||||| END CONFIGURATION SECTION ||||||||||||||||||||
# Set the maximum number of file descriptors allowed per child process.
#if [ "x$ULIMIT_MAX_FILES" != "x" ] ; then
# $ULIMIT_MAX_FILES
#fi

Set needed ULIMIT value in httpd configuration after commented section, add ulimit -n 500000 to the /usr/sbin/apachectl file:

# $ULIMIT_MAX_FILES
#fi
ulimit -n <high number, e.g. 100000>

Then
# service httpd restart

Also pay attention that Nginx needs similar modifications, e.g.
echo 'NGINX_ULIMIT="-n <high number, e.g. 100000>"' >> /etc/sysconfig/nginx

Edit /usr/lib/systemd/system/nginx.service and add a line in the [Service] section:
LimitNOFILE=<high number, e.g. 100000>

In /etc/sysconfig/nginx.systemd add:
LimitNOFILE=<high number, e.g. 100000>

Add the line ulimit -n <high number, e.g. 100000> at the beginning of the /usr/local/psa/admin/sbin/nginx-config script:
#!/usr/bin/env bash
ulimit -n <high number, e.g. 100000>

Reload system daemon:
# systemctl --system daemon-reload
# sysctl -p
 
Back
Top