php / php/php-src

Add whitelist support to OPcache

Offen
#23,335 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Extension: opcache Feature Status: Needs Triage
Vorherrschende Sprache
C
Sterne
40.4k
Forks
8.1k
Ø Merge
2 T. 13 Std.
Gemergte PRs (30 T.)
96

Beschreibung

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.

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginnen Sie mit der Untersuchung der vorhandenen opcache.blacklist_filename-Konfiguration von OPcache und des in der Proposal beschriebenen Startverhaltens von PHP-FPM. Bestimmen Sie, wo die whitelist-Konfiguration und die Exklusivität von blacklist/whitelist hingehören; abgeschlossen ist die Arbeit, wenn nur Dateien auf der whitelist gecacht werden und PHP-FPM beim Start fehlschlägt, wenn beide Einstellungen konfiguriert sind.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
c, php
Bereich
backend, performance
Issue-Typ
Feature
Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Aktivitätsstatus
Aktiv
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
45/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.