RE: [PHP-DEV] Re: Windows OpCache bug fix
| From: | Eric Stenson | Date: | Mon, 05 Oct 2015 18:49:39 +0000 |
| Subject: | RE: [PHP-DEV] Re: Windows OpCache bug fix | ||
| References: | 1 2 3 4 5 6 7 8 9 10 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-88688@lists.php.net to get a copy of this message | ||
>From: Dmitry Stogov [mailto:dmitry@zend.com]
>
>> On Thu, Oct 1, 2015 at 11:54 AM, Matt Ficken <themattficken@gmail.com>
>> wrote:
>>
>>> Pierre Joy wrote:
>>> And what wincache does. It is slower but the request is served.
>>
>> WinCache (file cache) if it can't reattach, creates a new shared mem
>> file
>
> I'm not sure how WinCache works, but opcache already implements most
> necessary functionality.
Sorry for getting to the party late, but let me clarify what WinCache does:
1. For the opcode cache, if WinCache can't map to the same address, it falls back to using
process-local (heap) memory for the opcode arrays. This is because the elements in the opcode
arrays contain absolute pointers, and we don't want to spend cycles (a) converting all pointers
to offsets when copying opcode arrays into shared memory, and then (b) converting all offsets back
to absolute addresses when copying the opcode array back out of shared memory. WinCache simply gets
the pointer to the opcode array in shared memory and returns it, unmodified, to the PHP Core for
execution.
When WinCache falls back to process-local memory, it does NOT create a second memory mapped segment,
and does not chew additional cross-process resources.
2. WinCache's file cache does not map to an identical address in all processes. We simply map
it to *any* address (using NULL for the suggested address to MapViewOfFileEx), and then use relative
offsets in the cache structures for all entries in shared memory.
3. WinCache's user cache and session cache are similar to the file cache, and do not have to
map to the same address in all processes. Cache entries use relative offsets to locate cache
entries, and the values do not contain absolute addresses.
Finally, For PHP7, WinCache has removed its opcode cache. We assume that Windows consumers of PHP7
will use Zend Opcache for opcode caching.
Thx!
--E.