Apache Optimization

Started by diy05, Jun 29, 2022, 11:49 AM

Previous topic - Next topic

diy05Topic starter

I have setup one server for just campaign. It will be used for one month. It has 32GB of RAM, It has 10 core Intel(R) Xeon(R) CPU E5-2640 v4 @ 2.40GHz Processor, 512GB of storage. There will be no mysql usage, no email service usage, just apache and php one file run for example xyz.php which has small code php, json.

My customer will spend good budget for campaign and I have installed there directadmin. Please suggest me what settings i must set for apache + php so it can handle 1500-2000 visitors at a time.

I need some guide for optimisation so it can run smoothly. Do i also need to add cloudflare or it will be fine?


This guide is fine

2 main steps:
1)Enable gzip compression
2) Calculate MaxRequestWorkers
    The following users thanked this post: Sevad

sima singhs

a list of actions that will help you optimize the performance of Apache as much as possible.

Remove unused modules
Save memory, load only the modules you need depending on the programming language you use: mod_php, mod_ruby, mod_perl, etc.

Use mod_disk_cache, not mod_mem_cache
mod_mem_cache will not share the cache between different apache processes resulting in huge memory usage with little performance gain.

Set up Apache caching
Set up mod_disk_cache. Make sure you use CacheDirLength = 2 and CacheDirLevels = 1 so that htcacheclean doesn't take a huge amount of time to clean up the cache directory.

Set the appropriate Expires, Etag and Cache-Control headers.
To make good use of your cache, you must specify when a particular file expires, otherwise your client won't get the benefit of caching.

Put the cache on a separate disk
Place the cache on a separate physical disk for quick access without slowing down other processes.

Use Piped Logging Instead of Direct Logging
Using Piped Logging will lead to a significant increase in the speed of the site for your users, and it will not freeze. Especially valuable if you use Passenger.

Use different drives
Putting your logs in separate sections is a good way to optimize Apache.

Disable .htaccess
This will prevent the need to check this file on every request.

Allow symbolic links
Use the options + FollowSymLinks -SymLinksIfOwnerMatch. Otherwise, Apache will make a separate call for each filename to make sure it's not a symbolic link.

Disable ExtendedStatus
ExtendedStatus will generate multiple system calls per request to collect statistics. It is better to use it during a certain period of statistics comparison, and then turn it off.

Use a specific DirectoryIndex
That is, index.html or index.php, not just index.

Set up an external proxy for images and tables
Let your main web servers handle the bulk of the data while images and tables are handled by the web servers for the front end.

Use mod_passenger for Rails
mod_passenger can share memory and resources across multiple processes. It will also monitor these processes and remove them when not needed, optimizing the performance of your product.

Disable safe_mode for PHP
It uses 50-70% of script loading time to check for safe directives. Instead, set open_base_dir properly and use plugins like mod_itk.

Use the Apache caching setting for frequently accessed data
memcached is great for frequently accessed data and sessions. This step will extremely increase the speed of work.