Author |
|
Qmpeltaty
Joined: 06 Feb 2008 Posts: 182 Location: Poland
|
Posted: Mon 06 Jun '11 16:00 Post subject: Heavy load with mpm_winnt |
|
|
Hello
I need to tuning my apache config for site with heavy traffic - 1500-2000 request/second. Hardware is powerfull enough to handle so big load.
I've read mpm manual and i'm nothing more than confused. First i read "The default value for ThreadLimit is 1920 when used with mpm_winnt and 64 when used with the others." and then "There is a hard limit of ThreadLimit 20000 (or ThreadLimit 15000 with mpm_winnt) compiled into the server. This is intended to avoid nasty effects caused by typos" So what is the limit ?
Current config :
ThreadsPerChild 1900
MaxRequestsPerChild 0
How to set it up to be sure that incoming traffic will not be stopped by wrongly configured apache ?
Apache @ Win2k8 x64, 4x4core cpu, 64gb ram |
|
Back to top |
|
szczecin
Joined: 06 Jun 2011 Posts: 3
|
Posted: Mon 06 Jun '11 19:30 Post subject: |
|
|
I also tried to set ThreadLimit and ThreadsPerChild to above 1920 and syntaxt checking httpd.exe -t is saying that ThreadLimit is by default 1920 and I should increase it. When I try to start server, it is not starting at all :/ |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7371 Location: Germany, Next to Hamburg
|
Posted: Wed 08 Jun '11 11:04 Post subject: |
|
|
It that case I recommend to use a loadbalancer and also round robin.
Also my test (static page and localhost)
ThreadsPerChild 150 I got 1535 req/s
Modified mpm
ThreadsPerChild 1920
and added ThreadLimit 1920 I got 1411 req/s
More is not always better. |
|
Back to top |
|
Qmpeltaty
Joined: 06 Feb 2008 Posts: 182 Location: Poland
|
Posted: Wed 08 Jun '11 11:13 Post subject: |
|
|
James could you tell me what loadbalancer you thinking about ? Don't know any loadbalancer for httpd apache.
Quote: |
hreadsPerChild 150 I got 1535 req/s
ThreadsPerChild 1920
and added ThreadLimit 1920 I got 1411 req/s
|
What was your test-tool to get those results ? |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7371 Location: Germany, Next to Hamburg
|
Posted: Wed 08 Jun '11 12:32 Post subject: |
|
|
I apachenbenchmark
Code: |
ab -n 10000 -c 200 -k http://127.0.0.1/
|
means do 10k request, do 200 requests at the same time, k for use keep Alive |
|
Back to top |
|
Qmpeltaty
Joined: 06 Feb 2008 Posts: 182 Location: Poland
|
Posted: Wed 08 Jun '11 13:34 Post subject: |
|
|
Thank you James. What about loadbalancer you mention ? |
|
Back to top |
|
szczecin
Joined: 06 Jun 2011 Posts: 3
|
Posted: Wed 08 Jun '11 13:57 Post subject: |
|
|
Does it make any sense to setup loadbalance when it is single machine with apache and tomcat? |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7371 Location: Germany, Next to Hamburg
|
Posted: Wed 08 Jun '11 16:05 Post subject: |
|
|
szczecin wrote: | Does it make any sense to setup loadbalance when it is single machine with apache and tomcat? |
That computer above with 16 CPUs is makes sense if the internet connection is fast enough. In my experience the tomcat app servers were slower than apache. Running multiple instances of tomcat or multiple workers can speed up the application since less users are on a single process. I also recommend to serve the static content from apache and not tomcat. Apache is faster serving static content and also less requests are send to tomcat which reduces the load there too. I don't know how the weblogic module works. Normaly I use a reverse proxy with ajp. Why ajp and not http? ajp is faster since it sends the data in compressed binary format and not with the overhead from http and you don't have to care about the path issues. The ajp mostly handles that.
Since I'm not so much into Tomcat config I would change the ports and run instances on different ports.
Code: |
<Proxy balancer://myCluster>
BalancerMember ajp://localhost:8009
BalancerMember ajp://localhost:8010
BalancerMember ajp://localhost:8011
</Proxy>
<Location />
ProxyPass balancer://myCluster/ stickysession=JSESSIONID
</Location>
<Location /balancer-manager>
SetHandler balancer-manager
Order Deny,Allow
Deny from All
Allow from localhost 127.0.0.1 192.168.100.1
</Location>
|
I also have made a reverse proxy to jenkins (was hudson)
Code: |
<VirtualHost *:80>
ServerName jenkins
DocumentRoot "C:/mario/Apache22/htdocs"
<Directory "C:/mario/Apache22/htdocs">
Options Indexes Includes FollowSymLinks
AllowOverride All
Order Allow,Deny
Allow from all
Deny from none
</Directory>
<Location />
ProxyPass ajp://localhost:8009/
ProxyPassReverse ajp://localhost:8009/
</Location>
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\"" combined
#CustomLog logs/php_local.log combined
SetEnv vhostname jenkins
Header add X-Server-Name %{vhostname}e
</virtualhost>
|
|
|
Back to top |
|
szczecin
Joined: 06 Jun 2011 Posts: 3
|
Posted: Wed 08 Jun '11 16:10 Post subject: |
|
|
nice, thanks! |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7371 Location: Germany, Next to Hamburg
|
Posted: Wed 08 Jun '11 16:15 Post subject: |
|
|
Somebody might ask: Why mod_proxy_ajp and not mod_jk. Mod_proxy_ajp is out of the box with apache. Mod_jk needs to be compiled extra. Compiling it is some kinda PITA. Also mod_jk needs to match to apache version and java. |
|
Back to top |
|
Kanashii
Joined: 17 Jul 2006 Posts: 155 Location: Porando
|
Posted: Sat 11 Jun '11 13:58 Post subject: |
|
|
My Apache server handle this connection but you need to tweak TCP
* PHP fcgid
* use wincache is better because has directory caching
* for session use memcached
* apache use mem_cache and disabled vary for js and css
<FilesMatch "\.(css|js)$">
#Header set Cache-Control "max-age=2592000"
Header set X-FRAME-OPTIONS "DENY"
SetOutputFilter DEFLATE
Header unset Vary
Header unset User-Agent
</FilesMatch>
-------
reg add HKLM\System\CurrentControlSet\Services\HTTP\Parameters /v MaxConnections /t REG_DWORD /d 1000000
sc.exe config "AudioSrv" start= disabled
sc.exe config "wscsvc" start= disabled
sc.exe config "CscService" start= disabled
sc.exe config "WinDefend" start= disabled
bcdedit /set {default} recoveryenabled No
fsutil behavior query disabledeletenotify
chkntfs/t:4
powercfg.exe /hibernate off
netsh interface ipv4 set subinterface "Internet" mtu=1499 store=persistent
netsh interface tcp set global ecncapability=enabled
netsh int tcp set global rss=enabled
netsh int tcp set heuristics disabled
netsh int tcp set global congestionprovider=ctcp
netsh int tcp set global timestamps=disabled
find software like: hardenit.exe and secureit.exe on run as compatybility mode as windows XP
On server open browser and type: http://www.speedguide.net/analyzer.php
test:
http://loadimpact.com/
and
http://pagespeed.googlelabs.com |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7371 Location: Germany, Next to Hamburg
|
Posted: Tue 14 Jun '11 17:01 Post subject: |
|
|
@Kanashii on which OS did you tried this tweaks? Since it uses bcdedit it must be Vista or newer. Did you also tried on Windows server?
Things I don't know is:
Why disable hibernate?
What does this -->netsh int tcp set global rss=enabled<-- do? |
|
Back to top |
|
Kanashii
Joined: 17 Jul 2006 Posts: 155 Location: Porando
|
Posted: Thu 16 Jun '11 19:43 Post subject: |
|
|
Works on: windows Vista, WIN 7, Windows 2003 etc
Why disable hibernate? - --on windows server there disabled ::: i had SSD so it only wasted spaces
netsh int tcp set global rss=enabled
Receive Side Scaling attempts to take advantage of dual and quad core CPU's when transmitting data on the network. This feature is enabled by default. To disable it, copy or type the following line into your Command Prompt:- |
|
Back to top |
|
PipoDeClown
Joined: 20 Dec 2005 Posts: 77
|
Posted: Tue 05 Jul '11 20:36 Post subject: |
|
|
I really cannot stop myself to make comments on some of these so called Windows tweaks.
Kanashii wrote: |
reg add HKLM\System\CurrentControlSet\Services\HTTP\Parameters /v MaxConnections /t REG_DWORD /d 1000000
|
This is HTTP service which means IIS, there are no such registry settings for Apache anyway and did you ever see (different worker processes of) IIS handle this amount of connections? TCP stack has 2^16 possible ports available.
Kanashii wrote: |
sc.exe config "AudioSrv" start= disabled
sc.exe config "wscsvc" start= disabled
sc.exe config "CscService" start= disabled
sc.exe config "WinDefend" start= disabled
|
Did you measure any change in performance or is this just emotional feeling people have with disabling services?
Kanashii wrote: |
bcdedit /set {default} recoveryenabled No
fsutil behavior query disabledeletenotify
chkntfs/t:4
powercfg.exe /hibernate off
|
No direct measurable improvement to performance.
Kanashii wrote: |
netsh interface ipv4 set subinterface "Internet" mtu=1499 store=persistent
netsh interface tcp set global ecncapability=enabled
|
Playing with mtu only usefull if both devices have the same setting. 1500 is a standard.
ECN is send by router to inform device to lower transmission rate to avoid packet loss.
Kanashii wrote: |
netsh int tcp set global rss=enabled
|
Could indeed help at the Receiver's Side, which mostly are your clients receiving data From your server.
Kanashii wrote: |
netsh int tcp set heuristics disabled
netsh int tcp set global congestionprovider=ctcp
netsh int tcp set global timestamps=disabled
|
If you connect your server directly to the net without router, these indeed may help, but mostly is used for buggy drivers and/or hardware.
If someone want to use these kind of settings, please investigate first if there arent any drawbacks for your own system.
about ThreadLimit, how does it work on a x64 version of Apache? Or is the OP running a 32 bits version of Apache on that host? |
|
Back to top |
|
Steffen Moderator
Joined: 15 Oct 2005 Posts: 3092 Location: Hilversum, NL, EU
|
|
Back to top |
|