Speed Tested: Docker + PHP Benchmarks for WordPress on FlyWP

While the death of PHP has been sounded so many times that it has become a running joke, PHP is still a cornerstone of web development. And as PHP remains the backbone of WordPress, it currently powers 43% of the modern web through WordPress. Due to this, there has been an increasing concern for its performance. As such, we at FlyWP believe that it is important for everyone to understand how performative modern PHP is.

In this article, we’ll explore how different PHP versions perform with WordPress, using tools like ApacheBench and Siege to benchmark their impact on speed and efficiency.

Methodology: How We Tested Each PHP Version

This section outlines the tools and testing environment used in our analysis.

Tools and Approach

We will be using tools such as ApacheBench and Siege for load testing and simulating realistic traffic scenarios. Both tools have their own advantages in regard to testing and benchmarking sites, as both of them are flexible command-line tools.

ApacheBench is suitable for measuring requests per second (RPS), latency, and concurrency limits. With this, we can measure these key metrics. Siege simulates realistic traffic scenarios. We’ll track traffic using this.

Testing Environment

Flywp Hetzner Integration

For the sake of fairness, we will be using CCX23 from Hetzner, which has 4 dedicated vCPUs and 16 GB of RAM, as well as automated provisioning for different PHP versions.

  • Tests will be done on PHP 7.4, 8.0, 8.1, 8.2, 8.3, 8.4
  • Each site will be a default WordPress site to avoid any unexpected code
  • With PHP OPCache enabled for all version
  • Optimized PHP configuration for FlyWP
  • Scenarios: Simulated realistic traffic and concurrency limits

Some of the key metrics that we will focus on are:

  • Requests per second (RPS)
  • Transfer rates
  • Total time comparisons
  • TTFB
  • Data throughput
  • Transaction rate

PHP Performance Benchmarks: Key Takeaways from Our Testing

Here are the results we were able to produce through our testing process.

PHP Version Performance

Our latest Docker benchmarks provide a fascinating look into how different PHP versions perform under load. The tests evaluated versions 7.4, 8.0, 8.1, 8.2, 8.3, and 8.4 by measuring metrics such as transactions, transaction rate, response time, and throughput.

  • Requests Per Second (RPS): Performance remains stable across versions, with minor fluctuations. Earlier versions slightly outperform later ones, but differences are negligible, indicating consistent request-handling efficiency.
  • Transfer Rates: Align with RPS trends. Earlier versions show marginally higher throughput (kB/s), while later versions trail slightly.
  • Response Times: Median/mean times improve minimally in some versions, but maximum latency varies little. Recent updates prioritize stability over dramatic speed gains.
PHP Performance Trends: RPS, Transfer Rates, and Response Times

Overall TTFB Performance

In our recent benchmarks, PHP 7.4 offered the quickest initial response, while PHP 8.1 lagged slightly at its slowest points. Despite these differences, the median performance remained consistent across versions, with PHP 8.2, 8.3, and 8.4 delivering balanced and reliable results.

Overall TTFB Performance by PHP Versions

Overall Throughput and Transaction Rate

PHP 8.1 emerged as a strong performer in terms of total transactions, clocking in at 716, while PHP 7.4 and 8.4 were close behind with 708 and 710 transactions, respectively. Notably, PHP 7.4 delivered the highest transaction rate at 74.60, suggesting that it handles concurrent requests efficiently. Meanwhile, PHP 8.0 trailed with only 639 transactions and a transaction rate of 70.61. These results indicate that while PHP 8.0 may offer other improvements, it seems to lag slightly behind the other versions when it comes to raw throughput.

Overall Throughput and Transaction Rate

Response Time Insights

Response times across the board were fairly similar, though PHP 8.0 led the pack with the lowest average response time at 1.18 seconds. This implies that under these test conditions, PHP 8.0 responds to individual requests marginally faster than its peers. However, despite this advantage, its lower overall transaction count suggests a potential trade-off between quick response times and handling a larger number of transactions concurrently.

Response Time Insights

Balancing the Act: Lower Response Time, Higher Throughput

One of the key takeaways is the inherent balance between latency and throughput. A lower response time is beneficial for user experience, but high throughput and transaction rates are critical for scaling. PHP 7.4 and 8.4, for instance, strike a balance by achieving high transaction volumes and strong transaction rates, even if their response times are marginally higher than PHP 8.0.

This also demonstrates that when selecting a PHP version for dockerised applications, the specific performance priorities, whether it’s minimising latency or maximising throughput, should drive your decision.

PHP in Docker Benchmarks for FlyWP: Optimizing WordPress Performance

In summary, PHP 8.0 is fast, but PHP 7.4, 8.1, and 8.4 offer better overall performance for high-transaction applications. Consider factors like features, security, and compatibility when choosing a version for production.

We’ve also compared DigitalOcean, Vultr, Google Cloud, and Hetzner – four popular cloud hosting providers to see which offers the lowest TTFB for FlyWP. Learn more: Which Servers Have the Best TTFB? A Comparison of DigitalOcean, Vultr, Google Cloud, and Hetzner for FlyWP.

Best Practices for Optimizing PHP Applications

Optimizing your PHP application isn’t just about raw speed. It’s about smart configuration, compatibility, and real-world readiness. Below are the best practices we recommend based on our testing and experience.

1. Use the Latest PHP Version

Update Php Version

One of the most effective ways to optimize your PHP application’s performance is to ensure you’re using the latest stable version of PHP. Each PHP release comes with new features, bug fixes, and performance improvements that can significantly enhance the efficiency of your WordPress site. PHP 8+, for instance, introduces several major performance boosts over previous versions, notably with the Just-In-Time (JIT) compiler.

2. Enable OPcache to Reduce Script Recompilation Overhead

By enabling OPcache, PHP stores precompiled bytecode in shared memory, eliminating the need to recompile scripts on every request. This simple tweak can significantly reduce server load and improve response times.

3. Use Siege to Simulate Real-World Traffic and Identify Bottlenecks

Performance under load is what truly matters. Tools like Siege help simulate concurrent users and real-world traffic patterns to reveal hidden bottlenecks before your users encounter them.

4. Keep WordPress Plugins and Laravel Packages Updated

With PHP 8.3 bringing speed and syntax improvements, keeping your dependencies up to date ensures stability, security, and full use of new language features. Outdated plugins or packages can introduce compatibility issues or performance regressions.

5. Profile Your Application Using Xdebug or Blackfire

Blind optimization often wastes effort. Use profilers like Xdebug or Blackfire.io to find real performance hotspots, slow functions, memory leaks, or inefficient loops so you can focus your efforts where it matters most.

6. Use Persistent Caching with Redis or Memcached

Reduce the strain on your database and improve data retrieval times by implementing persistent object caching. Both Redis cache and Memcached integrate seamlessly with Laravel and WordPress to store sessions, query results, and frequently accessed data.

7. Minimize External HTTP Requests on Each Page Load

Third-party APIs or remote assets can slow down page loads. Where possible, cache external data or make asynchronous calls using queues to reduce wait time for end users.

Docker + Latest PHP = Next-Level WordPress Performance

When you combine the power of PHP 8.0, the results speak for themselves. Our benchmarks show that PHP 8.0 delivers the best response times and transaction rates, setting a high standard. However, the latest PHP versions are not that far behind, ensuring that even with minor differences, you benefit from ongoing security enhancements and powerful stability.

Additionally, tools like Apache Benchmark and Siege help validate these results, simulating real-world traffic and confirming the tangible benefits of containerized optimizations. If you’re aiming for a high-performance, scalable WordPress stack, this combination is tough to beat.

Add your first comment to this post