Re: Memcached set is too slow

2010-03-01 Thread Matt Ingenthron

Chaosty wrote:

It runs on the same server, php memcached connects by 127.0.0.1 to it.

it close but not the same. i did kill and run clean memcached server,
each time it was close to 0.1 sec.
  


In that case, I totally agree this is suspicious. 

Just to toss out another idea, it sounds like maybe the library/code 
checking the response time doesn't have enough resolution, and it's 
rounding up.  1/10th of a second is an odd place to stop resolution to 
though.  Bad multiplying or rounding?


I've seen people claim lots of 1ms responses when it turned out all of 
the responses were in microseconds, they just didn't have enough resolution.



I will do strace for memcached later and post the results.

On Mar 2, 3:50 am, dormando  wrote:
  

What about memcached? Is it running on localhost or over the network?

Any chance you could get an strace from the memcached side? Have your test
app talk to a separate test instance or something.

Is it exactly or close to 0.10s each time? That's suspicious.







Re: Memcached set is too slow

2010-03-01 Thread Chaosty
i would agree but trace shows delay:
this one by truss (freebsd strace)
76982: 2.532011750 0.099864927 poll({9/POLLIN},1,-1) = 1 (0x1)  it
tooks 0.099seconds

and this one by strace
0.61 [28b09d6f] poll([{fd=574240058, events=POLLIN|POLLPRI|
POLLRDNORM|POLLWRBAND|POLLERR|POLLNVAL|0x6000}], 1, INFTIM) = 1
([{fd=1933255265, revents=POLLIN|POLLPRI|POLLOUT|POLLHUP|POLLNVAL|
0x3a00}]) <0.098976>
also ~0.09 seconds.

both freezes on pool

On Mar 2, 4:27 am, Matt Ingenthron  wrote:
> Chaosty wrote:
> > It runs on the same server, php memcached connects by 127.0.0.1 to it.
>
> > it close but not the same. i did kill and run clean memcached server,
> > each time it was close to 0.1 sec.
>
> In that case, I totally agree this is suspicious.
>
> Just to toss out another idea, it sounds like maybe the library/code
> checking the response time doesn't have enough resolution, and it's
> rounding up.  1/10th of a second is an odd place to stop resolution to
> though.  Bad multiplying or rounding?
>
> I've seen people claim lots of 1ms responses when it turned out all of
> the responses were in microseconds, they just didn't have enough resolution.
>
>
>
> > I will do strace for memcached later and post the results.
>
> > On Mar 2, 3:50 am, dormando  wrote:
>
> >> What about memcached? Is it running on localhost or over the network?
>
> >> Any chance you could get an strace from the memcached side? Have your test
> >> app talk to a separate test instance or something.
>
> >> Is it exactly or close to 0.10s each time? That's suspicious.


integrity of memcached cluster

2010-03-01 Thread Jumping
Hi,

How to check the integrity of memcached cluster ? If not complete, we can
add the lack immediately.

Best Regards,
Jumping Qu

--
Don't tell me how many enemies we have, but where they are!
(ADV:Perl -- It's like Java, only it lets you deliver on time and under
budget.)


Re: Memcached set is too slow

2010-03-01 Thread Chaosty
The tests were performed by modifying the set method like this:

public static function set($key, $item, $exp = 60) {
$benchmark = Profiler::start ('Memory', 'Set: '. $key);
$return = self::$instance->set ($key, $item, $exp);
Profiler::stop ($benchmark);
return $return;
}

Then I figured out that almost each set is cost to us ~0.79
seconds
but the big key costs ~0.099359 seconds

this is trace info with: truss -faedD -o /phplog
...
76982: 2.431621337 0.14247 gettimeofday({1267456195.261569 },0x0)
= 0 (0x0)
76982: 2.431709896 0.14806 gettimeofday({1267456195.261658 },0x0)
= 0 (0x0)
76982: 2.431964677 0.45257 write(9,"set
b5e03d478da6b7b8e61095fec4eb"...,8196) = 8196 (0x2004)
76982: 2.432037871 0.17600 write(9,"pr.parent_id = p.parent_id
(1)";"...,1360) = 1360 (0x550)
76982: 2.432097655 0.15644 read(9,0x2aedb054,8196) ERR#35
'Resource temporarily unavailable'
76982: 2.532011750 0.099864927 poll({9/POLLIN},1,-1) = 1 (0x1)
76982: 2.532070696 0.16482 read(9,"STORED\r\n",8196) = 8 (0x8)
76982: 2.532135509 0.14248 gettimeofday({1267456195.362084 },0x0)
= 0 (0x0)
...
seems here's the problem: 76982: 2.532011750 0.099864927 poll({9/
POLLIN},1,-1) = 1 (0x1)

