开发者

What is the limit of number of keys I can multi-get on memcache

So in PHP we can do $memcache->get(array('a','b','c'));

I wonder what is the limit of keys before things break. Can I pass 1000 keys? 10000 keys?

I trie开发者_StackOverflow中文版d to find answer, but can't find anywhere.

Is there someone who have experience in passing large number of keys to do multi-get to memcache?


The Memcached extension supports at least 100,000 keys in a getMulti, given this test:

php > $data = array_map(function($v){ return 'x' . $v; }, range(1, 100000));
php > foreach($data as $d) { $memcached->add($d, $d); }
php > $multi = $memcached->getMulti($data);
php > echo is_array($multi);
1
php > echo count($multi);
100000

I tried to bump it up to a million, but I hit my configured PHP memory limit and promptly decided that if doing a getMulti of one hundred thousand items isn't good enough, you're probably abusing memcached.


There's no hard limit, but there will be different practical limits that will likely end up being application specific.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