httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jean-Jacques Clar" <JJC...@novell.com>
Subject bug between mem_cache and the max heap?
Date Wed, 19 Nov 2003 18:34:58 GMT
The heap in cache_pqueue is a max head, it always keep the object
with the highest priority in its root position. The object with the
highest
priority is the one that is ejected when a new element has to be 
inserted when the cache is full (max nb of entities or size reached).
 
The return value of the set priority functions in mod_mem_cache.c: 
memcache_lru_algorithm(), 
memcache_gdsf_algorithm() 
and the get_priority() function 
have to be consistent to make sure the heap is bubbling and percolating
correctly.
 
Right now set_pri() return a negative value and get_pri() a positive
value.
Because mem_cache increments the priority field based on the number of
request
and the relative time an entity is inserted in the cache, both should
return a negative value,
to use correctly the max heap.
 
The attached patch is a way to fix that problem, not sure if it is the
best. The max heap
could also be turned into a min heap, but it is probably easier to fix
mem_cache. 
 
thanks,
 
Jean-Jacques 
 

Mime
View raw message