single object size limit

Reinis Rozitis roze at roze.lv
Thu Dec 8 13:18:27 UTC 2005


Hello,
is there in memcache a hardcoded limit to single object data size?

The situation is such, we try to set in memcache quite a large
multidimensional array and after some point it fails:

The reproducable code is such:
<?
$mc = new Memcache;
$mc->connect('127.0.0.1', 11211) or die ("Could not connect");

$in = array();
for($i=1;$i<5001;$i++) {
$in[$i] = array("sadfasdf"=>"aaaaa asdfo asdopifa sopdif asdjf klasdhfja
hskldfjh alksjdfh lkadhlkjasdfhoiuq oweiuf oasiudf oiasud foi",
4534=>"asdfjh askljd fhklasjdhf oiasudy foiuas dfoiuasdoif");
}
$mc->set("zzz",$in);
print_r($mc->get("zzz"));
?>
This works fine.
But if we increase the for() cycle from 5001 to lets say 6001 or just add
few data to the array values nothing is set/returned I can't tell the
precise amount of data after which the issue occurs (on 6001
strlen(serialize($in)) is 1246902)
Just seems that the connection is dropped cause I can't get any output also
after the $mc->set from $mc->getStats(); function).

memcached (1.1.12) server is started with: -c 1000 -u root -d -m 500 -p
11211

I have contacted the author of PHP memached pecl extension Antony Dovgal (
http://tony2001.phpclub.net/ ) and he denied that this is problem of the
extension and after looking into my code his reply was:
"With your code server responses "SERVER_ERROR out of memory", so it looks
like some memcached limitation I don't know of..."

How could that be if memcached has free 500Mb?

[pid] => 9170
[uptime] => 54
[time] => 1134044963
[version] => 1.1.12
[rusage_user] => 0.000999
[rusage_system] => 0.009998
[curr_items] => 0
[total_items] => 0
[bytes] => 0
[curr_connections] => 1
[total_connections] => 4
[connection_structures] => 2
[cmd_get] => 0
[cmd_set] => 0
[get_hits] => 0
[get_misses] => 0
[bytes_read] => 2493857
[bytes_written] => 56
[limit_maxbytes] => 524288000


with best regards,
Reinis Rozitis



More information about the memcached mailing list