Back to blog
Linux & Servers August 28, 2026

Uptime and Performance Benchmarking for Apache and Nginx Servers

Uptime and Performance Benchmarking for Apache and Nginx Servers

Choosing, configuring, and tuning web servers requires systematic performance evaluations. When scaling HTTP traffic, Apache (using event-driven Multi-Processing Modules) and Nginx (using an asynchronous, event-loop engine) display different saturation and throughput properties.

If connection limits, process threads, or socket queues are misconfigured, spikes in requests lead to connection timeouts or gateway errors. This guide covers how to model web server capacity, configure logging statistics, run benchmarking tools, and execute troubleshooting diagnostics.


1. Availability and Capacity Mathematics

Before tuning your web server configuration files, calculate your target service parameters. We define the monthly HTTP Availability percentage as:

[\text{Availability} = \frac{\text{Total Time} - \text{Unplanned Downtime}}{\text{Total Time}} \cdot 100]

To ensure the web servers can handle traffic surges during peak hours, model your required server capacity ((\text{Required Capacity})) using:

[\text{Required Capacity} \ge \frac{\text{Peak Demand}}{\text{Target Utilization}}]

Where (\text{Peak Demand}) is the maximum expected concurrency (requests per second) and (\text{Target Utilization}) is the maximum allowed CPU/thread usage (typically set to (0.70) or (70%) to maintain safe headroom).


2. Apache vs. Nginx Performance Comparison

Evaluate the architectural and runtime differences between Apache and Nginx when handling high-concurrency requests:

Performance MetricApache HTTP Server (MPM Event)Nginx Web Server (Event-Loop)SRE Operational Focus
Static File ThroughputHighExtremely HighMonitor disk read cache rates and kernel buffers
Concurrent ConnectionsThread-bound limits per workerNon-blocking event loop executionWatch open file descriptors and TCP state limits
Dynamic App HandlingEmbeds runtimes or proxiesStandard reverse proxy patternMeasure backend upstream response times separately
HTTP/2 PerformanceSupported via mod_http2Native multiplexed engineTest concurrency limits on keep-alive timeouts
Worker ExhaustionReaches MaxRequestWorkersExceeds worker_connectionsAudit client packet drops during request queues
Configuration ProfileModular, .htaccess supportHighly optimized, monolithicKeep logic out of virtual hosts to limit CPU cycles

3. Web Server Observability Configuration

Configure metrics endpoints and access logs to expose request transit delays, upstream connection times, and worker saturation:

Apache Status Configuration:

<Location "/server-status">
    SetHandler server-status
    Require local
</Location>

Nginx Stub Status Configuration:

location = /nginx_status {
    stub_status;
    allow 127.0.0.1;
    deny all;
}

Nginx Performance Log Format:

log_format performance
    '$remote_addr "$request" $status '
    'request_time=$request_time '
    'upstream_connect=$upstream_connect_time '
    'upstream_response=$upstream_response_time '
    'bytes=$body_bytes_sent';

access_log /var/log/nginx/access.log performance;

4. Benchmarking and System Diagnostic Commands

Run load tests and inspect network socket states, connection queues, and file descriptor limits using these command line utilities:

# Execute ApacheBench (ab) load tests with 100 concurrency
ab -n 10000 -c 100 https://pingzoapp.com/

# Execute wrk benchmark testing for HTTP/2 performance
wrk -t4 -c200 -d60s https://pingzoapp.com/

# Measure precise HTTP transit timings using curl
curl -sS -o /dev/null \
  -w 'HTTP=%{http_code}\nDNS=%{time_namelookup}s\nConnect=%{time_connect}s\nTLS=%{time_appconnect}s\nTTFB=%{time_starttransfer}s\nTotal=%{time_total}s\n' \
  https://pingzoapp.com/

# Inspect kernel socket states and connection queues
ss -s
ss -tan

[!NOTE] SRE Uptime Tip: Use the SLA Calculator to translate your web server availability percentages into allowed monthly downtime minutes. This helps prioritize scaling tasks before queue backlogs consume your remaining error budgets.


5. Troubleshooting Web Server Bottlenecks

If your web servers encounter performance degradation, high latency, or connection failures under load, execute this step-by-step diagnostic playbook:

  1. Isolate the bottleneck layer: Run curl checks from external regions to determine if the latency originates at the DNS, TCP handshake, TLS negotiation, or server-side application processing layer.
  2. Verify file descriptor limits: Check the system limits to ensure Nginx or Apache workers are not running out of allowed open files:
    cat /proc/sys/fs/file-max
    ulimit -n
    
  3. Confirm listen queue overflows: Check for dropped connection backlogs in the kernel network subsystem:
    sysctl net.core.somaxconn
    
  4. Trace upstream connection latency: Check Nginx access logs to compare $request_time against $upstream_response_time. If the latency is in the upstream values, trace dynamic database queries.
  5. Evaluate Apache scoreboard states: Access the /server-status endpoint to check if workers are exhausted (no idle workers remaining). Adjust MaxRequestWorkers if threads are saturated.
  6. Analyze TCP TIME_WAIT socket metrics: Check if ephemeral ports are exhausted due to high connection rates. Enable TCP connection reuse configurations in sysctl settings.
  7. Isolate compression and SSL overhead: Verify if TLS handshakes or Brotli/Gzip compression are saturating CPU capacity. Use openssl tests to evaluate CPU cycles per handshake:
    openssl s_time -connect pingzoapp.com:443 -new -time 30
    
  8. Audit edge cache validation headers: Inspect Cache-Control settings to prevent edge servers from routing static file queries to origin application pools.
  9. Apply autoscaling adjustments: If CPU or memory utilization reaches critical limits (e.g., (> 85%) sustained), trigger replica scaling actions while tuning keep-alive parameters.
Try Pingzo Free

Know before your users do

Connect official WhatsApp notification channels, Discord webhooks, Telegram bots, and public status pages. Start in 30 seconds.

Create Free Monitor