php / php/php-src

Add whitelist support to OPcache

Abierto
#23,335 1 comentario 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Extension: opcache Feature Status: Needs Triage
Lenguaje dominante
C
Estrellas
40.4k
Forks
8.2k
Merge medio
2 d 13 h
PR fusionados (30 d)
96

Descripción

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.

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Comience examinando la configuración existente opcache.blacklist_filename de OPcache y el comportamiento de inicio de PHP-FPM descrito en la propuesta. Determine dónde deben ubicarse la configuración de whitelist y la exclusividad entre blacklist/whitelist; se considera terminado cuando solo se almacenan en caché los archivos incluidos en whitelist y PHP-FPM falla al iniciar cuando ambas configuraciones están configuradas.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
c, php
Área
backend, performance
Tipo de issue
Nueva funcionalidad
Dificultad
5/5
Tiempo estimado
Más de una semana
Estado de actividad
Activo
Claridad
Bastante claro
Aptitud para principiantes
45/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.