rfc:opcache.no_cache

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
rfc:opcache.no_cache [2020/05/31 16:09] – Add "If you voted no, why?" section tandrerfc:opcache.no_cache [2020/06/13 15:05] – add note on opcache tandre
Line 3: Line 3:
   * Date: 2020-05-16   * Date: 2020-05-16
   * Author: Tyson Andre <tandre@php.net>   * Author: Tyson Andre <tandre@php.net>
-  * Status: Voting+  * Status: Declined
   * Implementation: https://github.com/php/php-src/pull/5504   * Implementation: https://github.com/php/php-src/pull/5504
   * First Published at: https://wiki.php.net/rfc/opcache.no_cache   * First Published at: https://wiki.php.net/rfc/opcache.no_cache
Line 113: Line 113:
 Voting started on May 30th and ends on June 13th Voting started on May 30th and ends on June 13th
  
-<doodle title="Add opcache.allow_cache ini setting to support opcode optimization without caching" auth="tandre" voteType="single" closed="false">+<doodle title="Add opcache.allow_cache ini setting to support opcode optimization without caching" auth="tandre" voteType="single" closed="true">
    * Yes    * Yes
    * No    * No
Line 119: Line 119:
  
 ==== If you voted no, why? ==== ==== If you voted no, why? ====
 +
 +The [[https://wiki.php.net/rfc/opcache.no_cache#discussion|Discussion]] section mentioned alternative approaches to this RFC. This feedback is being gathered if it may be useful for other work on Opcache such as moving optimizations into PHP's core.
  
   - I would only vote for optimizations without caching if Opcache's opcode optimizations were moved into core first.   - I would only vote for optimizations without caching if Opcache's opcode optimizations were moved into core first.
Line 125: Line 127:
   - Other   - Other
  
-<doodle title="If you voted no on opcache.allow_cache, why?" auth="tandre" voteType="multi" closed="false">+<doodle title="If you voted no on opcache.allow_cache, why?" auth="tandre" voteType="multi" closed="true">
    * 1    * 1
    * 2    * 2
    * 3    * 3
    * 4    * 4
 +</doodle>
 +
 +Also, would you be interested in moving opcode optimizations and the JIT out of the zend_extension opcache into PHP's core?
 +
 +<doodle title="I would be interested in moving opcode optimizations into core" auth="tandre" voteType="single" closed="true">
 +   * Yes
 +   * No
 </doodle> </doodle>
  
Line 135: Line 144:
  
 0.2: Previously, the ini setting override to disable caching was ''opcache.no_cache=1''. This was changed to ''opcache.allow_cache=0'' to avoid double negatives and to be consistent with naming of other ini settings such as ''allow_url_fopen'' and ''allow_url_include''. 0.2: Previously, the ini setting override to disable caching was ''opcache.no_cache=1''. This was changed to ''opcache.allow_cache=0'' to avoid double negatives and to be consistent with naming of other ini settings such as ''allow_url_fopen'' and ''allow_url_include''.
 +
 0.3: Fix documentation of changes to ''opcache_get_status()'' 0.3: Fix documentation of changes to ''opcache_get_status()''
 +
 0.4: Improve documentation of ini settings, add another example use case. 0.4: Improve documentation of ini settings, add another example use case.
 +
 +===== Ideas on moving the optimizer into core instead =====
 +
 +There are various ways the suggestion in [[https://wiki.php.net/rfc/opcache.no_cache#discussion|Discussion]] could be implemented. My ideas on a way that could be implemented are below (I'm not familiar enough with opcache to implement that or to be aware of any problems it would cause):
 +
 +  * Move the optimizer into core (e.g. move code related to opcode optimizations from ''ext/opcache'' to a new folder ''ext/optimizer'' loaded before opcache). Keep all of the functionality related to caching in the zend_extension Zend Opcache (some build environments may not support or have a use case for any forms of shared memory caching).
 +  * Continue optimizing according to ''opcache.enable'' and ''opcache.enable_cli'' when the opcode caching is enabled. \\ Add a new flag such as ''optimizer.always_optimize=1'' or ''opcache.always_optimize=1'' which will ignore that and unconditionally optimize using the optimization passes in ''opcache.optimization_level''. This would ensure that existing use cases work without modifying ''php.ini'' and won't suffer from high startup time for short-lived processes which don't have opcodes cached.
 +  * Provide C function pointers to lock shared memory and acquire pointer locations so that the JIT can emit executable code without conflicting with other processes/threads, and make opcache override those function pointers. I'm not sure how protecting memory with opcache jit without the opcache extension managing shared memory would work with threaded php and no shared cache, but should be possible - I assume the JIT already works with ''opcache.file_cache_only''. I'm also unfamiliar with how those pointers/mutexes would get released if php crashed.
 +  * Limit ''opcache.preload'' to only be used when the opcode caching zend_extension is used.
  
 ===== References ===== ===== References =====
rfc/opcache.no_cache.txt · Last modified: 2020/06/13 17:45 by tandre