|  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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
32 - 13 = ?
Subscribe to this entry?

 [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
 [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
 [2021-06-09 11:24 UTC]
-Status: Analyzed +Status: Closed -Assigned To: +Assigned To: cmb
 [2021-06-09 11:24 UTC]
The memcached bug tracker is now on Github[1].  If this is still
an issue with the current memcached version, please report there.

[1] <>
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Jun 18 21:01:32 2024 UTC