nginx-php-fpm Container Performance Comparison - Laravel PHP8/PHP7 Debian/Alpine

(Image source: Photo by Jason Dent on Unsplash)

Over the past few years, I have continued to find some time to sort out the learning, and some of the results will be released as open source. I hope to bring out some ideas, considerations, various discussions and exchanges. It contains PHP, which I have never abandoned. The original design purpose of the container that I have organized this time is to combine php-fpm and nginx to form a simplified environment that can easily enable Laravel to operate in a cloud-native environment, AWS Fargate, Amazon ECS and other environments, to achieve application-first goal. I use it as a base for training, consulting and implementation of several teams, various comparison tests, including future comparisons of x86/ARM computing architectures, and so on.

This article may be updated in the future.



About Comparison

Sorting out this kind of comparative data, from the steps of design environment, implementation, measurement, data collection, sorting, drawing, summary and induction, etc., is full of brainstorming and fun. If there are any points in the content that can be adjusted or improved, or suggest using some other measurement methods, please leave a message or open an issue to me, thank you very much.

In addition, I would like to ask for advice. Are there any tools or methods that allow you to test and collect data in multiple ways, and then integrate them for comparison? I think my single-computer test volume is too small (slow).

Laravel 8.49.1 with PHP 7.4.21 on Different Docker Base Images

  • Test purpose

    • Performance comparison on Laravel 8.49.1 with different Docker base images
  • Test variables

  • Test environment

    • MacBook Pro (13-inch, 2020, Four Thunderbolt 3 ports)
    • CPU 2 GHz Quad-Core Intel Core i5 (x86)
    • Docker-compose container condistions:
      • 1 CPU
      • 512m memory
  • Test pages

    • Default Homepage: Laravel default welcome homepage
  • Test preparation

    • Each test uses a clean container environment to minimize interference during the test.
    • Concurrent 1
    • Duration 60 seconds (1 minute)
  • Test date

    • 2021-0706
  • Test result

    • Container Image Size
    • Test Page: Default Homepage
  • Analysis

    • Comparison between dwchiang/nginx-php-fpm and bitnami/laravel:
    dwchiang/nginx-php-fpmbitnami/laravel
    OS_ARCHlinux/arm64 and linux/amd64only linux/amd64
    OSbusterbitnami/minideb
    Packages flexibility
    HTTP ServernginxPHP’s built-in development server
    PHP Version7.4.217.4.21
    Laravel Version8.49.18.49.1
  • Conclusion

    • Docker image bitnami/laravel (or a container using PHP’s built-in HTTP Server) is suitable for quickly building a development environment on the machine, but not necessarily suitable for use in a production environment.

Laravel 8.19.0 with PHP 8.0/7.4/7.3 on Buster/Alpine 3.12

  • Test purpose
    • Performance comparison on Laravel 8.19.0 with different PHP versions (8.0/7.4/7.3) and different base OS (Buster/Alpine 3.12)
  • Test environment
    • MacBook Pro (13-inch, 2020, Four Thunderbolt 3 ports)
    • CPU 2 GHz Quad-Core Intel Core i5 (x86)
    • Docker-compose container condistions:
      • 1 CPU
      • 512m memory
    • Nginx: 1.18.0
  • Test pages
    • Default Homepage: Laravel default welcome homepage
    • Names: First seed 50 (fake) users into the database (using Docker-compose to bring them up), and then read all users from the database, and display the names of these 50 users on the page. (Note: The route/seed syntax of Laravel 7/8 has been changed.)
  • Test preparation
    • Each test uses a clean container environment to minimize interference during the test.
    • Concurrent 1
    • Duration 60 seconds (1 minute)
  • Test date
    • 2021-0417
  • Test result
    • Container Image Size
    • Test Page: Default Homepage
    • Test Page: Names
Loading comments…