Opened 9 years ago

Closed 8 years ago

Last modified 8 years ago

#11 closed enhancement (fixed)

implement intelligent purging of cache

Reported by: lapo@… Owned by: moo
Priority: minor Milestone: 1.1
Component: cacher Version: 1.0
Keywords: Cc:
Application: PHP Version:
Other Exts: SAPI:
Probability: Blocked By:
Blocking:

Description (last modified by moo)

Correct me if I'm wrong, but right now XCache doesn't seem to purge old scripts from the cache in any way, so if the memory is not enough to cache them all it works on a "first arrived, first served" basis, and once the cache is full no other scrippt will ever be cache, while maybe there are many script in cache that are only seldom used.
It would be nice to have an intelligent way to purge the cache of "unused" scripts.

Some examples that come to my mind:

  • delete all the scripts that were not used in the last X seconds (just as EA does, not very powerful IMHO)
  • sort the scripts by last use and delete the older 10%
  • use more more complex sorting logic, such as "A*last_use + B*size" with A and B two customizable numeric constants
  • call a PHP hook to let the "reaper logic" be implemented in a script itself: it could receive the cache data and free size needed and return the names or IDs of the scripts to be purged (alternatively it could be added a xcache_ function to purge a single script instead of the entire cache as xcache_clear_cache() does)

Change History (7)

comment:1 Changed 9 years ago by moo

  • Owner changed from somebody to moo
  • Status changed from new to assigned

comment:2 Changed 9 years ago by moo

FYI, it looks like linux can swap mmap data too, same as tmpfs(shmfs), gc checking through swapped entries could slow the whole server down.

comment:3 Changed 8 years ago by moo

  • Priority changed from critical to minor

comment:4 Changed 8 years ago by anonymous

  • Milestone milestone2 deleted

comment:5 Changed 8 years ago by moo

  • Milestone set to 1.1

comment:6 Changed 8 years ago by moo

  • Component changed from component1 to cacher
  • Description modified (diff)

comment:7 Changed 8 years ago by moo

  • Resolution set to fixed
  • Status changed from assigned to closed

fixed in [114], scan on gc_interval, not on OOM. other way is not implemented yet. documenting

Note: See TracTickets for help on using tickets.