SlideShare a Scribd company logo
1 of 26
Download to read offline
25 Apache Performance Tips
www.monitis.com
25 Apache Performance Tuning Tipswww.monitis.com Uptime & Device Monitoring
1. Remove unused modules
Save memory by not loading modules that aren’t needed,
including (but not limited to)…
… mod_php,
… mod_ruby,
… mod_perl,
etc.
25 Apache Performance Tuning Tipswww.monitis.com Uptime & Device Monitoring
2. Use mod_disk_cache and NOT
mod_mem_cache
Mod_mem_cachewill not share its cache amongst different
apache processes, which results in high memory usage with
little performance gain. On an active server mod_mem_cache
will rarely serve the same page twice in the same Apache
process.
25 Apache Performance Tuning Tipswww.monitis.com Uptime & Device Monitoring
3. Configure mod_disk_cache with a
flat hierarchy
Make sure you are using CacheDirLength=2and
CacheDirLevels=1to ensure htcachecleanwill not take forever
when cleaning up your cache directory.
25 Apache Performance Tuning Tipswww.monitis.com Uptime & Device Monitoring
4. Setup appropriate Expires, Etag,
and Chache-Control headers
In order to utilize your cache you have to specify when a file
expires, otherwise your client will not experience the caching
benefits.
25 Apache Performance Tuning Tipswww.monitis.com Uptime & Device Monitoring
5. Put the cache on a separate disk
Move your cache to a separate physical disk for the fastest
access without slowing down other processes.
25 Apache Performance Tuning Tipswww.monitis.com Uptime & Device Monitoring
6. Use piped logging instead of
direct logging
Directly logging to a file results in issues when rotating the log
file. A restart will be necessary to use the next log file. This
causes significant slowness for you users during the restart.
Particularly if you are using Passenger or some other app
loader.
25 Apache Performance Tuning Tipswww.monitis.com Uptime & Device Monitoring
7. Log to a different disk than the
disk serving pages
Put your logs on physically different disks than the files you
are serving.
25 Apache Performance Tuning Tipswww.monitis.com Uptime & Device Monitoring
8. Utilize mod_gzip/mod_deflate
Gzip your content before sending it off. The client will ungzip
upon receipt which will minimize the size of file transfers. Also,
it will generally improve the user experience.
25 Apache Performance Tuning Tipswww.monitis.com Uptime & Device Monitoring
9. Turn off HostnameLookups
Stop doing effortful DNS lookups. You will rarely ever need
them and when you do, you can always look them up when
really needed.
25 Apache Performance Tuning Tipswww.monitis.com Uptime & Device Monitoring
10. Avoid using hostname in configs
If HostnameLookups are turned off, it will keep you from
waiting for the DNS resolving the hostnames in your configs.
Instead, use IP addresses.
25 Apache Performance Tuning Tipswww.monitis.com Uptime & Device Monitoring
11. Use persistent connections
Set KeepAlive, KeepAliveTimeout and KeepAliveRequests.
KeepAliveTimeout defines how long Apache will wait for the
next request, and KeepAliveRequests defines the maximum
number of requests for a client prior to resetting the
connection. This will prevent the client from having to
reconnect between each request.
25 Apache Performance Tuning Tipswww.monitis.com Uptime & Device Monitoring
12. Do not set KeepAliveTimeout too
high
If you have more requests than Apache children, settings
which are set too high could exhaust your pool of available
clients.
25 Apache Performance Tuning Tipswww.monitis.com Uptime & Device Monitoring
13. Disable .htaccess
I.e. AllowOverride None. This will keep Apache from checking
for an .htaccess file upon each request.
25 Apache Performance Tuning Tipswww.monitis.com Uptime & Device Monitoring
14. Allow symlinks
I.e. Options + FoolowSymLinks – SymLinksIfOwnerMatch.
Otherwise, Apache will make a separate call on each filename
to ensure it is not a symlink.
25 Apache Performance Tuning Tipswww.monitis.com Uptime & Device Monitoring
15. Set ExtendStatus off
Although very useful, the ExtendStatus will produce several
system calls for each request to gather statistics. It‘s better to
only define a certain time frame in order to benchmark and
keep it turned off the remainder of the time.
25 Apache Performance Tuning Tipswww.monitis.com Uptime & Device Monitoring
16. Avoid Wildcards in
DirectoryIndex
Use a specific DirectoryIndex, i.e. index.html or index.php, not
index.
25 Apache Performance Tuning Tipswww.monitis.com Uptime & Device Monitoring
17. Increase Swappiness
Particularly on single site hosts this will increase the
performance. On Linux systems increase
/proc/sys/vm/swappiness to at least 60 if not higher. This will
result in loading as many files as possible into the memory
cache for a quicker access.
25 Apache Performance Tuning Tipswww.monitis.com Uptime & Device Monitoring
18. Increase Write Buffer Size
Increase your write buffer size for TCP/IP buffers. On Linux
systems increase /proc/sys/net/core/wmem_max and
/proc/sys/net/core/wmem_default. If your pages fit within this
buffer, Apache will complete a process in just one call to the
TCP/IP buffer.
25 Apache Performance Tuning Tipswww.monitis.com Uptime & Device Monitoring
19. Increase Max Open Files
If you are handling high loads, increase the number of
allowed open files. On Linux increase /proc/sys/fs/file-max
and run ulimit –H –n 4096.
25 Apache Performance Tuning Tipswww.monitis.com Uptime & Device Monitoring
20. Setup a frontend proxy for
images and stylesheets
Allow your main web servers to process the application while
images and stylesheets are served from frontend webservers.
25 Apache Performance Tuning Tipswww.monitis.com Uptime & Device Monitoring
21. Use mod_passenger for rails
Mod_passenger is able to share memory and resources
amongst several processes, allowing for faster spawning of
new application instances. It will also monitor these
processes and remove them when they become unncessary.
25 Apache Performance Tuning Tipswww.monitis.com Uptime & Device Monitoring
23. Don‘t use threaded mpm with
mod_php
Look at using mod_itk, mod_php tends to segfault with
threaded mpm.
25 Apache Performance Tuning Tipswww.monitis.com Uptime & Device Monitoring
24. Flush buffers early for pre-
render
It takes a relatively long time to create a webpage on the
backend. Flush your buffer prior to page completion to send
a partial page to the client, so it can start rendering. A good
place to do this is right after the HEAD section – so that the
browser can start fetching other objects.
25 Apache Performance Tuning Tipswww.monitis.com Uptime & Device Monitoring
25. Use a cache for frequently
accessed data
Memcached is a great for frequently used data and sessions. It
will speed up your Apache render time as databases are
slow.
facebook.com/Monitis.Monitoring
@Monitis
The All-in-One Monitoring Solution
Start your free 15-day trial for
free!
www.monitis.com

