How to Tune DirectAdmin Apache MPM Settings for High Concurrent Users

Priya

Content Writer & Researcher

Last Updated: 17 October 2026
How to Tune DirectAdmin Apache MPM Settings for High Concurrent Users
πŸ–₯️

Is Your DirectAdmin Server Hitting Its Limits Under Load?

CloudHouse Technologies tunes Apache MPM settings, PHP-FPM pools, and server capacity for DirectAdmin hosting environments. Get expert performance optimisation today.

πŸ–₯️12,400+PCs Fixed
⭐4.9β˜…Google Rating
⚑<15 minAvg. Response
πŸ›‘οΈISO 27001Certified

If your DirectAdmin server becomes slow or unresponsive during traffic spikes, the problem is often Apache's Multi-Processing Module (MPM) configuration. By default, Apache is configured conservatively β€” suitable for a new server, but not for a hosting environment handling dozens or hundreds of simultaneous connections. DirectAdmin Apache MPM tuning lets you match Apache's concurrency settings to your actual server RAM and traffic patterns, preventing crashes without wasting resources.

This guide covers the three MPM modes, how to check and change your current configuration, and the exact formulas for calculating the right MaxRequestWorkers value for your server.

Understanding Apache MPM Modes in DirectAdmin

Apache uses a Multi-Processing Module to determine how it spawns processes and threads to handle incoming requests. DirectAdmin supports three MPM modes, and the right choice depends on your PHP setup.

Prefork MPM

Prefork creates multiple child processes, each handling one request at a time with a single thread. It's the most compatible mode β€” it works with mod_php, mod_ruid2, and suPHP β€” but it uses the most memory because each process is a full Apache instance.

When DirectAdmin uses it: When your PHP handler is mod_php or suPHP. DirectAdmin's CustomBuild automatically selects Prefork in these cases.

Downside: Under high concurrency, Prefork spawns many large processes that consume RAM rapidly.

Worker MPM

Worker uses multiple child processes, each with multiple threads. Threads share memory within a process, making it more efficient than Prefork. However, Worker requires thread-safe PHP (PHP-FPM or FastCGI) and is less commonly deployed today since Event has largely replaced it.

Event MPM

Event is the modern, high-performance mode. It uses an asynchronous design where a dedicated thread manages keep-alive connections, freeing up other threads to handle new requests. This means Event can serve significantly more concurrent users with the same RAM compared to Prefork.

When DirectAdmin uses it: When your PHP handler is PHP-FPM, lsphp, or FastCGI. DirectAdmin automatically selects Event MPM in these cases.

Recommendation: If you're on PHP-FPM (the current best practice), Event MPM is the right choice. It can handle 30–50% more concurrent connections than Prefork with the same hardware.

Check Your Current Apache MPM Mode

Before making changes, confirm which MPM your server is running:

# Check MPM mode
httpd -V | grep "Server MPM"
# or
apachectl -V | grep "Server MPM"

# Verify loaded MPM module
httpd -M | grep mpm

Output will show Server MPM: prefork, Server MPM: event, or Server MPM: worker.

To see the current MPM configuration values:

cat /etc/httpd/conf/extra/httpd-mpm.conf

Calculating the Right MaxRequestWorkers Value

MaxRequestWorkers is the single most important MPM directive. It sets the maximum number of simultaneous requests Apache will process. Too low and new connections queue up and timeout. Too high and your server runs out of RAM, starts swapping to disk, and becomes slower than if you'd set a lower limit.

The formula:

MaxRequestWorkers = (Available RAM for Apache) Γ· (Average Apache process size in MB)

Step 1: Find available RAM for Apache

free -m

Take total RAM, subtract what's used by the OS, MySQL/MariaDB, and other services. A rough rule: reserve 20–25% of RAM for non-Apache processes on a typical shared hosting server.

Step 2: Measure actual Apache process size

ps aux | grep httpd | awk '{print $6}' | sort -n | tail -20

This shows the RSS (resident set size) in KB for each Apache worker. Average the top 10–15 values and convert to MB. On a typical cPanel/DirectAdmin shared hosting server with mod_php, expect 40–80 MB per process. With PHP-FPM + Event MPM, Apache processes are leaner β€” often 15–30 MB each.

Step 3: Calculate and apply

Example: 8 GB server, 2 GB reserved for OS/MySQL, 6 GB available. Average Apache process: 50 MB.

6000 MB Γ· 50 MB = 120 MaxRequestWorkers

Set it conservatively β€” leave 10–15% headroom. So for this example, start with 100–110 rather than the theoretical maximum of 120.

Tuning the Key MPM Directives in DirectAdmin

Edit the MPM configuration file:

nano /etc/httpd/conf/extra/httpd-mpm.conf

For a Prefork MPM server (8 GB RAM, ~100 MaxRequestWorkers):

<IfModule mpm_prefork_module>
    StartServers             10
    MinSpareServers           5
    MaxSpareServers          30
    MaxRequestWorkers       100
    MaxConnectionsPerChild 2000
