php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #59486 apc_compile_file not
Submitted: 2010-10-28 22:51 UTC Modified: 2016-11-18 21:50 UTC
Votes:3
Avg. Score:4.3 ± 0.5
Reproduced:3 of 3 (100.0%)
Same Version:1 (33.3%)
Same OS:0 (0.0%)
From: paul dot moses at solutionsadvancing dot com Assigned:
Status: Wont fix Package: APC (PECL)
PHP Version: 5.3.2 OS: Ubuntu
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: paul dot moses at solutionsadvancing dot com
New email:
PHP Version: OS:

 

 [2010-10-28 22:51 UTC] paul dot moses at solutionsadvancing dot com
Description:
------------
Files loaded with apc_compile_file() do not show up in the system cache entries as receiving any hits.

As the search engines crawl my site it caches all of the site's files.

I have too many files to cache.  It is really inefficient to have all of the files loaded into cache just to have them cleared shortly thereafter.

I have an algorithm that will skip search engine calls and load the rest of the files with apc_compile_file($filename);

The cache report shows that the file is loaded, but does not show that it is getting any hits.

note: Most cache entries made under default caching have *hidden* for the document root path whereas this file shows the entire path.

this is with apc.cache_by_default=Off. and without any filters.

Reproduce code:
---------------
I load a file using apc_compile_file($filename);.

I checked the system cache entries using apc.php and see the file has been loaded.

I surf the page a few times in different browsers and do not see the hit count increase.

The same file loaded by default will show the hits increase.

Expected result:
----------------
Once loaded I expect the file to intercept cache hits and to show as such in the cache report.

Actual result:
--------------
The file shows no cache hits and is assumed to not be functioning for cache.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-10-04 15:11 UTC] tbrown at ctg dot queensu dot ca
Same issue here.  Running PHP 5.2.5 on Solaris 10.

APC was compiled as extension from PECL.

My reason is different, Zend Optimizer is installed on the server and PHP segfaults when cache_by_default is turned on.
 [2012-10-04 15:30 UTC] rasmus@php.net
APC is not compatible with ZendOptimizer
 [2012-10-04 15:35 UTC] tbrown at ctg dot queensu dot ca
I am aware it is not compatible with Zend Optimizer, we need it for one specific PHP product.  The user cache is working fine as long as we have apc.enabled=1 and apc.cache_by_default=0. 

Zend Optimizer should not have been brought up as I believe it is unrelated to the issue. 

My hope was that we could manually compile the set of files requiring caching.  Even without ZO, there is a large set of infrequently accessed files we don't want to have filling up the cache, but do want to be able to specifically cache the known frequently accessed files.

Even testing on another machine without ZO, the APC cache shows these files in the opcode cache, but it never hits them.
 [2012-10-04 15:38 UTC] rasmus@php.net
There is no speed gain from compiling files if you don't put them in shared 
memory. The time is takes to load them from disk and set things up for the 
executor exceeds the time it takes to simply recompile them from source.
 [2012-10-04 15:45 UTC] tbrown at ctg dot queensu dot ca
Isn't that what apc_compile_file() does? Put it in shared memory? 

It shows up under "System Cache Entries" on the apc.php script (exactly as the original report describes).  When apc.cache_by_default is turned on and ZO turned disabled this is where the automatically cached files appear.
 [2012-10-04 15:53 UTC] rasmus@php.net
Sounds like what you really want is apc.filter to specify which files to cache.
 [2012-10-04 17:01 UTC] tbrown at ctg dot queensu dot ca
Sounds like that's going to be what we'll do when we get rid of Zend Optimizer soon.

What is the actual use case for apc_compile_file() if not this? Does cache_by_default need to be on for it to work at all?
 [2012-10-04 17:52 UTC] gopalv@php.net
It is mostly used to warm up cache after a restart - if your code needs six 
hundred classes, the first few requests (especially in parallel) will slow down 
massively or timeout.

So you can throw in a warmup script which can instead compile files without 
running them,

Though I have to wonder now, your problem is a real one - I will try to solve it 
sometime soon.
 [2016-11-18 21:50 UTC] kalle@php.net
-Status: Open +Status: Wont fix
 [2016-11-18 21:50 UTC] kalle@php.net
APC is no longer supported in favor of opcache that comes bundled with PHP, if you wish to use the user cache, then look at PECL/APCu.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 11:01:27 2024 UTC