More Related Content

What's hot

Apache Tomcat 8 Application Server
Apache Tomcat 8 Application ServerApache Tomcat 8 Application Server
Apache Tomcat 8 Application Server
mohamedmoharam
 
Tomcat New Evolution
Tomcat New EvolutionTomcat New Evolution
Tomcat New Evolution
Allan Huang
 
WE18_Performance_Up.ppt
WE18_Performance_Up.pptWE18_Performance_Up.ppt
WE18_Performance_Up.ppt
webhostingguy
 
[MathWorks] Versioning Infrastructure
[MathWorks] Versioning Infrastructure[MathWorks] Versioning Infrastructure
[MathWorks] Versioning Infrastructure
Perforce
 
Apache Manager Table of Contents
Apache Manager Table of ContentsApache Manager Table of Contents
Apache Manager Table of Contents
webhostingguy
 

What's hot (20)

Tomcat Optimisation & Performance Tuning
Tomcat Optimisation & Performance TuningTomcat Optimisation & Performance Tuning
Tomcat Optimisation & Performance Tuning
 
Apache Tomcat 8 Application Server
Apache Tomcat 8 Application ServerApache Tomcat 8 Application Server
Apache Tomcat 8 Application Server
 
Tomcat server
 Tomcat server Tomcat server
Tomcat server
 
Tomcat
TomcatTomcat
Tomcat
 
Tomcat Server
Tomcat ServerTomcat Server
Tomcat Server
 
Apache TomEE - Tomcat with a kick
Apache TomEE  - Tomcat with a kickApache TomEE  - Tomcat with a kick
Apache TomEE - Tomcat with a kick
 