</IfModule>

For an Event MPM server (8 GB RAM with PHP-FPM):

<IfModule mpm_event_module>
    StartServers              3
    MinSpareThreads          25
    MaxSpareThreads          75
    ThreadLimit              64
    ThreadsPerChild          25
    MaxRequestWorkers       200
    MaxConnectionsPerChild 2000
</IfModule>

Also ensure ServerLimit is set to match or exceed MaxRequestWorkers:

ServerLimit 100   # must be β‰₯ MaxRequestWorkers

Important: ServerLimit can only be changed by restarting Apache (not graceful reload). If you set MaxRequestWorkers higher than ServerLimit, Apache silently uses the ServerLimit value.

After editing, test and reload:

apachectl configtest   # should return "Syntax OK"
apachectl graceful    # reload without dropping connections

What Each Directive Controls

StartServers

The number of child processes Apache spawns on startup. Set this high enough that the server is immediately ready for traffic rather than spawning processes under the first burst of requests. For busy servers, 8–15 is typical.

MinSpareServers / MinSpareThreads

The minimum number of idle processes (Prefork) or threads (Event/Worker) Apache keeps ready. Apache will spawn more workers if idle count drops below this. Set high enough to absorb sudden traffic spikes without a spawn delay. Too high wastes memory on idle processes.

MaxSpareServers / MaxSpareThreads

The maximum idle processes/threads Apache keeps. Apache kills workers above this count during quiet periods. This prevents memory being held by idle workers after a traffic spike passes.

MaxConnectionsPerChild

The maximum number of requests a single child process serves before it's gracefully killed and replaced. Setting this to 1000–4000 (rather than 0/unlimited) forces periodic process recycling, which prevents PHP memory leaks from accumulating indefinitely in long-lived processes. Highly recommended on shared hosting servers.

Switching MPM Mode in DirectAdmin via CustomBuild

If you want to switch from Prefork to Event MPM (requires migrating to PHP-FPM first), use DirectAdmin's CustomBuild:

cd /usr/local/directadmin/custombuild
./build apache           # recompile Apache with new MPM
./build php n            # recompile PHP for PHP-FPM if not already done
DirectAdmin CustomBuild ./build options output showing Apache 2.4.41, PHP 7.2 as php-fpm and other build settings
Running ./build options in the CustomBuild directory lists the current Apache version, PHP handler and other build settings.

Before switching MPM, confirm all accounts on the server are using PHP-FPM as their PHP handler in DirectAdmin's user PHP settings. Running mod_php with Event MPM will cause PHP to malfunction.

Monitor After Changes

After tuning, watch Apache's behaviour under load:

# Watch Apache process count live
watch -n2 'ps aux | grep httpd | grep -v grep | wc -l'

# Check if MaxRequestWorkers is being hit
grep "MaxRequestWorkers" /var/log/httpd/error_log | tail -20
# Look for: "server reached MaxRequestWorkers setting"

# Monitor memory usage
free -m
vmstat 2 10    # watch swap column β€” should stay at 0

If you see server reached MaxRequestWorkers in the error log, consider raising the limit (if RAM allows). If swap usage is climbing, lower MaxRequestWorkers to prevent memory pressure.

Tuning Apache MPM settings is one of the highest-impact changes you can make to a DirectAdmin server's performance. For hosting companies managing multiple servers where performance directly affects customer satisfaction and churn, CloudHouse Technologies' server management service handles ongoing performance tuning, monitoring, and capacity planning as part of every managed plan.

Get the Free Linux Server Admin Cheatsheet (PDF)

Essential commands for server management, networking, and troubleshooting β€” all on one printable page.

Running Linux servers? Let us manage them for you.

Our Managed Linux Server plans cover updates, security hardening, monitoring, and 24/7 incident response β€” so your servers stay up and your team stays focused.

  • Proactive OS patching and security updates
  • 24Γ—7 monitoring with instant alerting
  • Backup configuration and disaster recovery
  • Dedicated Linux engineers on call
See Pricing Plans β†’

What our customers say

β€œOur production server went down at 2 AM. CloudHouse had it back online in under 20 minutes. Incredible response time.”

Arun S.

CTO, SaaS Startup

β€œThey migrated our entire infrastructure from Ubuntu 18 to 22 with zero downtime. Couldn't have asked for better.”

Deepak N.

DevOps Lead

Frequently Asked Questions

Event MPM is the best choice for performance on DirectAdmin servers running PHP-FPM. It handles concurrent connections more efficiently than Prefork by using a dedicated thread for keep-alive connections, freeing other threads for new requests. This typically allows 30-50% more concurrent users with the same RAM. If you're using mod_php or suPHP, you must use Prefork MPM as those PHP handlers are not thread-safe.

Need this done for you?

Server Management Service

Managed Linux and Windows servers: monitoring, patching, security and 24/7 support.

Learn more

Book your free 15-minute diagnosis

A certified technician will call you back within 15 minutes during business hours.

Share this article

Leave a Comment

Comments (0)

Loading comments...