php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #59372 include_once doesn't use APC cache
Submitted: 2010-08-18 03:19 UTC Modified: 2012-10-28 21:28 UTC
Votes:3
Avg. Score:5.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:0 (0.0%)
From: mark at netexpo dot nl Assigned:
Status: Not a bug Package: APC (PECL)
PHP Version: 5.3.2 OS: Ubuntu 10.04 AMD64
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
34 - 5 = ?
Subscribe to this entry?

 
 [2010-08-18 03:19 UTC] mark at netexpo dot nl
Description:
------------
I have APC up and running, with apc.include_once_override enabled.

Using strace I see apache open()ing all files that are included using include_once or require_once. This shouldn't be happening as these files are already in the APC cache. APC also reports cache hits for these files, so I wonder why the expensive open() calls are needed. Using include() or require() the files are not open()ed, and as a result include and require are much, much faster.

Disabling apc.include_once_override doesn't change this behaviour.

I use APC 3.1.3p1-2 from the Ubuntu 10.04 repositories.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-11-03 19:24 UTC] pierre dot php at gmail dot com
Please try using 3.1.5
 [2011-09-12 11:34 UTC] gwillem at gmail dot com
I can confirm this problem with version 3.1.9 (clean 
compile). The include_once_override setting has no effect, 
nor has switching between absolute and relative paths. 

Using php-fpm 5.3.6 from Debian.

It would be really cool if it got fixed, because Magento 
makes extensive use of include_once. If you run Magento from 
NFS, this would be a real performance boost on most requests 
(100-800ms).
 [2012-10-28 21:17 UTC] s dot kessler at flyeralarm dot de
Can confirm this too with 3.1.9.
On xcache this seems to work correctly, so it would be nice to have in on apc.

I think the problem is the *once variants opens the files using zend_stream_open 
and zend_compile_file(using filehandle) (in zend_vm_execute.h). instead the 
include/require just make a call to compile_filename. 

The compile_filename is somehow overriden in apc to bypass the opening.
I have no idea why *once is implemented this way, maybe a look at the xcache 
implementation would be helpful.
 [2012-10-28 21:28 UTC] rasmus@php.net
-Status: Feedback +Status: Not a bug
 [2012-10-28 21:28 UTC] rasmus@php.net
Just because you see an open() syscall doesn't mean the cache isn't used. The 
open() is there because PHP by default does open+fstat for performance reasons. 
If you look carefully you will see there is just an open() and no read() calls. 
So it opens the file, uses the stat struct from the open fd to get the inode and 
fetches the op_array from the opcode cache. This can be made more efficient, but 
this report is incorrect in assuming the cache isn't being used.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 12:01:27 2024 UTC