Tomcat next
Tomcat nextTomcat next
Tomcat next
 
Apache Tomcat 7 by Filip Hanik
Apache Tomcat 7 by Filip HanikApache Tomcat 7 by Filip Hanik
Apache Tomcat 7 by Filip Hanik
 
Tomcat New Evolution
Tomcat New EvolutionTomcat New Evolution
Tomcat New Evolution
 
Apache tomcat
Apache tomcatApache tomcat
Apache tomcat
 
Auxiliary : Tomcat
Auxiliary : TomcatAuxiliary : Tomcat
Auxiliary : Tomcat
 
Tomcat configuration
Tomcat configurationTomcat configuration
Tomcat configuration
 
Introduction of Tomcat
Introduction of TomcatIntroduction of Tomcat
Introduction of Tomcat
 
Fastest Servlets in the West
Fastest Servlets in the WestFastest Servlets in the West
Fastest Servlets in the West
 
Apache Traffic Server & Lua
Apache Traffic Server & LuaApache Traffic Server & Lua
Apache Traffic Server & Lua
 
are available here
are available hereare available here
are available here
 
WE18_Performance_Up.ppt
WE18_Performance_Up.pptWE18_Performance_Up.ppt
WE18_Performance_Up.ppt
 
[MathWorks] Versioning Infrastructure
[MathWorks] Versioning Infrastructure[MathWorks] Versioning Infrastructure
[MathWorks] Versioning Infrastructure
 
Apache Manager Table of Contents
Apache Manager Table of ContentsApache Manager Table of Contents
Apache Manager Table of Contents
 
Aem maintenance
Aem maintenanceAem maintenance
Aem maintenance
 

Viewers also liked

Trouble shoot with linux syslog
Trouble shoot with linux syslogTrouble shoot with linux syslog
Trouble shoot with linux syslog
ashok191
 
Module 13 - Troubleshooting
Module 13 - TroubleshootingModule 13 - Troubleshooting
Module 13 - Troubleshooting
T. J. Saotome
 
unix training | unix training videos | unix course unix online training
unix training |  unix training videos |  unix course  unix online training unix training |  unix training videos |  unix course  unix online training
unix training | unix training videos | unix course unix online training
Nancy Thomas
 

Viewers also liked (17)

Web Performance Part 3 "Server-side tips"
Web Performance Part 3  "Server-side tips"Web Performance Part 3  "Server-side tips"
Web Performance Part 3 "Server-side tips"
 
Linux Shell Scripting Craftsmanship
Linux Shell Scripting CraftsmanshipLinux Shell Scripting Craftsmanship
Linux Shell Scripting Craftsmanship
 
Trouble shoot with linux syslog
Trouble shoot with linux syslogTrouble shoot with linux syslog
Trouble shoot with linux syslog
 
UNIX - Class4 - Advance Shell Scripting-P1
UNIX - Class4 - Advance Shell Scripting-P1UNIX - Class4 - Advance Shell Scripting-P1
UNIX - Class4 - Advance Shell Scripting-P1
 
UNIX - Class1 - Basic Shell
UNIX - Class1 - Basic ShellUNIX - Class1 - Basic Shell
UNIX - Class1 - Basic Shell
 
Unixshellscript 100406085942-phpapp02
Unixshellscript 100406085942-phpapp02Unixshellscript 100406085942-phpapp02
Unixshellscript 100406085942-phpapp02
 
UNIX - Class5 - Advance Shell Scripting-P2
UNIX - Class5 - Advance Shell Scripting-P2UNIX - Class5 - Advance Shell Scripting-P2
UNIX - Class5 - Advance Shell Scripting-P2
 
Karkha unix shell scritping
Karkha unix shell scritpingKarkha unix shell scritping
Karkha unix shell scritping
 
Module 13 - Troubleshooting
Module 13 - TroubleshootingModule 13 - Troubleshooting
Module 13 - Troubleshooting
 
APACHE
APACHEAPACHE
APACHE
 
Advanced Oracle Troubleshooting
Advanced Oracle TroubleshootingAdvanced Oracle Troubleshooting
Advanced Oracle Troubleshooting
 
