[PECL-DEV] [memcache/PECL] Performance problems with set & data over 8KB

Mikael Johansson mikael at synd.info
Sun Apr 23 20:33:43 UTC 2006


When the problem occur it's a whole lot slower, more like:

7168 bytes: 8680 set/s
8192 bytes: 25 set/s

When using 32kb the threshold would also be moved to around 32kb and not 8kb 
as with the default chunk size. You might try this script

ini_set('memcache.chunk_size', 32768);

$i = 0;
$d = 1024;
$c1 = 100;
$c2 = 1000;

$key = md5(uniqid(''));
$mmc = memcache_connect('localhost', 11211);

for ($j1=0; $j1<$c1; $j1++, $i+=$d) {
 $value = str_repeat('a', $i);

 list ($m1, $s1) = explode(' ', microtime());
 for ($j2=0; $j2<$c2; $j2++)
  memcache_set($mmc, $key, $value);
 list ($m2, $s2) = explode(' ', microtime());

 $sps = round(1 / ($s2 + $m2 - ($s1 + $m1)) * $c2);
 print "$i bytes: $sps set/s \n";
}

//Mikael

----- Original Message ----- 
From: "Pedram N." <zenstyle at gmail.com>
To: "Mikael Johansson" <mikael at synd.info>; <memcached at lists.danga.com>; 
<pecl-dev at lists.php.net>
Sent: Sunday, April 23, 2006 10:00 PM
Subject: Re: [PECL-DEV] [memcache/PECL] Performance problems with set & data 
over 8KB


When I run the test:

6KB comes up very quick -- 12662 set/s 13269 get/s
7KB comes up very quick -- 12116 set/s 13017 get/s
8KB comes up very slow  --  9810 set/s 11953 get/s
9KB comes up even slower- 10212 set/s -1092 get/s

linux -- php 5.0.4 -- memcache2 w/ memcache.chunk_size = 32768


On 4/23/06, Mikael Johansson <mikael at synd.info> wrote:
> Setting the chunk size > 16k seem to mitigate the problem, I've added an 
> ini
> config directive "memcache.chunk_size" for this purpose. Using
> "memcache.chunk_size = 32768" in php.ini or 
> "ini_set('memcache.chunk_size',
> 32768);" should do the trick.
>
> The changes are in CVS, checking out a copy is as easy as:
>
>  cvs -d :pserver:cvsread at cvs.php.net:/repository login
>  cvs -d :pserver:cvsread at cvs.php.net:/repository co pecl/memcache
>
> Would you mind checking to see that the problem does indeed disappear with
> larger chunk sizes in your environment?
>
> //Mikael
>
> ----- Original Message -----
> From: "Antony Dovgal" <antony at zend.com>
> To: "Mikael Johansson" <mikael at synd.info>
> Cc: "Jean-François Bustarret" <jfbubus at gmail.com>;
> <memcached at lists.danga.com>; <pecl-dev at lists.php.net>
> Sent: Sunday, April 23, 2006 7:53 PM
> Subject: Re: [PECL-DEV] [memcache/PECL] Performance problems with set & 
> data
> over 8KB
>
>
> > Probably this is somehow related to the problem I've met in the past:
> > http://cvs.php.net/viewcvs.cgi/pecl/memcache/memcache.c?r1=1.8&r2=1.9
> >
> > The problem is that two subsequent writes to memcached daemon are MUCH
> > more slower than one writing the same data in one chunk.
> >
> > This was the reason why I had to patch PECL/memcache 2 years ago and 
> > make
> > it write the data and the delimiter ("\r\n") in one call.
> > I don't remember details of the conversation I had with Brad and 
> > Anatoly,
> > but I still don't know the reasons of this behavior.
>
> --
> PECL development discussion Mailing List (http://pecl.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


--




~~~



    This e-mail and any attachment thereto may contain information which
    is confidential and/or protected by intellectual property rights and
    are intended for the sole use of the recipient (s) named above.
    Any use of the information contained herein ( including, but not
    limited to, total or partial reproduction, communication or
    distribution in any form) by other persons than the designated
    recipient (s) is prohibited.
    If  you have received this e-mail in error, please notify the sender
    either by telephone or by e-mail and delete the material from any
    computer. 



More information about the memcached mailing list