php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #59199 cas() and set() extremely slow
Submitted: 2010-05-08 11:49 UTC Modified: 2021-06-09 11:24 UTC
From: abodera at gmail dot com Assigned: cmb (profile)
Status: Closed Package: memcached (PECL)
PHP Version: 5.3.2 OS: Fedora 12
Private report: No CVE-ID: None
 [2010-05-08 11:49 UTC] abodera at gmail dot com
Description:
------------
The cas() operation is extremely slow with php-memcached.
Below are timings taken from xdebug profiler:

Function             a.self a.cum  t.slf. t.cum calls
php::Memcached->cas    15ms  15ms  238ms    238    16
php::Memcached->get    0,2ms 0,2ms 0,2ms     16    90
php::Memcached->add    0,1s  0,1ms   1ms     1ms    9

cas() individual self time peaks up to 40ms, while similar set() and add() operations are always < 0.5ms in the same application and thread.

Tested and consistent under:
 - 1.0.1 + libmemcached 0.38
 - 1.0.2 + libmemcached 0.40

Memcached ver 1.4.4

Reproduce code:
---------------
Values stored are small (count() < 20) arrays.
Env: apache php module
Profiler: xdebug  2.0.5
Connection to memcached: 127.0.0.1, loopback via TCP

Expected result:
----------------
cas() self time < 1ms (including overhead).




Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-05-08 14:38 UTC] abodera at gmail dot com
Just verified the same with set().
I've dumped cas() code completely and replaced it with plain set(). The lag is enormous...

For example:
php::Memcached->set
  avg.self: 18ms 
  total: 1933ms (105 calls)

Just tested, for comparison, the same code but with memcache (persistent, compression disabled):
php::Memcache->set
  avg.self: <0,1ms
  total: 3,9ms (59 calls)

php-memcache: Version => 2.2.5
php-memcached: Version => 1.0.2
 [2012-03-07 17:32 UTC] andrei@php.net
Can you try with newer version of libmemcached and php-memcached?
 [2012-03-07 17:32 UTC] andrei@php.net
-Status: Open +Status: Analyzed
 [2021-06-09 11:24 UTC] cmb@php.net
-Status: Analyzed +Status: Closed -Assigned To: +Assigned To: cmb
 [2021-06-09 11:24 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-2021 The PHP Group
All rights reserved.
Last updated: Fri Jun 18 00:01:23 2021 UTC