|  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: 2012-03-07 17:32 UTC
From: abodera at gmail dot com Assigned:
Status: Analyzed Package: memcached (PECL)
PHP Version: 5.3.2 OS: Fedora 12
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: abodera at gmail dot com
New email:
PHP Version: OS:


 [2010-05-08 11:49 UTC] abodera at gmail dot com
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:, loopback via TCP

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


Add a Patch

Pull Requests

Add a Pull Request


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:
  avg.self: 18ms 
  total: 1933ms (105 calls)

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

php-memcache: Version => 2.2.5
php-memcached: Version => 1.0.2
 [2011-08-30 21:32 UTC] info at bellfor dot com colchicine xok synthroid for sale 52320
 [2011-09-15 21:06 UTC] info at s88 dot co dot jp priligy 939 prescription online consultation propecia 934845
 [2012-03-07 17:32 UTC]
Can you try with newer version of libmemcached and php-memcached?
 [2012-03-07 17:32 UTC]
-Status: Open +Status: Analyzed
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sun May 16 22:01:24 2021 UTC