Changeset 645

Show
Ignore:
Timestamp:
11/19/07 00:15:18 (1 year ago)
Author:
dormando
Message:

Reduce mutex contention in get command for multiple keys. (Tomash Brechko)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/server/memcached.c

    r643 r645  
    11031103    token_t *key_token = &tokens[KEY_TOKEN]; 
    11041104    char suffix[255]; 
     1105    int stats_get_cmds   = 0; 
     1106    int stats_get_hits   = 0; 
     1107    int stats_get_misses = 0; 
    11051108    assert(c != NULL); 
    11061109 
     
    11251128 
    11261129            if(nkey > KEY_MAX_LENGTH) { 
     1130                STATS_LOCK(); 
     1131                stats.get_cmds   += stats_get_cmds; 
     1132                stats.get_hits   += stats_get_hits; 
     1133                stats.get_misses += stats_get_misses; 
     1134                STATS_UNLOCK(); 
    11271135                out_string(c, "CLIENT_ERROR bad command line format"); 
    11281136                return; 
    11291137            } 
    11301138 
    1131             STATS_LOCK(); 
    1132             stats.get_cmds++; 
    1133             STATS_UNLOCK(); 
     1139            stats_get_cmds++; 
    11341140            it = item_get(key, nkey); 
    11351141            if (settings.detail_enabled) { 
     
    11801186 
    11811187                /* item_get() has incremented it->refcount for us */ 
    1182                 STATS_LOCK(); 
    1183                 stats.get_hits++; 
    1184                 STATS_UNLOCK(); 
     1188                stats_get_hits++; 
    11851189                item_update(it); 
    11861190                *(c->ilist + i) = it; 
     
    11881192 
    11891193            } else { 
    1190                 STATS_LOCK(); 
    1191                 stats.get_misses++; 
    1192                 STATS_UNLOCK(); 
     1194                stats_get_misses++; 
    11931195            } 
    11941196 
     
    12261228        c->msgcurr = 0; 
    12271229    } 
     1230 
     1231    STATS_LOCK(); 
     1232    stats.get_cmds   += stats_get_cmds; 
     1233    stats.get_hits   += stats_get_hits; 
     1234    stats.get_misses += stats_get_misses; 
     1235    STATS_UNLOCK(); 
     1236 
    12281237    return; 
    12291238}