On Feb 28, 3:41 am, dormando  wrote:
> How are you performing the test? Is memcached over localhost or over the
> network?
>
> If you can reproduce this in isolation I'd be curious to see what
> memcached and/or php are waiting on that takes so long (via strace or
> similar).
>
> On Wed, 24 Feb 2010, me from wrote:
> > Adam we are on freebsd 7.2, as i said early we use PECL memcached 1.0.0 
> > with libmemcached 0.35, the memcached version is 1.4.4.
>
> > We use our framework this is an init method
>
> > ��� public static function instance() {
> > ��� ��� if (self::$instance === NULL) {
> > ��� ��� ��� // Create a new instance
> > ��� ��� ��� self::$instance = new Memcached ();
> > ��� ��� ��� self::$instance->setOption 
> > (Memcached::OPT_DISTRIBUTION, Memcached::DISTRIBUTION_CONSISTENT);
> > ��� ��� ��� self::$instance->addServers (array (array 
> > ('127.0.0.1', 11211, 100)));
> > ��� ��� }
> > ��� }
>
> > and this is a set method that works fine with small data and stops with 
> > data > 100kbs
>
> > ��� public static function set($key, $item, $exp = 60) {
> > ��� ��� return self::$instance->set ($key, $item, $exp);
> > ��� }
>
> > Marc, no we don't use persistent you can see it in our init method.
>
> > On Wed, Feb 24, 2010 at 8:47 PM, Marc Bollinger  
> > wrote:
> >       And are you using persistent connections? There have been a handful of
> >       threads recently, discussing setting up persistent connections with
> >       PECL::memcached.
>
> >       - Marc
>
> > On Wed, Feb 24, 2010 at 9:41 AM, Adam Lee  wrote:
> > > What kind of hardware and software configurations are you using on the
> > > client and server sides?
> > > We have servers doing like 5M/s in and 10M/s out without even breaking a
> > > sweat...
>
> > > On Wed, Feb 24, 2010 at 7:35 AM, me from  wrote:
>
> > >> We use memcached php extension, (http://pecl.php.net/package/memcached)
>
> > >> On Wed, Feb 24, 2010 at 12:02 PM, Juri Bracchi  wrote:
>
> > >>> the latest memcache php extension version is 2.2.5
>
> > >>>http://pecl.php.net/package/memcache
>
> > >>> On Wed, 24 Feb 2010 05:09:36 +0300, me from wrote:
> > >>> > No. Sorry for misunderstanding, its my bad. Its php extension (PECL)
> > >>> > of version 1.0.0.
>
> > >>> > Memcached is 1.4.4
>
> > >>> > On Wed, Feb 24, 2010 at 4:42 AM, Eric Lambert
> > >>> >  wrote:
>
> > >>> >>> PHP5.3, libmemcached 0.35, memcached 1.0.0
>
> > >>> >> Is this really the version of the memcached server you are using
> > >>> >> (1.0.0) If so, that is certainly out-of-date. Latest version is
> > >>> >> 1.4.*.
>
> > >>> >> Eric
>
> > >>> >> Chaosty wrote:
> > >>> >>> We have found that Memcahed::set stores items around 100-200kbs for
> > >>> >>> 0.10-0.11 seconds, its too slow. Compression is turned off. Any
> > >>> >>> suggestions?
>
> > >>> >>> PHP5.3, libmemcached 0.35, memcached 1.0.0
>
> > > --
> > > awl


Re: Memcached set is too slow

2010-03-01 Thread Chaosty
And here is strace
...
 0.85 [28b4f1ab] gettimeofday({1667458660, 1681273911}, NULL)
= 0 <0.13>
 0.000202 [28b5f2a3] write(9, "set
b5e03d478da6b7b8e61095fec4eb0"..., 8196) = 8196 <0.38>
 0.91 [28b5f2a3] write(9, "pr.parent_id = p.parent_id
(1)\";s"..., 1360) = 1360 <0.23>
 0.78 [28b5f2c3] read(9, 0x2aef6054, 8196) = -1 EAGAIN
(Resource temporarily unavailable) <0.14>
 0.61 [28b09d6f] poll([{fd=574240058, events=POLLIN|POLLPRI|
POLLRDNORM|POLLWRBAND|POLLERR|POLLNVAL|0x6000}], 1, INFTIM) = 1
([{fd=1933255265, revent$
 0.099064 [28b5f2c3] read(9, "STORED\r\n"..., 8196) = 8 <0.18>
 0.90 [28b4f1ab] gettimeofday({875772260, 912536929}, NULL) =
0 <0.13>
 ...

by strace read took almost 0.10 seconds..

On Mar 1, 6:13 pm, Chaosty  wrote:
> The tests were performed by modifying the set method like this:
>
>         public static function set($key, $item, $exp = 60) {
>                 $benchmark = Profiler::start ('Memory', 'Set: '. $key);
>                 $return = self::$instance->set ($key, $item, $exp);
>                 Profiler::stop ($benchmark);
>                 return $return;
>         }
>
> Then I figured out that almost each set is cost to us ~0.79
> seconds
> but the big key costs ~0.099359 seconds
>
> this is trace info with: truss -faedD -o /phplog
> ...
> 76982: 2.431621337 0.14247 gettimeofday({1267456195.261569 },0x0)
> = 0 (0x0)
> 76982: 2.431709896 0.14806 gettimeofday({1267456195.261658 },0x0)
> = 0 (0x0)
> 76982: 2.431964677 0.45257 write(9,"set
> b5e03d478da6b7b8e61095fec4eb"...,8196) = 8196 (0x2004)
> 76982: 2.432037871 0.17600 write(9,"pr.parent_id = p.parent_id
> (1)";"...,1360) = 1360 (0x550)
> 76982: 2.432097655 0.15644 read(9,0x2aedb054,8196) ERR#35
> 'Resource temporarily unavailable'
> 76982: 2.532011750 0.099864927 poll({9/POLLIN},1,-1) = 1 (0x1)
> 76982: 2.532070696 0.16482 read(9,"STORED\r\n",8196) = 8 (0x8)
> 76982: 2.532135509 0.14248 gettimeofday({1267456195.362084 },0x0)
> = 0 (0x0)
> ...
> seems here's the problem: 76982: 2.532011750 0.099864927 poll({9/
> POLLIN},1,-1) = 1 (0x1)
>
> On Feb 28, 3:41 am, dormando  wrote:
>
> > How are you performing the test? Is memcached over localhost or over the
> > network?
>
> > If you can reproduce this in isolation I'd be curious to see what
> > memcached and/or php are waiting on that takes so long (via strace or
> > similar).
>
> > On Wed, 24 Feb 2010, me from wrote:
> > > Adam we are on freebsd 7.2, as i said early we use PECL memcached 1.0.0 
> > > with libmemcached 0.35, the memcached version is 1.4.4.
>
> > > We use our framework this is an init method
>
> > > ��� public static function instance() {
> > > ��� ��� if (self::$instance === NULL) {
> > > ��� ��� ��� // Create a new instance
> > > ��� ��� ��� self::$instance = new Memcached ();
> > > ��� ��� ��� self::$instance->setOption 
> > > (Memcached::OPT_DISTRIBUTION, Memcached::DISTRIBUTION_CONSISTENT);
> > > ��� ��� ��� self::$instance->addServers (array (array 
> > > ('127.0.0.1', 11211, 100)));
> > > ��� ��� }
> > > ��� }
>
> > > and this is a set method that works fine with small data and stops with 
> > > data > 100kbs
>
> > > ��� public static function set($key, $item, $exp = 60) {
> > > ��� ��� return self::$instance->set ($key, $item, $exp);
> > > ��� }
>
> > > Marc, no we don't use persistent you can see it in our init method.
>
> > > On Wed, Feb 24, 2010 at 8:47 PM, Marc Bollinger  
> > > wrote:
> > >       And are you using persistent connections? There have been a handful 
> > > of
> > >       threads recently, discussing setting up persistent connections with
> > >       PECL::memcached.
>
> > >       - Marc
>
> > > On Wed, Feb 24, 2010 at 9:41 AM, Adam Lee  wrote:
> > > > What kind of hardware and software configurations are you using on the
> > > > client and server sides?
> > > > We have servers doing like 5M/s in and 10M/s out without even breaking a
> > > > sweat...
>
> > > > On Wed, Feb 24, 2010 at 7:35 AM, me from  wrote:
>
> > > >> We use memcached php extension, (http://pecl.php.net/package/memcached)
>
> > > >> On Wed, Feb 24, 2010 at 12:02 PM, Juri Bracchi  
> > > >> wrote:
>
> > > >>> the latest memcache php extension version is 2.2.5
>
> > > >>>http://pecl.php.net/package/memcache
>
> > > >>> On Wed, 24 Feb 2010 05:09:36 +0300, me from wrote:
> > > >>> > No. Sorry for misunderstanding, its my bad. Its php extension (PECL)
> > > >>> > of version 1.0.0.
>
> > > >>> > Memcached is 1.4.4
>
> > > >>> > On Wed, Feb 24, 2010 at 4:42 AM, Eric Lambert
> > > >>> >  wrote:
>
> > > >>> >>> PHP5.3, libmemcached 0.35, memcached 1.0.0
>
> > > >>> >> Is this really the version of the memcached server you are using
> > > >>> >> (1.0.0) If so, that is certainly out-of-date. Latest version is
> > > >>> >> 1.4.*.
>
> > > >>> >> Eric
>
> > >

Re: Memcached set is too slow

2010-03-01 Thread Chaosty
sorry my bad full strace is:
 0.85 [28b4f1ab] gettimeofday({1667458660, 1681273911}, NULL)
= 0 <0.13>
 0.000202 [28b5f2a3] write(9, "set
b5e03d478da6b7b8e61095fec4eb0"..., 8196) = 8196 <0.38>
 0.91 [28b5f2a3] write(9, "pr.parent_id = p.parent_id
(1)\";s"..., 1360) = 1360 <0.23>
 0.78 [28b5f2c3] read(9, 0x2aef6054, 8196) = -1 EAGAIN
(Resource temporarily unavailable) <0.14>
 0.61 [28b09d6f] poll([{fd=574240058, events=POLLIN|POLLPRI|
POLLRDNORM|POLLWRBAND|POLLERR|POLLNVAL|0x6000}], 1, INFTIM) = 1
([{fd=1933255265, revents=POLLIN|POLLPRI|POLLOUT|POLLHUP|POLLNVAL|
0x3a00}]) <0.098976>
 0.099064 [28b5f2c3] read(9, "STORED\r\n"..., 8196) = 8 <0.18>
 0.90 [28b4f1ab] gettimeofday({875772260, 912536929}, NULL) =
0 <0.13>


On Mar 1, 6:24 pm, Chaosty  wrote:
> And here is strace
> ...
>      0.85 [28b4f1ab] gettimeofday({1667458660, 1681273911}, NULL)
> = 0 <0.13>
>      0.000202 [28b5f2a3] write(9, "set
> b5e03d478da6b7b8e61095fec4eb0"..., 8196) = 8196 <0.38>
>      0.91 [28b5f2a3] write(9, "pr.parent_id = p.parent_id
> (1)\";s"..., 1360) = 1360 <0.23>
>      0.78 [28b5f2c3] read(9, 0x2aef6054, 8196) = -1 EAGAIN
> (Resource temporarily unavailable) <0.14>
>      0.61 [28b09d6f] poll([{fd=574240058, events=POLLIN|POLLPRI|
> POLLRDNORM|POLLWRBAND|POLLERR|POLLNVAL|0x6000}], 1, INFTIM) = 1
> ([{fd=1933255265, revent$
>      0.099064 [28b5f2c3] read(9, "STORED\r\n"..., 8196) = 8 <0.18>
>      0.90 [28b4f1ab] gettimeofday({875772260, 912536929}, NULL) =
> 0 <0.13>
>  ...
>
> by strace read took almost 0.10 seconds..
>
> On Mar 1, 6:13 pm, Chaosty  wrote:
>
> > The tests were performed by modifying the set method like this:
>
> >         public static function set($key, $item, $exp = 60) {
> >                 $benchmark = Profiler::start ('Memory', 'Set: '. $key);
> >                 $return = self::$instance->set ($key, $item, $exp);
> >                 Profiler::stop ($benchmark);
> >                 return $return;
> >         }
>
> > Then I figured out that almost each set is cost to us ~0.79
> > seconds
> > but the big key costs ~0.099359 seconds
>
> > this is trace info with: truss -faedD -o /phplog
> > ...
> > 76982: 2.431621337 0.14247 gettimeofday({1267456195.261569 },0x0)
> > = 0 (0x0)
> > 76982: 2.431709896 0.14806 gettimeofday({1267456195.261658 },0x0)
> > = 0 (0x0)
> > 76982: 2.431964677 0.45257 write(9,"set
> > b5e03d478da6b7b8e61095fec4eb"...,8196) = 8196 (0x2004)
> > 76982: 2.432037871 0.17600 write(9,"pr.parent_id = p.parent_id
> > (1)";"...,1360) = 1360 (0x550)
> > 76982: 2.432097655 0.15644 read(9,0x2aedb054,8196) ERR#35
> > 'Resource temporarily unavailable'
> > 76982: 2.532011750 0.099864927 poll({9/POLLIN},1,-1) = 1 (0x1)
> > 76982: 2.532070696 0.16482 read(9,"STORED\r\n",8196) = 8 (0x8)
> > 76982: 2.532135509 0.14248 gettimeofday({1267456195.362084 },0x0)
> > = 0 (0x0)
> > ...
> > seems here's the problem: 76982: 2.532011750 0.099864927 poll({9/
> > POLLIN},1,-1) = 1 (0x1)
>
> > On Feb 28, 3:41 am, dormando  wrote:
>
> > > How are you performing the test? Is memcached over localhost or over the
> > > network?
>
> > > If you can reproduce this in isolation I'd be curious to see what
> > > memcached and/or php are waiting on that takes so long (via strace or
> > > similar).
>
> > > On Wed, 24 Feb 2010, me from wrote:
> > > > Adam we are on freebsd 7.2, as i said early we use PECL memcached 1.0.0 
> > > > with libmemcached 0.35, the memcached version is 1.4.4.
>
> > > > We use our framework this is an init method
>
> > > > ��� public static function instance() {
> > > > ��� ��� if (self::$instance === NULL) {
> > > > ��� ��� ��� // Create a new instance
> > > > ��� ��� ��� self::$instance = new Memcached ();
> > > > ��� ��� ��� self::$instance->setOption 
> > > > (Memcached::OPT_DISTRIBUTION, Memcached::DISTRIBUTION_CONSISTENT);
> > > > ��� ��� ��� self::$instance->addServers (array (array 
> > > > ('127.0.0.1', 11211, 100)));
> > > > ��� ��� }
> > > > ��� }
>
> > > > and this is a set method that works fine with small data and stops with 
> > > > data > 100kbs
>
> > > > ��� public static function set($key, $item, $exp = 60) {
> > > > ��� ��� return self::$instance->set ($key, $item, $exp);
> > > > ��� }
>
> > > > Marc, no we don't use persistent you can see it in our init method.
>
> > > > On Wed, Feb 24, 2010 at 8:47 PM, Marc Bollinger  
> > > > wrote:
> > > >       And are you using persistent connections? There have been a 
> > > > handful of
> > > >       threads recently, discussing setting up persistent connections 
> > > > with
> > > >       PECL::memcached.
>
> > > >       - Marc
>
> > > > On Wed, Feb 24, 2010 at 9:41 AM, Adam Lee  wrote:
> > > > > What kind of hardware and software configurations are you using on the

Re: Memcached set is too slow

2010-03-01 Thread dormando
What about memcached? Is it running on localhost or over the network?

Any chance you could get an strace from the memcached side? Have your test
app talk to a separate test instance or something.

Is it exactly or close to 0.10s each time? That's suspicious.

On Mon, 1 Mar 2010, Chaosty wrote:

> sorry my bad full strace is:
>  0.85 [28b4f1ab] gettimeofday({1667458660, 1681273911}, NULL)
> = 0 <0.13>
>  0.000202 [28b5f2a3] write(9, "set
> b5e03d478da6b7b8e61095fec4eb0"..., 8196) = 8196 <0.38>
>  0.91 [28b5f2a3] write(9, "pr.parent_id = p.parent_id
> (1)\";s"..., 1360) = 1360 <0.23>
>  0.78 [28b5f2c3] read(9, 0x2aef6054, 8196) = -1 EAGAIN
> (Resource temporarily unavailable) <0.14>
>  0.61 [28b09d6f] poll([{fd=574240058, events=POLLIN|POLLPRI|
> POLLRDNORM|POLLWRBAND|POLLERR|POLLNVAL|0x6000}], 1, INFTIM) = 1
> ([{fd=1933255265, revents=POLLIN|POLLPRI|POLLOUT|POLLHUP|POLLNVAL|
> 0x3a00}]) <0.098976>
>  0.099064 [28b5f2c3] read(9, "STORED\r\n"..., 8196) = 8 <0.18>
>  0.90 [28b4f1ab] gettimeofday({875772260, 912536929}, NULL) =
> 0 <0.13>
>
>
> On Mar 1, 6:24 pm, Chaosty  wrote:
> > And here is strace
> > ...
> >      0.85 [28b4f1ab] gettimeofday({1667458660, 1681273911}, NULL)
> > = 0 <0.13>
> >      0.000202 [28b5f2a3] write(9, "set
> > b5e03d478da6b7b8e61095fec4eb0"..., 8196) = 8196 <0.38>
> >      0.91 [28b5f2a3] write(9, "pr.parent_id = p.parent_id
> > (1)\";s"..., 1360) = 1360 <0.23>
> >      0.78 [28b5f2c3] read(9, 0x2aef6054, 8196) = -1 EAGAIN
> > (Resource temporarily unavailable) <0.14>
> >      0.61 [28b09d6f] poll([{fd=574240058, events=POLLIN|POLLPRI|
> > POLLRDNORM|POLLWRBAND|POLLERR|POLLNVAL|0x6000}], 1, INFTIM) = 1
> > ([{fd=1933255265, revent$
> >      0.099064 [28b5f2c3] read(9, "STORED\r\n"..., 8196) = 8 <0.18>
> >      0.90 [28b4f1ab] gettimeofday({875772260, 912536929}, NULL) =
> > 0 <0.13>
> >  ...
> >
> > by strace read took almost 0.10 seconds..
> >
> > On Mar 1, 6:13 pm, Chaosty  wrote:
> >
> > > The tests were performed by modifying the set method like this:
> >
> > >         public static function set($key, $item, $exp = 60) {
> > >                 $benchmark = Profiler::start ('Memory', 'Set: '. $key);
> > >                 $return = self::$instance->set ($key, $item, $exp);
> > >                 Profiler::stop ($benchmark);
> > >                 return $return;
> > >         }
> >
> > > Then I figured out that almost each set is cost to us ~0.79
> > > seconds
> > > but the big key costs ~0.099359 seconds
> >
> > > this is trace info with: truss -faedD -o /phplog
> > > ...
> > > 76982: 2.431621337 0.14247 gettimeofday({1267456195.261569 },0x0)
> > > = 0 (0x0)
> > > 76982: 2.431709896 0.14806 gettimeofday({1267456195.261658 },0x0)
> > > = 0 (0x0)
> > > 76982: 2.431964677 0.45257 write(9,"set
> > > b5e03d478da6b7b8e61095fec4eb"...,8196) = 8196 (0x2004)
> > > 76982: 2.432037871 0.17600 write(9,"pr.parent_id = p.parent_id
> > > (1)";"...,1360) = 1360 (0x550)
> > > 76982: 2.432097655 0.15644 read(9,0x2aedb054,8196) ERR#35
> > > 'Resource temporarily unavailable'
> > > 76982: 2.532011750 0.099864927 poll({9/POLLIN},1,-1) = 1 (0x1)
> > > 76982: 2.532070696 0.16482 read(9,"STORED\r\n",8196) = 8 (0x8)
> > > 76982: 2.532135509 0.14248 gettimeofday({1267456195.362084 },0x0)
> > > = 0 (0x0)
> > > ...
> > > seems here's the problem: 76982: 2.532011750 0.099864927 poll({9/
> > > POLLIN},1,-1) = 1 (0x1)
> >
> > > On Feb 28, 3:41 am, dormando  wrote:
> >
> > > > How are you performing the test? Is memcached over localhost or over the
> > > > network?
> >
> > > > If you can reproduce this in isolation I'd be curious to see what
> > > > memcached and/or php are waiting on that takes so long (via strace or
> > > > similar).
> >
> > > > On Wed, 24 Feb 2010, me from wrote:
> > > > > Adam we are on freebsd 7.2, as i said early we use PECL memcached 
> > > > > 1.0.0 with libmemcached 0.35, the memcached version is 1.4.4.
> >
> > > > > We use our framework this is an init method
> >
> > > > > ? public static function instance() {
> > > > > ? ? if (self::$instance === NULL) {
> > > > > ? ? ? // Create a new instance
> > > > > ? ? ? self::$instance = new Memcached ();
> > > > > ? ? ? self::$instance->setOption 
> > > > > (Memcached::OPT_DISTRIBUTION, Memcached::DISTRIBUTION_CONSISTENT);
> > > > > ? ? ? self::$instance->addServers (array 
> > > > > (array ('127.0.0.1', 11211, 100)));
> > > > > ? ? }
> > > > > ? }
> >
> > > > > and this is a set method that works fine with small data and stops 
> > > > > with data > 100kbs
> >
> > > > > ? public static function set($key, $item, $exp = 60) {
> > > > > ? ? return self::$instance->set ($key, $item, $exp);
> > > > > ? }
> >
> > > > > Marc, no we

Re: Memcached set is too slow

2010-03-01 Thread Chaosty
It runs on the same server, php memcached connects by 127.0.0.1 to it.

it close but not the same. i did kill and run clean memcached server,
each time it was close to 0.1 sec.

I will do strace for memcached later and post the results.

On Mar 2, 3:50 am, dormando  wrote:
> What about memcached? Is it running on localhost or over the network?
>
> Any chance you could get an strace from the memcached side? Have your test
> app talk to a separate test instance or something.
>
> Is it exactly or close to 0.10s each time? That's suspicious.
>
>
>
> On Mon, 1 Mar 2010, Chaosty wrote:
> > sorry my bad full strace is:
> >      0.85 [28b4f1ab] gettimeofday({1667458660, 1681273911}, NULL)
> > = 0 <0.13>
> >      0.000202 [28b5f2a3] write(9, "set
> > b5e03d478da6b7b8e61095fec4eb0"..., 8196) = 8196 <0.38>
> >      0.91 [28b5f2a3] write(9, "pr.parent_id = p.parent_id
> > (1)\";s"..., 1360) = 1360 <0.23>
> >      0.78 [28b5f2c3] read(9, 0x2aef6054, 8196) = -1 EAGAIN
> > (Resource temporarily unavailable) <0.14>
> >      0.61 [28b09d6f] poll([{fd=574240058, events=POLLIN|POLLPRI|
> > POLLRDNORM|POLLWRBAND|POLLERR|POLLNVAL|0x6000}], 1, INFTIM) = 1
> > ([{fd=1933255265, revents=POLLIN|POLLPRI|POLLOUT|POLLHUP|POLLNVAL|
> > 0x3a00}]) <0.098976>
> >      0.099064 [28b5f2c3] read(9, "STORED\r\n"..., 8196) = 8 <0.18>
> >      0.90 [28b4f1ab] gettimeofday({875772260, 912536929}, NULL) =
> > 0 <0.13>
>
> > On Mar 1, 6:24�pm, Chaosty  wrote:
> > > And here is strace
> > > ...
> > > � � �0.85 [28b4f1ab] gettimeofday({1667458660, 1681273911}, 
> > > NULL)
> > > = 0 <0.13>
> > > � � �0.000202 [28b5f2a3] write(9, "set
> > > b5e03d478da6b7b8e61095fec4eb0"..., 8196) = 8196 <0.38>
> > > � � �0.91 [28b5f2a3] write(9, "pr.parent_id = p.parent_id
> > > (1)\";s"..., 1360) = 1360 <0.23>
> > > � � �0.78 [28b5f2c3] read(9, 0x2aef6054, 8196) = -1 EAGAIN
> > > (Resource temporarily unavailable) <0.14>
> > > � � �0.61 [28b09d6f] poll([{fd=574240058, events=POLLIN|POLLPRI|
> > > POLLRDNORM|POLLWRBAND|POLLERR|POLLNVAL|0x6000}], 1, INFTIM) = 1
> > > ([{fd=1933255265, revent$
> > > � � �0.099064 [28b5f2c3] read(9, "STORED\r\n"..., 8196) = 8 
> > > <0.18>
> > > � � �0.90 [28b4f1ab] gettimeofday({875772260, 912536929}, NULL) 
> > > =
> > > 0 <0.13>
> > > �...
>
> > > by strace read took almost 0.10 seconds..
>
> > > On Mar 1, 6:13�pm, Chaosty  wrote:
>
> > > > The tests were performed by modifying the set method like this:
>
> > > > � � � � public static function set($key, $item, $exp = 60) {
> > > > � � � � � � � � $benchmark = Profiler::start ('Memory', 
> > > > 'Set: '. $key);
> > > > � � � � � � � � $return = self::$instance->set ($key, 
> > > > $item, $exp);
> > > > � � � � � � � � Profiler::stop ($benchmark);
> > > > � � � � � � � � return $return;
> > > > � � � � }
>
> > > > Then I figured out that almost each set is cost to us ~0.79
> > > > seconds
> > > > but the big key costs ~0.099359 seconds
>
> > > > this is trace info with: truss -faedD -o /phplog
> > > > ...
> > > > 76982: 2.431621337 0.14247 gettimeofday({1267456195.261569 },0x0)
> > > > = 0 (0x0)
> > > > 76982: 2.431709896 0.14806 gettimeofday({1267456195.261658 },0x0)
> > > > = 0 (0x0)
> > > > 76982: 2.431964677 0.45257 write(9,"set
> > > > b5e03d478da6b7b8e61095fec4eb"...,8196) = 8196 (0x2004)
> > > > 76982: 2.432037871 0.17600 write(9,"pr.parent_id = p.parent_id
> > > > (1)";"...,1360) = 1360 (0x550)
> > > > 76982: 2.432097655 0.15644 read(9,0x2aedb054,8196) ERR#35
> > > > 'Resource temporarily unavailable'
> > > > 76982: 2.532011750 0.099864927 poll({9/POLLIN},1,-1) = 1 (0x1)
> > > > 76982: 2.532070696 0.16482 read(9,"STORED\r\n",8196) = 8 (0x8)
> > > > 76982: 2.532135509 0.14248 gettimeofday({1267456195.362084 },0x0)
> > > > = 0 (0x0)
> > > > ...
> > > > seems here's the problem: 76982: 2.532011750 0.099864927 poll({9/
> > > > POLLIN},1,-1) = 1 (0x1)
>
> > > > On Feb 28, 3:41�am, dormando  wrote:
>
> > > > > How are you performing the test? Is memcached over localhost or over 
> > > > > the
> > > > > network?
>
> > > > > If you can reproduce this in isolation I'd be curious to see what
> > > > > memcached and/or php are waiting on that takes so long (via strace or
> > > > > similar).
>
> > > > > On Wed, 24 Feb 2010, me from wrote:
> > > > > > Adam we are on freebsd 7.2, as i said early we use PECL memcached 
> > > > > > 1.0.0 with libmemcached 0.35, the memcached version is 1.4.4.
>
> > > > > > We use our framework this is an init method
>
> > > > > > ? public static function instance() {
> > > > > > ? ? if (self::$instance === NULL) {
> > > > > > ? ? ? // Create a new instance
> > > > > > ? ? ? self::$instance = new Memcached ();
> > > > > > ? ? ?