memcached-tags: 1.2.8
php-memcached-tags: 2.2.3
OS: Ubuntu 10.04 (any linux will do)
run this php script with apache benchmark from command line like this:
ab2 -n 10000 -w -c 100 http://yourwwwserver.com/script.php > ~/test.html
or older version of ab:
ab -n 10000 -w -c 100 http://yourwwwserver.com/script.php > ~/test.html
try this script and eventually your memcached server will crash with segfault:
<?php
/*
Run this from a command line:
ab2 -n 10000 -w -c 100 http://yourwwwserver.com/script.php > ~/test.html
*/
ini_set('display_errors', 1);
error_reporting(-1);
$start = microtime(true);
$artiklid = array();
$tag = 'at_least_12_symbols'; // must be at least 12 symbols, crashes mostly when exactly 12 symbols
$cacheObj = memcache_connect('localhost', 11211);
$cnt = 0;
if (1 !== $rand = rand(1, 1000))
{
for ($i = 0; $i < rand(1, 20); $i++)
{
$artiklid[] = rand(1, 100000); //maximum must be a high number
}
if ($artiklid)
{
foreach ($artiklid as $key => $val)
{
$cacheObj->set($val, $_SERVER);
$cacheObj->tag_add($tag, array($val)); //must have at least two tags
$cacheObj->tag_add('other_tag_'.rand(1, 500000), array($val)); //second tag must be quite unique
$cnt++;
}
}
}
else
{
$cacheObj->delete($tag); //this is the part that crashes with "segmentation fault" sometimes
}
echo (microtime(true) - $start);
?>