Re: Re: Windows OpCache bug fix
| From: | Dmitry Stogov | Date: | Tue, 06 Oct 2015 07:54:18 +0000 |
| Subject: | Re: Re: Windows OpCache bug fix | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-88692@lists.php.net to get a copy of this message | ||
Hi Eric,
On Mon, Oct 5, 2015 at 9:49 PM, Eric Stenson <ericsten@microsoft.com> wrote:
> >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.
>
Opcache uses the same strategy,.
> 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.
>
Opcahce but don't have a fall-back mechanism in case of inability to remap
SHM into the same address space
> 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.
>
File-cache in opcache is a second level opcode cache. Instead of SHM (or in
addition to SHM) we may store precompiled php scripts on disk.
Thanks. Dmitry.
>
> 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.
>