increase item max size in memcached?

2019-02-16 13:34发布

i am using memcached on my centos server , my project is large and has objects more than 1MB which i need to save to memcached , well , i can't ! because the max_item_size is 1MB , anyway to edit that ?

Thank you

标签: memcached
3条回答
劫难
2楼-- · 2019-02-16 14:15

If you are using Memcache >= 1.4.2, this is now configurable. Here is an example of how to set this in your init script for starting Memcache on CentOS: http://www.alphadevx.com/a/387-Changing-the-maximum-item-size-allowed-by-Memcache

查看更多
做个烂人
3楼-- · 2019-02-16 14:18

You can compile memcached and change the memory allocation setting to use POWER_BLOCK's, in the slabs.c file (or you can recompile and user malloc/free, but that is the greater of the evils).

http://code.google.com/p/memcached/wiki/FAQ#Why_are_items_limited_to_1_megabyte_in_size?

I would seriously consider what you are caching and how it can be more modular, > 1MB in active memory is large.

查看更多
小情绪 Triste *
4楼-- · 2019-02-16 14:27

You can change the limit quickly by edit the configuration file [/etc/memcached.conf] adding:

# Increase limit 
-I 128M

Or if you have trouble with SO config run it with command line directly

memcached -I 128M
查看更多
登录 后发表回答