zoukankan      html  css  js  c++  java
  • memcache的内存管理探微

    slab分配器:http://blog.csdn.net/luotuo44/article/details/42737181

    hash操作  :http://blog.csdn.net/luotuo44/article/details/42773231

    lru操作     :http://blog.csdn.net/luotuo44/article/details/42869325

    配置参数   :http://blog.csdn.net/luotuo44/article/details/42672913

    核心结构体

    typedef struct _stritem {
        struct _stritem *next;
        struct _stritem *prev;
        struct _stritem *h_next;    /* hash chain next */
        rel_time_t      time;       /* least recent access */
        rel_time_t      exptime;    /* expire time */
        int             nbytes;     /* size of data */
        unsigned short  refcount;
        uint8_t         nsuffix;    /* length of flags-and-length string */
        uint8_t         it_flags;   /* ITEM_* above */
        uint8_t         slabs_clsid;/* which slab class we're in */
        uint8_t         nkey;       /* key length, w/terminating null and padding */
        uint64_t        cas_id;     /* the CAS identifier */
        void * end[];
        /* then null-terminated key */
        /* then " flags length
    " (no terminating null) */
        /* then data with terminating 
     (no terminating null; it's binary!) */
    } item;
    
    
    typedef struct {
        unsigned int size;      /* sizes of items */
        unsigned int perslab;   /* how many items per slab */
    
        void **slots;           /* list of item ptrs */
        unsigned int sl_total;  /* size of previous array */
        unsigned int sl_curr;   /* first free slot */
    
        void *end_page_ptr;         /* pointer to next free item at end of page, or 0 */
        unsigned int end_page_free; /* number of items remaining at end of last alloced page */
    
        unsigned int slabs;     /* how many slabs were allocated for this class */
    
        void **slab_list;       /* array of slab pointers */
        unsigned int list_size; /* size of prev array */
    
        unsigned int killing;  /* index+1 of dying slab, or zero if none */
    } slabclass_t;
    

      

  • 相关阅读:
    ssm 在不同的数据库中进行切换(开启事物禁用)
    引入xfire-all.jar后导致sping配置异常
    单点登录cas的最简单使用
    win10下cmd命令不能用
    前端json 两个重要的方法
    maven 工程下第三方jar 包的引入和打包 war
    idea 中main 方法不能运行
    从sqlServer 分页查询谈${}和#{}
    can与could区别
    线程同步与异步区别
  • 原文地址:https://www.cnblogs.com/zhaoyl/p/4238521.html
Copyright © 2011-2022 走看看