Cloud House Technologies Logo
CloudHouse Technologies
HomeServicesProjectsBlogAbout UsCareersContact UsLogin
    Cloud House Technologies Logo
    CloudHouse Technologies
    HomeServicesProjectsBlogAbout UsCareersContact UsLogin

    How to Tune DirectAdmin Apache MPM Settings for High Concurrent Users

    Priya

    Content Writer & Researcher

    Last Updated: 17 July 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.

    🔧 Book Free DiagnosisCall NowWhatsApp
    🖥️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

    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.

    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...

    Need Help Tuning Your DirectAdmin Server Performance?

    Apache MPM misconfiguration is one of the most common causes of server crashes under load — and one of the easiest to fix with the right guidance. CloudHouse Technologies manages and optimises DirectAdmin servers for hosting companies. Let us handle the performance tuning.

    Call Now — FreeWhatsApp Us

    Why CloudHouse?

    • ISO 27001:2022 certified
    • 12,400+ devices supported
    • 4.9★ on Google
    • Sub-15-minute response

    CloudHouse Technologies

    Innovative cloud solutions for modern businesses. We deliver cutting-edge technology with exceptional service.

    Contact Us

    CloudHouse Technologies Pvt.Ltd
    Special Economic Zone(SEZ),
    Infopark Thirissur,4B-15,
    Indeevaram,Nalukettu Road,
    Koratty, Kerala, India-680308
    0480-27327360
    info@cloudhousetechnologies.com

    Quick Links

    • Our Services
    • Gold Loan Software
    • About Us
    • Contact
    • Terms and Conditions
    • Privacy Policy
    ISO27001:2022
    Certified

    © 2026 CloudHouse Technologies Pvt.Ltd. All rights reserved.

    Back to top