php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #59434 binary protocol get() unexistant key delay
Submitted: 2010-09-22 05:41 UTC Modified: 2021-06-09 11:25 UTC
Votes:4
Avg. Score:4.2 ± 0.8
Reproduced:3 of 3 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: mglyebov at gmail dot com Assigned: cmb (profile)
Status: Closed Package: memcached (PECL)
PHP Version: 5.3.2 OS: centos 5.3
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: mglyebov at gmail dot com
New email:
PHP Version: OS:

 

 [2010-09-22 05:41 UTC] mglyebov at gmail dot com
Description:
------------
If binary protocol is enabled
>>$mc->setOption(Memcached::OPT_BINARY_PROTOCOL, true);
then every $mc->get('some_unexistant_key') produces delay of 
about 40ms.


System Configuration:
$>umane -a
  Linux some.name 2.6.18-194.3.1.el5.028stab069.6 #1 SMP Wed 
May 26 18:31:05 MSD 2010 x86_64 x86_64 x86_64 GNU/Linux
$>memcached -h
  memcached 1.4.5

phpinfo()
PHP Version 5.3.2
memcached
  memcached support	enabled
  Version	1.0.2
  libmemcached version	0.43
  Session support	yes
  igbinary support	yes


Reproduce code:
---------------
        $mc = new Memcached();
        $servers = array(array('memcache1', '11211', '100'));
        $mc->addServers($servers);

        $probe_key = 'unexistant_key';

        echo '<br/>NOT using Memcached::OPT_BINARY_PROTOCOL<br/>';
        $mc->setOption(Memcached::OPT_BINARY_PROTOCOL, false);

        $start = microtime(true);
        for ($i=0; $i<100;$i++)
            $mc->get($probe_key);
        $stop = microtime(true);
        echo ($stop - $start).' sec';


        $mc->setOption(Memcached::OPT_BINARY_PROTOCOL, true);
        echo '<br/>Using Memcached::OPT_BINARY_PROTOCOL<br/>';

        $start = microtime(true);
        for ($i=0; $i<100;$i++)
            $mc->get($probe_key);
        $stop = microtime(true);
        echo ($stop - $start).' sec';


Expected result:
----------------
NOT using Memcached::OPT_BINARY_PROTOCOL
0.012768983840942 sec
Using Memcached::OPT_BINARY_PROTOCOL
0.01xxxxxxxxxxxxx sec

Actual result:
--------------
NOT using Memcached::OPT_BINARY_PROTOCOL
0.012768983840942 sec
Using Memcached::OPT_BINARY_PROTOCOL
4.0627429485321 sec

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-08-12 11:14 UTC] quentin389 at gmail dot com
Use memcached option TCP_NODELAY, that will fix the 30-40ms delays on non-existing keys and drop them to what you get for other keys (<1ms)
 [2021-06-09 11:25 UTC] cmb@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: cmb
 [2021-06-09 11:25 UTC] cmb@php.net
The memcached bug tracker is now on Github[1].  If this is still
an issue with the current memcached version, please report there.

[1] <https://github.com/php-memcached-dev/php-memcached/issues>
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 11:01:30 2024 UTC