Closed (fixed)
Project:
Memcache API and Integration
Version:
7.x-1.x-dev
Component:
Code
Priority:
Major
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
3 Aug 2009 at 06:07 UTC
Updated:
12 Feb 2015 at 11:29 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
jaydub commentedComment #2
premanup commentedthank you! It works for me fine.
Comment #3
happysnowmantech commented+1 for this feature
Comment #4
jeremy commentedIf you're using Memcache locally, why not just use APC (or another PHP-opcode cache). I believe you'll get much better performance that way, and gain some additional functionality as well.
Marking as works-as-designed.
Comment #5
threading_signals commentedI think this is a simple request. Drupal uses java-based apachesolr and CAS services as well, as you know, and both APC and memcached can be enabled for one machine for such a purpose (opcode & database cache).
Here's one sample of a xhprof run after restarting memcached, clearing all cache, then refreshing watchdog (admin/reports/dblog):
Regression/Improvement summary for Memcached::set
There's not enough sampling, but it's a good start.
Comment #6
threading_signals commentedNote that sockets and tcp port connections can be used in conjunction.
Comment #7
rjbrown99 commentedI was poking around and came across this issue. Just a note - the php-pecl-memcached package does not yet support unix sockets. So the use of this patch, if it were to be committed, would also necessitate the need to use the older php-pecl-memcache library with php.
Comment #8
threading_signals commentedI haven't been able to test the patch thoroughly, but I'm using Debian with memcached and php5-memcached, so check your packages accordingly.
Comment #9
ball.in.th commentedsubscribing.
Comment #10
abx commentedMemcached PECL package version 2 beta 1 that support unix socket has been released on Mar 13.
http://pecl.php.net/package-changelog.php?package=memcached&release=2.0.0b1
- Add support for Unix domain socket connections
Comment #11
pillarsdotnet commentedI also submitted a patch for the underlying libmemcached code here:
https://bugs.launchpad.net/libmemcached/+bug/738208
Comment #12
Miko. commentedThat was a pretty arrogant reply Jeremy. It doesn't work for me and I HAVE add a patch like this but I wasted half a day trying to figure out the issue (it's still not fixed) and taking sockets into consideration seems like a good way to evolve this project.
Comment #13
catchNow we have wildcard support in memcache (and this isn't available in the APC project afaik), I think it makes sense to revisit this.
Although I'd rather not be parsing the strings like this - could we add a new key to the servers array or similar instead?
Comment #14
threading_signals commentedDoesn't that hardcode the file path? It could make for headaches during config time.
Comment #15
Peter Bowey commentedThis Patch (top) -> http://drupal.org/files/issues/socket-connection-dmemcache.inc_.patch
works very well in conjuction with the latest SVN 'memcache' daemon V3.0.6 at http://svn.php.net/viewvc/pecl/memcache/
Release notes on the current SVN V3.0.6 memcache PECL:
See http://drupal.org/node/1181968 for some setup guidelines on this.
Comment #16
ralf.strobel commentedThis patch works great indeed. I would really request that it is implementet, epecially since the modification required is so minor.
There are good reasons not to use APC for local caching of larger sites. Write performance and memory fragmentation management are still better using memcached. Even the developers of the APC Drupal module do not recommend using it for cache bins that can grow very large and are updated frequently.
Even if that wasn't the case, the use of unix sockets is absolutely compliant with both memcached and the php memcache(d) API. So why should it not be supported by Drupal.
Comment #17
Peter Bowey commentedRefer #16
@ralf.strobel - concurred + agreed
@catch - This needs to be standardized
Apart from APC, I have tested that the latest XCache 1.3.2 does not suffer the fragmentation with large and frequently changing bins.
In my tests where APC was showing near high fragmentation (with resulting low performance), I then increased APC's memory limit (to 600 MB) enough to give it some slack room. Fragmentation dropped to zero, and the CPU usage on the server dropped by 50%. Note also that there seems to be a bug with apc.php's graph: http://pecl.php.net/bugs/bug.php?id=13146.
With XCache, garbage collection (gc) will clear expired items when GC counts down to 0, or when it's cache is full. A cached item is only cleared after it has expired. This is done automatically by XCache, depending on your xcache settings in php.ini. eg:
Comment #18
catchThis just about still applies to the 6.x-1.x branch, however it needs work.
There's no point exploding the string then putting it back together again, and the comment doesn't conform to standards.
This should be plenty:
If someone can re-roll along these lines and test it I'll commit.
Comment #19
Peter Bowey commentedRefer #18
Thanks @catch, as I no longer use memcache, it could be some time before I could test this.
I moved to my own custom code method with XCache bins (so much faster). I found the over-head of memcache rather high (even with Unix Sockets) for a single high performance Linux box. All my up-streams are virtual, and it boil's down to best memory use and speed with 8Gbs with a dedicated multi-core Xeon box :)
Comment #20
JamesK commentedRE: #18
This doesn't really work since when you use it, you need to remove the ":0" from the end of the memcache_servers variable in settings.php. This makes $host string different than the memcache_servers string which breaks the reports page because it can't lookup the reports.
Comment #21
ralf.strobel commentedI just patched the new 7.x-0.1 release for myself using an improved version of the old fix:
I think this is quite the optimal solution. I'm upping the priority now, as this should really be committed. It's a shame this tiny fix didn't makt it into the stable 7.x release.
Comment #22
pillarsdotnet commentedComment #23
catch@ralf.strobel - if you want fixes to go in, it's best to supply an actual patch. See http://drupal.org/patch for instructions on how to create one.
Comment #24
Peter Bowey commented*Smile*
Supply a 'patch' for 9 lines of code? ...... :-)
have a 'chocky bicky' for that 'extra' code push!
Release it!!
-------------------------------------------------
Oops! Sorry, my apology note + email sent to catch.
"Time to TLC the Drupal kittens"
Comment #25
ralf.strobel commentedWell, actually it's just three lines of code.
I did look into creating patches, but I have never done it and I don't have the time to install GIT now for the purpose of this. I just hope somebody finds the time to put it in.
Comment #26
catchYes it's normal practice when you want a change to be made to supply a patch, even if you're only changing one character.
If you don't do that, maintainers probably won't pay much attention to the issue, so you can either spend time complaining, submit the patch, or twiddle thumbs waiting for someone else to do it - it's up to you to decide what you think will be most effective. Since I don't personally need this feature at the moment, I don't have a particular itch to write the patch myself, and sarky comments demotivate me even more, as well as being quite busy too.
Comment #27
mikeytown2 commentedD6 & D7 patches.
Comment #28
ralf.strobel commentedThat also makes sense. Reconstructing $host by appending the extracted $port is a bit more flexible, since it will accept hosts with or without the appended ":0". You could argue that appending the 0 port is a better generalization of the tcp syntax which has the port appended.
But in the end I don't care.
Comment #29
catchHmm I'm fine with the patch as is, we can open a followup if necessary. So committed and pushed to both branches.
Comment #31
W.M. commentedI am using Memcached and trying to connect to server via Unix socket. I am getting this error message:
I have followed the instructions and put these settings inside settings.php
I am using PHP 5.6.2. Thanks.
Comment #32
jeremy commented@W.M. please be sure you're using the latest version of the Drupal memcache module, and file a new bug report if you still have problems; this one has already been closed.
Comment #33
W.M. commented@Jeremy. I am using the latest Memcache Drupal module version.
Comment #34
sunfire-design commentedSorry for reopening.
Same error with PHP 5.4.37:
Failed to connect to server at /var/run/memcached/memcached.sock:11211