Linux troubleshooting tips
Linux troubleshooting tipsLinux troubleshooting tips
Linux troubleshooting tips
 
unix training | unix training videos | unix course unix online training
unix training |  unix training videos |  unix course  unix online training unix training |  unix training videos |  unix course  unix online training
unix training | unix training videos | unix course unix online training
 
Process monitoring in UNIX shell scripting
Process monitoring in UNIX shell scriptingProcess monitoring in UNIX shell scripting
Process monitoring in UNIX shell scripting
 
Fusion Middleware 11g How To Part 2
Fusion Middleware 11g How To Part 2Fusion Middleware 11g How To Part 2
Fusion Middleware 11g How To Part 2
 
Sql server troubleshooting
Sql server troubleshootingSql server troubleshooting
Sql server troubleshooting
 
Tomcat next
Tomcat nextTomcat next
Tomcat next
 

Similar to 25 Apache Performance Tips

Aegir. развертывание и управление большой сетью drupal сайтов
Aegir. развертывание и управление большой сетью drupal сайтовAegir. развертывание и управление большой сетью drupal сайтов
Aegir. развертывание и управление большой сетью drupal сайтов
DrupalCamp Kyiv Рысь
 
wordpress-performance-presentation
wordpress-performance-presentationwordpress-performance-presentation
wordpress-performance-presentation
Arun Janarthanan
 
Apache Street Smarts Presentation (SANS 99)
Apache Street Smarts Presentation (SANS 99)Apache Street Smarts Presentation (SANS 99)
Apache Street Smarts Presentation (SANS 99)
Michael Dobe, Ph.D.
 

Similar to 25 Apache Performance Tips (20)

Scale Apache with Nginx
Scale Apache with NginxScale Apache with Nginx
Scale Apache with Nginx
 
Performance and Scalability
Performance and ScalabilityPerformance and Scalability
Performance and Scalability
 
AEM (CQ) Dispatcher Security and CDN+Browser Caching
AEM (CQ) Dispatcher Security and CDN+Browser CachingAEM (CQ) Dispatcher Security and CDN+Browser Caching
AEM (CQ) Dispatcher Security and CDN+Browser Caching
 
High Performance Web Sites
High Performance Web SitesHigh Performance Web Sites
High Performance Web Sites
 
Aegir. развертывание и управление большой сетью drupal сайтов
Aegir. развертывание и управление большой сетью drupal сайтовAegir. развертывание и управление большой сетью drupal сайтов
Aegir. развертывание и управление большой сетью drupal сайтов
 
Aegir presentation
Aegir presentation Aegir presentation
Aegir presentation
 
Scaling PHP apps
Scaling PHP appsScaling PHP apps
Scaling PHP apps
 
Make WordPress Fly With Virtual Server Hosting - WordCamp Sydney 2014
Make WordPress Fly With Virtual Server Hosting  - WordCamp Sydney 2014Make WordPress Fly With Virtual Server Hosting  - WordCamp Sydney 2014
Make WordPress Fly With Virtual Server Hosting - WordCamp Sydney 2014
 
cache concepts and varnish-cache
cache concepts and varnish-cachecache concepts and varnish-cache
cache concepts and varnish-cache
 
50-Tips-for-Boosting-MySQL-Performance-CON2655.pdf
50-Tips-for-Boosting-MySQL-Performance-CON2655.pdf50-Tips-for-Boosting-MySQL-Performance-CON2655.pdf
50-Tips-for-Boosting-MySQL-Performance-CON2655.pdf
 
PHP Performance tuning for Drupal 8
PHP Performance tuning for Drupal 8PHP Performance tuning for Drupal 8
PHP Performance tuning for Drupal 8
 
Your Inner Sysadmin - LonestarPHP 2015
Your Inner Sysadmin - LonestarPHP 2015Your Inner Sysadmin - LonestarPHP 2015
Your Inner Sysadmin - LonestarPHP 2015
 
Anthony Somerset - Site Speed = Success!
Anthony Somerset - Site Speed = Success!Anthony Somerset - Site Speed = Success!
Anthony Somerset - Site Speed = Success!
 
Optimizing Drupal Performance (English)
Optimizing Drupal Performance (English)Optimizing Drupal Performance (English)
Optimizing Drupal Performance (English)
 
