| Author |  | 
| cgi.linuxgeek 
 
 
 Joined: 13 Mar 2013
 Posts: 5
 Location: USA, San Francisco
 
 | 
|  Posted: Wed 13 Mar '13 21:08    Post subject: Apache performance on Windows Server2003 |   |  
| 
 |  
| I have an Apache 2.2.23 on a Windows Server 2003 32 bit with 4GB of Ram and 4 x 2.13GHz processor. The application is using apache, php (5.3.15) and MSSQL 2008 for some registration (SSL) procedure and the only problem is with the load and when there are more than 120 simultaneous users on the site, apache starts lagging, long response time and socket timeout.
 The CPU usage is 15% but memory usage is 3.5GB.
 
 Here is httpd -V:
 
 
  	  | Code: |  	  | Server version: Apache/2.2.23 (Win32) Server built:   Aug 24 2012 11:30:00
 Server's Module Magic Number: 20051115:31
 Server loaded:  APR 1.4.6, APR-Util 1.4.1
 Compiled using: APR 1.4.6, APR-Util 1.4.1
 Architecture:   32-bit
 Server MPM:     WinNT
 threaded:     yes (fixed thread count)
 forked:     no
 Server compiled with....
 -D APACHE_MPM_DIR="server/mpm/winnt"
 -D APR_HAS_SENDFILE
 -D APR_HAS_MMAP
 -D APR_HAVE_IPV6 (IPv4-mapped addresses disabled)
 -D APR_HAS_OTHER_CHILD
 -D AP_HAVE_RELIABLE_PIPED_LOGS
 -D DYNAMIC_MODULE_LIMIT=128
 -D HTTPD_ROOT="/apache"
 -D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
 -D DEFAULT_ERRORLOG="logs/error.log"
 -D AP_TYPES_CONFIG_FILE="conf/mime.types"
 -D SERVER_CONFIG_FILE="conf/httpd.conf"
 | 
 
 
 and here is httpd.conf (kinda messy sorry about that!)
 http://pastebin.com/BCpRMU6W
 
 Any tips or tweaks?
 |  | 
| Back to top |  | 
| admin Site Admin
 
  
 Joined: 15 Oct 2005
 Posts: 706
 
 
 | 
|  Posted: Wed 13 Mar '13 21:22    Post subject: |   |  
| 
 |  
| Did you try the following settings: 
 
 EnableMMAP off
 EnableSendfile off
 Win32DisableExceptEx
 
 
 Also consider to run PHP as FastCGI (mod_fcgid).
 |  | 
| Back to top |  | 
| cgi.linuxgeek 
 
 
 Joined: 13 Mar 2013
 Posts: 5
 Location: USA, San Francisco
 
 | 
|  Posted: Wed 13 Mar '13 23:06    Post subject: |   |  
| 
 |  
| Is it Win32DisableExceptEx or Win32DisableAcceptEx? I commented them out, gotta do some ab but any suggestion on MPM conf?
 |  | 
| Back to top |  | 
| glsmith Moderator
 
  
 Joined: 16 Oct 2007
 Posts: 2268
 Location: Sun Diego, USA
 
 |  | 
| Back to top |  | 
| cgi.linuxgeek 
 
 
 Joined: 13 Mar 2013
 Posts: 5
 Location: USA, San Francisco
 
 | 
|  Posted: Fri 15 Mar '13 1:48    Post subject: |   |  
| 
 |  
| yup, I did that, but I can't see any performance increase.  Anything on mpm? As you can see in the httpd.conf file the httpd-mpm.conf is commented out and I'm assuming that it's using the default setting.
 #Include conf/extra/httpd-mpm.conf
 |  | 
| Back to top |  | 
| James Blond Moderator
 
  
 Joined: 19 Jan 2006
 Posts: 7442
 Location: EU, Germany, Next to Hamburg
 
 | 
|  Posted: Mon 18 Mar '13 16:14    Post subject: |   |  
| 
 |  
| Sure increasing the values in mpm.conf (if you include it) may help increase the speed of your server if it comes to handle serveral request at the same time. |  | 
| Back to top |  | 
| cgi.linuxgeek 
 
 
 Joined: 13 Mar 2013
 Posts: 5
 Location: USA, San Francisco
 
 | 
|  Posted: Wed 20 Mar '13 20:05    Post subject: |   |  
| 
 |  
| I did some ab on the server (HTTPS) and realized when the number of concurrent connections goes over 200 the SSL fails: 
  	  | Code: |  	  | SSL read failed - closing connection | 
 
 The same process on HTTP but it could easily handle 5 times more number of users and concurrent connections.
 
 What is the best approach to deal with https and it's configuration or tweaking it?
 |  | 
| Back to top |  | 
| James Blond Moderator
 
  
 Joined: 19 Jan 2006
 Posts: 7442
 Location: EU, Germany, Next to Hamburg
 
 | 
|  Posted: Thu 21 Mar '13 10:48    Post subject: |   |  
| 
 |  
|  	  | Code: |  	  | # WinNT MPM
 # ThreadsPerChild: constant number of worker threads in the server process
 # MaxRequestsPerChild: maximum  number of requests a server process serves
 <IfModule mpm_winnt_module>
 ThreadsPerChild      150
 MaxRequestsPerChild    0
 </IfModule>
 
 | 
 
 That are the default values. Did you increase it?
 
 Make use of SSLSessionCache and SSLSessionCacheTimeout
 |  | 
| Back to top |  | 
| cgi.linuxgeek 
 
 
 Joined: 13 Mar 2013
 Posts: 5
 Location: USA, San Francisco
 
 | 
|  Posted: Tue 09 Apr '13 21:44    Post subject: |   |  
| 
 |  
| James, I changed it the mpm settings to: 
  	  | Code: |  	  | ThreadsPerChild      500 MaxRequestsPerChild    0
 | 
 
 For the SSL I'm already using:
 
  	  | Code: |  	  | SSLSessionCache        "shmcb:C:/Program Files/Apache Software Foundation/Apache2.2/logs/ssl_scache(512000)" SSLSessionCacheTimeout  300
 | 
 
 On the log file, I realized the workers and child processes are exiting after the restart:
 
  	  | Code: |  	  | [Tue Apr 09 15:38:14 2013] [notice] Apache/2.2.24 (Win64) PHP/5.4.13 configured -- resuming normal operations [Tue Apr 09 15:38:14 2013] [notice] Server built: Feb 22 2013 22:49:42
 [Tue Apr 09 15:38:14 2013] [notice] Parent: Created child process 6812
 [Tue Apr 09 15:38:14 2013] [notice] Disabled use of AcceptEx() WinSock2 API
 [Tue Apr 09 15:38:14 2013] [notice] Child 6812: Child process is running
 [Tue Apr 09 15:38:15 2013] [notice] Child 6812: Acquired the start mutex.
 [Tue Apr 09 15:38:15 2013] [notice] Child 6812: Starting 500 worker threads.
 [Tue Apr 09 15:38:15 2013] [notice] Child 6896: Released the start mutex
 [Tue Apr 09 15:38:15 2013] [notice] Child 6896: All worker threads have exited.
 [Tue Apr 09 15:38:15 2013] [notice] Child 6896: Child process is exiting
 | 
 
 Any Idea why it's happening?
 |  | 
| Back to top |  | 
| CamaroSS 
 
 
 Joined: 24 Jan 2013
 Posts: 78
 Location: RF, Tver
 
 | 
|  Posted: Wed 10 Apr '13 8:22    Post subject: |   |  
| 
 |  
| What's wrong? PID 6896 exits, PID 6812 comes into action. |  | 
| Back to top |  |