RE: [PECL-DEV] APC TTL Patch
| From: | Rasmus Lerdorf | Date: | Mon, 09 Aug 2004 22:12:44 +0000 |
| Subject: | RE: [PECL-DEV] APC TTL Patch | ||
| References: | 1 | Groups: | php.pecl.dev |
| Request: | Send a blank email to pecl-dev+get-1094@lists.php.net to get a copy of this message | ||
On Sat, 7 Aug 2004, Shannon Werb wrote:
> Rasmus, thanks, I think this is an excellent enhancement. In our situtation
> we have hosts with very large number of files, sometimes 10's of thousands.
> In any 24 hour period we can easily cache 1500 files and consume 50MB of
> shared memory. We do an apache graceful each night to roll logs which
> clears the entire cache, but what I was hoping was that APC could look for
> scripts which have not been used in a certain ttl and throw them away when
> out of memory. This should prevent scenerio's where we have a heavier day
> and run out of apc memory and a large number of the scripts in the cache
> have only been accessed a few times the entire day and really don't need to
> be there.
Well, this patch doesn't quite do that. It cleans up as it goes so it
will take longer to fill shared memory, but it doesn't remove the oldest
entries when the cache fills. I am contemplating adding an LRU stack as
well so I can chop off the bottom N% or so when the cache fills up.
> Great, so it checks ttl on every new script insert? Not just when out of
> memory?
It only checks on an insert and on that insert it only checks the specific
hash slot the new entry hashed to. So if your cache is full and you try
to insert a new entry and none of the entries in that specific hash slot
are old, then that insert will fail even though elsewhere in the cache
there may very well be stale entries older than the TTL. That's what the
addition of an LRU stack would address.
> Can I get at this data (access_time) and output it on the APC GUI you provided?
Sure, I added an 'access_time' entry to the cache info. Look for the
$file['mtime'] and simply add another table column to show
$file['access_time'].
> When do you intend to commit to CVS?
I am still fiddling with it and, especially if I add the LRU, this would
be a rather major new feature which might not be appropriate for a minor
version.
-Rasmus