Site Speed = Success – Optimising WordPress from the Server Up - Presented by...
Site Speed = Success – Optimising WordPress from the Server Up - Presented by...Site Speed = Success – Optimising WordPress from the Server Up - Presented by...
Site Speed = Success – Optimising WordPress from the Server Up - Presented by...
 
WordCamp Harare 2016 - Site Speed = Success
WordCamp Harare 2016 - Site Speed = SuccessWordCamp Harare 2016 - Site Speed = Success
WordCamp Harare 2016 - Site Speed = Success
 
Drupal performance optimization Best Practices
Drupal performance optimization Best PracticesDrupal performance optimization Best Practices
Drupal performance optimization Best Practices
 
Supercharging your PHP pages with mod_lsapi in CloudLinux OS
Supercharging your PHP pages with mod_lsapi in CloudLinux OSSupercharging your PHP pages with mod_lsapi in CloudLinux OS
Supercharging your PHP pages with mod_lsapi in CloudLinux OS
 
wordpress-performance-presentation
wordpress-performance-presentationwordpress-performance-presentation
wordpress-performance-presentation
 
Apache Street Smarts Presentation (SANS 99)
Apache Street Smarts Presentation (SANS 99)Apache Street Smarts Presentation (SANS 99)
Apache Street Smarts Presentation (SANS 99)
 

Recently uploaded

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 

Recently uploaded (20)

Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 

