Single process memory model for opcache in ZTS
Nessuno ha ancora preso questa issue.
- Lingua principale
- C
- Stelle
- 40.4k
- Fork
- 8.1k
- Merge medio
- 2g 13h
- PR unite (30g)
- 96
Descrizione
Description
In ZTS, all requests run inside the same process, so there's no need for coordination between different processes.
This means that a non-SHM memory model could be used, and a lock file could be replaced by a regular mutex.
This would be beneficial for applications that run exclusively in ZTS and create userland threads, such as PocketMine-MP. PocketMine already uses ZTS and opcache CLI in most places, but it's currently unable to assume opcode caching is always available due to some platforms restricting access to certain lockfile features and SHM, such as Android.
PocketMine has a lot of users who insist on running servers on their mobile devices for some reason, so they'd stand to benefit :)
Since classes and op_arrays in general are non-thread-safe by default, threading extensions benefit a ton from Opcache since Opcache makes op_arrays and many other structures thread-safe by design, so they don't need to be copied. However, because Opcache uses features that are restricted on some platforms - features which are not necessary when running in ZTS mode and creating user threads - the likes of ext-pmmpthread still have to copy-paste large amounts of code from zend_persist.c to provide this functionality if Opcache is not available. If Opcache had a non-SHM memory model that didn't require lockfiles, mmap or any other fancy stuff, this would allow my threading extension to assume Opcache will always be available and caching code, which would potentially allow me to delete an insane amount of code and massively reduce the maintenance burden of the extension.
I don't know if there might be some advantages for ZTS in general (perhaps lower overhead?) but this doesn't seem like a hard change in any case as far as I can understand, so I thought I'd float the suggestion.
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia tracciando il comportamento attuale di Opcache relativo a SHM, lockfile e mmap insieme ai suoi percorsi ZTS; l’issue non indica file o test specifici. Il lavoro sarebbe completato quando fosse disponibile un modello di memoria ZTS non-SHM funzionante che utilizzi mutex regolari, senza il lockfile soggetto a restrizioni né le funzionalità di memoria condivisa, con il comportamento rilevante della piattaforma verificato.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- c, php
- Ambito
- backend, operating-systems
- Tipo di issue
- Funzionalità
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 25/100