When I download file from my Apache server with download applications like idm , wget or aria2c server only allow 8 connection to file to download now I need 32 connection to use maximum download speed.
How to config Apache server to serve 32 connection per client ?
My OS is Ubuntu 14.04.
Thanks
As far i know its clearly mentioned in the related question here,Do you need anything in addition like ipTable
ServerLimit 16
StartServers 2
MaxClients 200
MinSpareThreads 25
MaxSpareThreads 75
ThreadsPerChild 25
Related
I have a webserver that should handle about 800 simultaneous connections.
For this I have configured Apache 2.4 in worker mode (on Centos 6) with this values:
ServerLimit 40
StartServers 25
MaxClients 1000
MinSpareThreads 25
MaxSpareThreads 75
MaxRequestWorkers 1000
ThreadsPerChild 25
MaxConnectionsPerChild 0
However, when I check the server-status I can not see more than 400 workers simultaneously.
In error_log file I can see this: "[mpm_worker:error] [pid 2559:tid 140190319810368] AH00286: server reached MaxRequestWorkers setting, consider raising the MaxRequestWorkers setting", but increasing this value has no effect. (with stop/start apache after each change in configuration file).
I checked the ulimits and for apache user the value of nproc is 2048.
I mention that Apache was compiled by me and I didn't set explicitly any limit at compilation time.
What could be the cause of this limitation?
So I figured out what was causing the issue. In httpd.conf the settings for worker module were declared before loading the module, so they were ignored by apache. Moving them after "LoadModule" section fixed the problem.
I've been testing an Ubuntu server A running Apache/PHP using Tsung from a server B and I reached something that looks like a limit, but I can't find any idea on what it might be : here is a graph showing the behavior => http://i.stack.imgur.com/Mspqp.png The value given as max by Tsung is 1010 which doesn't look like anything I know from Apache/PHP/MySQL/Ubuntu configuration.
Server A was a virtual machine at DigitalOcean, running a simple installation of Ubuntu 12.04 and Apache2/PHP5/APC (Perfork MaxClients 384, ServerLimit 500) : usage of CPU or RAM was OK, not full. Apache's server-status page also showed open slots so the limit doesn't seem to come from there.
Server B was another virtual machine at DigitalOcean running a simple installationg of Ubuntu 12.04 and Tsung.
Webapp code included some PHP and some MySQL requests (500 max connections).
I can't find any configuration value in Apache/PHP/Ubuntu that would explain a 1000 or 1010 limit, any ideas on where to look ?
Please update below parameters which would support up to 8000 simultaneous connections.
<IfModule mpm_worker_module>
ServerLimit 250
StartServers 10
MinSpareThreads 75
MaxSpareThreads 250
ThreadLimit 64
ThreadsPerChild 32
MaxClients 8000
MaxRequestsPerChild 10000
</IfModule>
Edit
Running my OS on the VirtualBox was the issue. As soon as I made my OS the native on the disk, I was able to see the performance boost.
Original
I've read a lot of people recommend ditching Apache+mod_php for HAProxy+nginx+PHP-FPM. I'm trying to verify that it's a more efficient setup, but am not seeing the results people describe. Both siege and ab (Apache Benchmark) are showing that Apache at any number of concurrent connections is giving better responses per second, and can support more connections .
I'm running Ubuntu 11.04 server on VirtualBox. It has 10 gigs of space, and 1,344 megs of memory. I used apt-get for installing the programs mentioned above. Here are the related config files with just the important parts included.
haproxy.cfg
global
maxconn 4096
user haproxy
group haproxy
daemon
stats socket /var/run/haproxy.sock mode 0600 level admin
defaults
log global
mode http
option httplog
option dontlognull
retries 3
option redispatch
maxconn 2000
contimeout 5000
clitimeout 50000
srvtimeout 50000
listen tcpcluster *:80
mode tcp
option tcplog
balance roundrobin
server tcp01 192.168.1.199:8080 check
nginx.conf
worker_processes 2;
events {
worker_connections 768;
}
www.conf
pm = dynamic
pm.max_children = 10
pm.min_spare_servers = 2
pm.max_spare_servers = 4
pm.max_requests = 500
apache.conf
<IfModule mpm_prefork_module>
StartServers 5
MinSpareServers 5
MaxSpareServers 10
MaxClients 10
MaxRequestsPerChild 0
</IfModule>
<IfModule mpm_worker_module>
StartServers 2
MinSpareThreads 25
MaxSpareThreads 75
ThreadLimit 64
ThreadsPerChild 25
MaxClients 10
MaxRequestsPerChild 0
</IfModule>
<IfModule mpm_event_module>
StartServers 2
MinSpareThreads 25
MaxSpareThreads 75
ThreadLimit 64
ThreadsPerChild 25
MaxClients 10
MaxRequestsPerChild 0
</IfModule>
Given that PHP-FPM and Apache both have a maximum of 10 children, I would expect that any speed advantage would be visible. In every test I've run (always waiting until load is 0.01 before I run the test), Apache is always able to handle more request more efficiently.
Is there some other optimization that can be made so that the setup best suited to scale will outperform the setup that should not be more efficient?
Use haproxy as a connection concentrator : use "mode http" instead of "mode tcp", use "option http-server-close" and set a server maxconn value well below the worker connections value. You should cross a point where the lower concurrency brings much more performance with much lower RAM usage and better cache efficiency along the whole chain.
BTW, what are the numbers we're talking about ? Do they measure in hundreds or in thousands of requests per second ? Because clearly, the application server will make a real difference only in the higher loads. Obviously if the application runs very slowly, there is no reason to see a difference when replacing the server.
we have a very strong server (32-cores cpu, 96GB ram) and have apache running in prefork mode. our apache2.conf file includes such settings :
<IfModule mpm_prefork_module>
StartServers 2
MinSpareServers 5
MaxSpareServers 20
ServerLimit 3000
MaxClients 3000
MaxRequestsPerChild 1000
</IfModule>
the problem is, when our website is under heavy load (when apache process count reaches 1000 to be precise) (or when setting StartServers beyond 1000), apache2 freezes and needs to be restarted. Yet there is still plenty of ram, cpu is underused and apache process count is far beyond maxclients.
My question is, what should i do to allow apache to reach the maxclients configured in the conf file ?
please consider we have already played with /etc/security/limits.conf to set max opened files and nprocs to 5000 (ulimit -a showed these values were well taken into account).
No errors are shown in /var/log/apache2/error.log
Your Apache server may have a compiled in hard limit. To change it you need to recompile your webserver. The default is 200000 which should be high enough - but packages from your linux distribution may differ.
I would rather recommend to get of static file serving from your webserver. Put an nginx or lighttp server in front of your apache. Let it serve static content (images, css, javascript, etc.) and forward dynamic request to your apache.
I have an OSQA (python / django q&a application) installation serving 8 different sites. The sites are all in development, receiving minimal traffic. The server is a virtual private server with 512 mb of ram.
Apache is only serving dynamic pages with mod_wsgi behind Nginx. I can't stop Apache consuming more and more memory with each request until the server chokes.
I experimented with the configuration parameters without much luck to minimize the memory footprint. With the following mpm_prefork parameters in apache2.conf:
StartServers 2
MinSpareServers 1
MaxSpareServers 4
MaxClients 4
MaxRequestsPerChild 100
2 apache processes start using 4 mb and after the first request there are 4 processes with each nearly 50 mb and with each new request those 4 processes climb steadily up to nearly 200 mb each.
I feel like there is something wrong going on. Any suggestions are greatly appreciated.
KeepAlive Off
MaxSpareThreads 3
MinSpareThreads 1
ServerLimit 3
SetEnvIf X-Forwarded-SSL on HTTPS=1
ThreadsPerChild 2
WSGIDaemonProcess osqaWSGI processes=2 python-path=/web/osqa_server:/web/osqa_server/lib/python2.6 threads=1 maximum-requests=550
WSGIProcessGroup osqaWSGI
Ran httperf against this with 10,000 concurrent hits and it was still standing.