php / php/php-src

PHP-8.5.0: performance discrepancy in container cold-start

Đang mở
#20,576 10 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Bug Status: Needs Triage
Ngôn ngữ chính
C
Star
40.4k
Fork
8.2k
Merge trung bình
2 ngày 15 giờ
Pull request đã merge (30 ngày)
103

Mô tả

Description

I am currently evaluating the performance of a stock Laravel application within a containerized environment and have observed a noticeable performance difference between PHP 8.4 and PHP 8.5.

Observation
Image

In a direct comparison of cold startup times, the container running on php:8.4-fpm is consistently faster than the one on php:8.5-fpm. My initial benchmarks show the PHP 8.4 container starting up around 300ms faster than the PHP 8.5 container. This is contrary to my expectation that a newer version would yield similar or improved performance.

Request for Input

I would like to understand what might be contributing to this performance gap. Could you provide any insights on the following:

  • Default Configuration Changes: Are there any significant changes to the default php.ini or PHP-FPM configuration values between versions 8.4 and 8.5 that could impact startup performance?
  • Container Image Differences: Are there any known differences in the official php-fpm Docker images for these versions that might explain the slower startup time for PHP 8.5?
  • Known Performance Regressions: Are there any acknowledged performance regressions in PHP 8.5, particularly concerning startup, that the community is aware of? While benchmarks often show similar or slightly improved performance for newer PHP versions, my findings suggest a potential issue in this specific context.

My goal is to ensure we are using the most performant and up-to-date version of PHP. Any guidance or suggestions on where to investigate further would be greatly appreciated.

Thank you for your time and assistance.

Dockerfiles are different just the 8.4 vs 8.5 version

#FROM php:8.5-fpm
FROM php:8.5-fpm AS builder

# Get latest Composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer

# Install system dependencies required by Composer
RUN apt-get update && apt-get install -y git zip unzip libzip-dev && docker-php-ext-install zip

# Set working directory
WORKDIR /var/www/html

# Copy rest of the application source code
COPY . .

# Install Composer dependencies
RUN composer install --no-dev --optimize-autoloader

# ---- Runtime Stage ----
FROM php:8.5-fpm

# Set working directory
WORKDIR /var/www/html

# Copy application files from the builder stage
COPY --from=builder /var/www/html .

# Expose port 8080 and start php-fpm server
EXPOSE 8080
CMD php artisan serve --host=0.0.0.0 --port=8080

The test was made with exact same codebase, exact same requests, in exact same time, region etc.. 100% cold starts, measured in Google Cloud Run platform, using the same official container slow start latency metrics. Results are consistent.

PHP Version
PHP 8.5.0
Operating System

No response

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu bằng cách so sánh các Dockerfile php:8.4-fpm và php:8.5-fpm được nêu cùng với các cấu hình image chính thức, sau đó tái hiện benchmark cold-start trên Google Cloud Run với ứng dụng Laravel. Kiểm tra sự khác biệt giữa PHP-FPM và cấu hình PHP mặc định, đồng thời so sánh kết quả với các request giống hệt nhau. Hoàn thành khi xác định được một khác biệt về cấu hình hoặc image, hoặc xác nhận được hồi quy khởi động có thể tái hiện trong PHP 8.5.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
docker, google-cloud, laravel, php
Lĩnh vực
backend, cloud, performance
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Cần làm rõ
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.