Changeset 418 for branches/performance

Show
Ignore:
Timestamp:
10/15/06 08:45:01 (3 years ago)
Author:
sgrimm
Message:

Only reposition items in the LRU queue once a minute. This reduces the number
of memory writes required to handle frequently-accessed items.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/performance/server/items.c

    r415 r418  
    2020#include "memcached.h" 
    2121 
     22/* 
     23 * We only reposition items in the LRU queue if they haven't been repositioned 
     24 * in this many seconds. That saves us from churning on frequently-accessed 
     25 * items. 
     26 */ 
     27#define ITEM_UPDATE_INTERVAL 60 
    2228 
    2329#define LARGEST_ID 255 
     
    217223 
    218224void item_update(item *it) { 
    219     assert((it->it_flags & ITEM_SLABBED) == 0); 
    220  
    221     item_unlink_q(it); 
    222     it->time = current_time; 
    223     item_link_q(it); 
     225    if (it->time < current_time - ITEM_UPDATE_INTERVAL) { 
     226        assert((it->it_flags & ITEM_SLABBED) == 0); 
     227 
     228        item_unlink_q(it); 
     229        it->time = current_time; 
     230        item_link_q(it); 
     231    } 
    224232} 
    225233