memcached英文文档学习 (C/C++学习)
发布于 2007-12-04 17:58 1 阅读:66,135 评论:1 标签: Linux memcached 学习 英文

      今天看了memcached wiki的FAQ,觉得有几句话对了解memcached很有作用,与大家共享一下。

      服务器的内存如何分配问题:

以下是引用片段:
Because a 32-bit process can only address 4GB of virtual memory (usually significantly less, depending on your operating system), if you have a 32-bit server with 4-64GB of memory using PAE you can just run multiple processes on the machine, each using 2 or 3GB of memory.

     memcached之get过程,看点在于client/server的hash key处理:

以下是引用片段:
When doing a memcached lookup, first the client hashes the key against the whole list of servers. Once it has chosen a server, the client then sends its request, and the server does an internal hash key lookup for the actual item data.

      client/server的hash key算法差异:

以下是引用片段:
Different client implementations store data into memcached differently (perl Storable, php serialize, java hibernate, JSON, etc). Some clients also implement the hashing algorithm differently. The server is always the same however.

      当一个memcached down后的情况:

以下是引用片段:
 Remove dead nodes from your list. Be very careful! With default clients adding or removing servers will invalidate all of your cache! Since the list of servers to hash against has changed, most of your keys will likely hash to different servers. It's like restarting all of your nodes at the same time.

      key/value大小的说明:

以下是引用片段:
 Keys are restricted to 250 characters. Stored data cannot exceed 1 megabyte in size, since that is the largest typical slab size.

      数据存储的处理方式:

以下是引用片段:
 At first memcached did just use malloc/free for everything. However this does not play very well with OS memory managers. You get fragmentation, and your OS ends up spending more time trying to find contiguous blocks of memory to feed malloc() than it does running the memcached process.

      如何处理数据过期的问题:

以下是引用片段:
 When do expired cached items get deleted from the cache?

 memcached uses a lazy expiration, which means it uses no extra cpu
 expiring items. When an item is requested (a get request) it checks
 the expiration time to see if the item is still valid before returning
 it to the client.

 Similarly when adding a new item to the cache, if the cache is full,
 it will look at for expired items to replace before replacing the
 least used items in the cache.

      尤其是对数据过期的处理让偶意外,虽然省CPU,但很浪费空间。

       下面是几个常用的链接:

以下是引用片段:
 memcached'home
http://danga.com/memcached/

memcached'wiki
http://www.socialtext.net/memcached/index.cgi

memcached'faq
http://www.socialtext.net/memcached/index.cgi?faq

memcached'Protocol
http://code.sixapart.com/svn/memcached/trunk/server/doc/protocol.txt

memcached'consistent hashing
http://www.last.fm/user/RJ/journal/2007/04/10/392555/

展开全文  
收起全文