25 Apache Performance Tips

  • 1. 25 Apache Performance Tips www.monitis.com
  • 2. 25 Apache Performance Tuning Tipswww.monitis.com Uptime & Device Monitoring 1. Remove unused modules Save memory by not loading modules that aren’t needed, including (but not limited to)… … mod_php, … mod_ruby, … mod_perl, etc.
  • 3. 25 Apache Performance Tuning Tipswww.monitis.com Uptime & Device Monitoring 2. Use mod_disk_cache and NOT mod_mem_cache Mod_mem_cachewill not share its cache amongst different apache processes, which results in high memory usage with little performance gain. On an active server mod_mem_cache will rarely serve the same page twice in the same Apache process.
  • 4. 25 Apache Performance Tuning Tipswww.monitis.com Uptime & Device Monitoring 3. Configure mod_disk_cache with a flat hierarchy Make sure you are using CacheDirLength=2and CacheDirLevels=1to ensure htcachecleanwill not take forever when cleaning up your cache directory.
  • 5. 25 Apache Performance Tuning Tipswww.monitis.com Uptime & Device Monitoring 4. Setup appropriate Expires, Etag, and Chache-Control headers In order to utilize your cache you have to specify when a file expires, otherwise your client will not experience the caching benefits.
  • 6. 25 Apache Performance Tuning Tipswww.monitis.com Uptime & Device Monitoring 5. Put the cache on a separate disk Move your cache to a separate physical disk for the fastest access without slowing down other processes.
  • 7. 25 Apache Performance Tuning Tipswww.monitis.com Uptime & Device Monitoring 6. Use piped logging instead of direct logging Directly logging to a file results in issues when rotating the log file. A restart will be necessary to use the next log file. This causes significant slowness for you users during the restart. Particularly if you are using Passenger or some other app loader.
  • 8. 25 Apache Performance Tuning Tipswww.monitis.com Uptime & Device Monitoring 7. Log to a different disk than the disk serving pages Put your logs on physically different disks than the files you are serving.
  • 9. 25 Apache Performance Tuning Tipswww.monitis.com Uptime & Device Monitoring 8. Utilize mod_gzip/mod_deflate Gzip your content before sending it off. The client will ungzip upon receipt which will minimize the size of file transfers. Also, it will generally improve the user experience.
  • 10. 25 Apache Performance Tuning Tipswww.monitis.com Uptime & Device Monitoring 9. Turn off HostnameLookups Stop doing effortful DNS lookups. You will rarely ever need them and when you do, you can always look them up when really needed.
  • 11. 25 Apache Performance Tuning Tipswww.monitis.com Uptime & Device Monitoring 10. Avoid using hostname in configs If HostnameLookups are turned off, it will keep you from waiting for the DNS resolving the hostnames in your configs. Instead, use IP addresses.
  • 12. 25 Apache Performance Tuning Tipswww.monitis.com Uptime & Device Monitoring 11. Use persistent connections Set KeepAlive, KeepAliveTimeout and KeepAliveRequests. KeepAliveTimeout defines how long Apache will wait for the next request, and KeepAliveRequests defines the maximum number of requests for a client prior to resetting the connection. This will prevent the client from having to reconnect between each request.
  • 13. 25 Apache Performance Tuning Tipswww.monitis.com Uptime & Device Monitoring 12. Do not set KeepAliveTimeout too high If you have more requests than Apache children, settings which are set too high could exhaust your pool of available clients.
  • 14. 25 Apache Performance Tuning Tipswww.monitis.com Uptime & Device Monitoring 13. Disable .htaccess I.e. AllowOverride None. This will keep Apache from checking for an .htaccess file upon each request.
  • 15. 25 Apache Performance Tuning Tipswww.monitis.com Uptime & Device Monitoring 14. Allow symlinks I.e. Options + FoolowSymLinks – SymLinksIfOwnerMatch. Otherwise, Apache will make a separate call on each filename to ensure it is not a symlink.
  • 16. 25 Apache Performance Tuning Tipswww.monitis.com Uptime & Device Monitoring 15. Set ExtendStatus off Although very useful, the ExtendStatus will produce several system calls for each request to gather statistics. It‘s better to only define a certain time frame in order to benchmark and keep it turned off the remainder of the time.
  • 17. 25 Apache Performance Tuning Tipswww.monitis.com Uptime & Device Monitoring 16. Avoid Wildcards in DirectoryIndex Use a specific DirectoryIndex, i.e. index.html or index.php, not index.
  • 18. 25 Apache Performance Tuning Tipswww.monitis.com Uptime & Device Monitoring 17. Increase Swappiness Particularly on single site hosts this will increase the performance. On Linux systems increase /proc/sys/vm/swappiness to at least 60 if not higher. This will result in loading as many files as possible into the memory cache for a quicker access.
  • 19. 25 Apache Performance Tuning Tipswww.monitis.com Uptime & Device Monitoring 18. Increase Write Buffer Size Increase your write buffer size for TCP/IP buffers. On Linux systems increase /proc/sys/net/core/wmem_max and /proc/sys/net/core/wmem_default. If your pages fit within this buffer, Apache will complete a process in just one call to the TCP/IP buffer.
  • 20. 25 Apache Performance Tuning Tipswww.monitis.com Uptime & Device Monitoring 19. Increase Max Open Files If you are handling high loads, increase the number of allowed open files. On Linux increase /proc/sys/fs/file-max and run ulimit –H –n 4096.
  • 21. 25 Apache Performance Tuning Tipswww.monitis.com Uptime & Device Monitoring 20. Setup a frontend proxy for images and stylesheets Allow your main web servers to process the application while images and stylesheets are served from frontend webservers.
  • 22. 25 Apache Performance Tuning Tipswww.monitis.com Uptime & Device Monitoring 21. Use mod_passenger for rails Mod_passenger is able to share memory and resources amongst several processes, allowing for faster spawning of new application instances. It will also monitor these processes and remove them when they become unncessary.
  • 23. 25 Apache Performance Tuning Tipswww.monitis.com Uptime & Device Monitoring 23. Don‘t use threaded mpm with mod_php Look at using mod_itk, mod_php tends to segfault with threaded mpm.
  • 24. 25 Apache Performance Tuning Tipswww.monitis.com Uptime & Device Monitoring 24. Flush buffers early for pre- render It takes a relatively long time to create a webpage on the backend. Flush your buffer prior to page completion to send a partial page to the client, so it can start rendering. A good place to do this is right after the HEAD section – so that the browser can start fetching other objects.
  • 25. 25 Apache Performance Tuning Tipswww.monitis.com Uptime & Device Monitoring 25. Use a cache for frequently accessed data Memcached is a great for frequently used data and sessions. It will speed up your Apache render time as databases are slow.
  • 26. facebook.com/Monitis.Monitoring @Monitis The All-in-One Monitoring Solution Start your free 15-day trial for free! www.monitis.com