On the cache-server branch: implement a hybrid caching strategy.

Split the cache buffer into two sub-buffers, called "levels" and apply
different insertion / eviction strategies to them.  Insert always into
L1 and make L1 accept all entries small enough to fit into the buffer.
So, there is "perfect" short-term caching.

Data evicted from L1 cyclic buffer will be "promoted" to L2.  Here, we
will only accept entries whose insertion does not cost us more hits
than the item to be inserted already accumulated.  Combined with aging
existing entries, this provides a modified LFU semantics.  Being able
to use past hit counts accumulated in L1, we can now make a much better
guess which items should be cached and which could be dropped.

Note that lookup speed is not affected by the introduction of cache
levels.  Insertion, however, costs about twice as much now.

* subversion/libsvn_subr/cache-membuffer.c
  (): extend global docstring explaining
  (entry_t): update doc strings
  (cache_level_t): new data struct, mostly former svn_membuffer_t members
  (svn_membuffer_t): replace entry chain etc. by 2 cache_level_t instances

  (get_cache_level): new utility method
  (chain_entry,
   unchain_entry): factored out from drop_entry and insert_entry
  (drop_entry,
   insert_entry): call the above;
                  modify the cache level instead of cache struct
  (move_entry): modify the cache level instead of cache struct
  (promote_entry): new utility method

  (ensure_data_insertable): duplicate and rename to ...
  (ensure_data_insertable_l2,
   ensure_data_insertable_l1): ... these; implement specific strategies

  (svn_cache__membuffer_cache_create,
   membuffer_cache_set_internal,
   membuffer_cache_set_partial_internal,
   svn_membuffer_get_segment_info): update


git-svn-id: https://svn.apache.org/repos/asf/subversion/branches/cache-server@1476567 13f79535-47bb-0310-9956-ffa450edef68
1 file changed