php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #59818 New Configuration Option: apc.stat_interval
Submitted: 2011-06-16 14:29 UTC Modified: 2016-11-18 21:40 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: znbailey at gmail dot com Assigned:
Status: Wont fix Package: APC (PECL)
PHP Version: 5.3.6 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: znbailey at gmail dot com
New email:
PHP Version: OS:

 

 [2011-06-16 14:29 UTC] znbailey at gmail dot com
Description:
------------
This new feature would establish a middle ground between 
having apc.stat 
enabled and checking mtime of every file every time it is 
loaded versus 
having apc.stat disabled and never checking.

It would add a new configuration option, apc.stat_interval 
that could 
ideally be set to a value such as "30s", "1m", "1h", etc. 
(but could just 
be standardized on a number of seconds like the other TTL 
values).

This interval would specify a "blackout period" after which 
a file is 
stat'ed, it would not be stat'ed again.

Most APC tuning documentation strongly encourages disabling 
apc.stat to 
eek out additional performance. However this makes 
deployment much more 
difficult because it puts the developer in the position of 
having to 
either gracefully restart apache (and warm the cache or re-
introduce 
traffic slowly) or otherwise manage the cache entries 
manually by calling 
apc_compile_file for changed files. By adding this option I 
believe you 
get the best of both worlds - automatic code reloads but not 
doing a stat 
EVERY time a file is accessed.


Patches

lazy_stat.patch (last revision 2013-02-10 12:43 UTC by lazy404 at gmail dot com)

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-06-16 15:01 UTC] stephenreid+php at ratedsar dot com
on apc.h the quick, incomplete,  example is (line 315)

if ( 
 !wrapper->wops->url_stat_interval > 
 apc_time()- time_since_last){
            return -1;
}

Would need : 
-a config variable set up for url_stat_variable. 
(package xml update, loading, etc)
- a persistent variable to keep the last stat time
 [2011-07-11 16:26 UTC] jhansche at myyearbook dot com
Perhaps taking this a step farther, would be to allow an apc_*() function to mark the current file stat cache as "dirty".  So instead of re-stating all files at some interval, it would stat the file when it caches the opcode; later at some point you could call some function (say apc_clear_cache('stat')), and that tells APC "from this point on, don't trust current stat data -- instead, restat the files and recache the new file stat data, evicting the opcode cache if the new file stat shows the file has been modified"

The problem with the stat interval is that if limits you to only receiving updates to the files within "n" minutes/seconds.  But currently the only way to update files in cache when stat is disabled, is by calling apc_clear_cache('system'), which forces *all* opcode entries to be removed.  If you're only modifying a handful of files, that makes the full cache clear unnecessary.
 [2012-07-13 23:41 UTC] spam2 at rhsoft dot net
i recently wrote a feature request and even suggested "apc.stat_interval" while submit notified me about this existing one 

so +1

it would make a HUGE difference under high load even if you set to a low value like "apc.stat_interval = 5" in cases where you have many parallel requests per second 

* overall load would go down
* small bug fixes in scripts would get active in a accetable timeline
* you would not need to reset ALL opcode chaches
 [2013-02-10 12:48 UTC] lazy404 at gmail dot com
You can try this hack in lazy_stat.patch

apc.stat should be set to 0

set apc.lazy_stat_interval to the desired update timeout in seconds (default 30)
 [2016-11-18 21:40 UTC] kalle@php.net
-Status: Open +Status: Wont fix
 [2016-11-18 21:40 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-2020 The PHP Group
All rights reserved.
Last updated: Fri Nov 27 12:01:23 2020 UTC