php / php/php-src

Add whitelist support to OPcache

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

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

Extension: opcache Feature Status: Needs Triage
Ngôn ngữ chính
C
Star
40.4k
Fork
8.1k
Merge trung bình
2 ngày 13 giờ
Pull request đã merge (30 ngày)
96

Mô tả

Description

OPcache currently supports excluding files using opcache.blacklist_filename. This works well when the number of files to exclude is small.

However, in a multi-tenant application, the opposite can be true. There may be a large number of tenant-specific files that should not be cached, while only a small set of common application files should be cached.

For example, instead of maintaining:

/var/www/tenant-a/*
/var/www/tenant-b/*
/var/www/tenant-c/*
...

it would be useful to define the files that are allowed to be cached:

opcache.whitelist_filename=/path/to/whitelist

with:

/var/www/app/src/*
/var/www/app/vendor/*

The behavior would simply be the inverse of the blacklist: when a whitelist is configured, only matching files are cached.

I think blacklist and whitelist should be mutually exclusive, with PHP-FPM failing at startup if both are configured.

This would be particularly useful for applications where the set of files that should be cached is small and well-defined, while the set of files to exclude is large or dynamic.

I'm happy to implement this and open a PR if this proposal makes sense.

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 việc kiểm tra cấu hình opcache.blacklist_filename hiện có của OPcache và hành vi khởi động PHP-FPM được mô tả trong đề xuất. Xác định cấu hình whitelist và tính loại trừ lẫn nhau giữa blacklist/whitelist thuộc về đâu; hoàn tất có nghĩa là chỉ các tệp nằm trong whitelist được lưu vào bộ nhớ đệm và PHP-FPM không khởi động được khi cả hai thiết lập đều được cấu hình.

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

Đánh giá

Công nghệ
c, php
Lĩnh vực
backend, performance
Loại issue
Tính năng
Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức độ hoạt động
Sôi nổi
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
45/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.