comet-cache icon indicating copy to clipboard operation
comet-cache copied to clipboard

Feature Request: Add support for Memcached and Amazon ElastiCache

Open ethanpil opened this issue 11 years ago • 38 comments

Instead of storing the cache files on disk, how about an option for storing them in memory?

APC/APCu / Memcached

http://we-love-php.blogspot.com/2013/02/php-caching-shm-apc-memcache-mysql-file-cache.html

ethanpil avatar Dec 24 '13 08:12 ethanpil

+1 for memcache (this would also make QC compatible with ElastiCache from AWS).

Next Actions

  • [ ] Create a new abstract class for cache read/write operations; e.g., getCache(), setCache(), deleteCache(), purgeCache().
  • [ ] Build a new class that extends the abstraction. One which implements and better organizes the existing cache methodology that ZenCache uses currently. This will become one (of many) caching methods that ZenCache will support moving forward.
  • [ ] Build a new class that extends the abstraction. Once which implements an in-memory cache using the memcached extension for PHP. http://php.net/manual/en/book.memcached.php
  • [ ] Adjust the ZenCache source code so that all cache reads/writes/deletes go through a wrapper that will inspect the current configuration of the site; using a particular caching methodology that has been configured.
  • [ ] Use this class as an example of how to use a pool of Memcached servers (i.e., one or more) that can live locally or be hosted on another server in a private network.

jaswrks avatar Dec 28 '13 06:12 jaswrks

Memcached and ElastiCache support sounds like a great idea. I'm adding this feature request to my todo list.


I'm also copying the following notes from @JasWSInc that he left on Issue #54 which may be relevant when working on this feature request.

@raamdev I think it would be nice to expose a way for site owners to break out of this ABSPATH jail in certain scenarios. In the case reported here, a symlink should do the job. However, if a site owner wanted to use something like Amazon's ElastiCache; a symlink wouldn't be enough. A site owner would need to have the ability to change the root path to what is actually an external server in the case of ElastiCache. http://aws.amazon.com/elasticache/

selection_001


Other Considerations....

The current benefit of having an ABSPATH root hard-coded into the Quick Cache plugin...

  • If you import/export your Quick Cache options from one site to another, there is no root path in your options configuration; and thus, it's more portable. i.e. a site owner only configures the local path, and not the full server path.

That's not super important, so perhaps we can improve the flexibility offered by this setting in a future release. Ideally, in a way that would not negatively impact the import/export feature currently offered by QC Pro.

raamdev avatar Feb 26 '14 19:02 raamdev

Please don't leave out APC/APCu as an option here. Perhaps a good option would be an abstraction that can talk to a variety of caching systems...

Something like this: http://www.phpfastcache.com/

Or one of these options? http://stackoverflow.com/questions/6100186/looking-for-a-php-caching-library-with-multiple-back-end-storage-adapters

ethanpil avatar Feb 28 '14 01:02 ethanpil

Cachify allows you to cache via "DB, HDD, APC or Memcached": http://wordpress.org/plugins/cachify/

Definitely planning to add support for at least APC and Memcached to Quick Cache.

raamdev avatar Jun 09 '14 19:06 raamdev

almost an year, no update for memcache ?

Anyways, +1 for memcache, I 'm looking for a memcache!

aziernest avatar Nov 04 '14 10:11 aziernest

Pasting notes here from Jason regarding adding Memcache support to ZenCache Pro:

Integrating a Memcache option should be relatively painless. We have most of the work needed to implement Memcache already in place; i.e. we have all cache purging, clearing, wiping, and directory deletions going through just a couple two or three wrappers.

The next step that I suggest is to create wrappers for all cache writes too. With this in place, we can then take a look at integrating Memcache as an option. The wrappers can be made to detect a Memcache-enabled option, and use Memcache for all cache reads/writes.


Memcache keys can simply follow the existing standard that we use for building a cache path in the file system; only it will be in memory instead of in the local file system.


Referencing: "Difference between Memcache and Memcached": http://stackoverflow.com/questions/1442411/when-should-i-use-memcache-instead-of-memcached

http://php.net/manual/en/book.memcache.php http://php.net/manual/en/book.memcached.php


Referencing Memcache tutorial: https://rtcamp.com/tutorials/php/memcache/

raamdev avatar Mar 06 '15 23:03 raamdev

+1111111 (ooops my finger slipped) for Memcached/

HandyGadget avatar Apr 11 '15 16:04 HandyGadget

Yes this should be something

tokar86a avatar May 05 '15 10:05 tokar86a

+1 for Memcached!

gjonsson avatar May 15 '15 13:05 gjonsson

YAPO (yet another plus 1) for memcached!

timreeves avatar May 15 '15 17:05 timreeves

It would be great :) +1 :+1:

isaumya avatar May 15 '15 19:05 isaumya

So great to see all of these votes for Memcached. I can't wait to see this added to ZenCache; i.e., move away from disk writes and see the speed increase with memory allocation being used instead. On the AWS platform, in particular, this seems to make a lot of sense. cc @raamdev

jaswrks avatar May 15 '15 19:05 jaswrks

Adding a list of next actions above ↑

jaswrks avatar May 18 '15 17:05 jaswrks

You can force to use memory by mounting the WordPress cache folder to tmpfs. I do this with zencache's cache folder and it is now served by memory. What would memcache bring more to the table? I use memcache for object caching and tmpfs for zencache.

xberg avatar Jul 29 '15 06:07 xberg

I have memcached installed and running on the server. Currently don't access it yet. With this feature implemented, will transients be able to access the memcached server through Zencache? Or will I need to use a separate plugin like https://wordpress.org/plugins/memcached-is-your-friend/ . Thanks!

rdanamcd avatar Dec 31 '15 13:12 rdanamcd

@rdanamcd : these are completely different things. Memcached is your friend is there for transients and object cache (I highly recommend activating this: it really is plug and forget). Zencache does not deal with those. Zencache is a page cache engine. Today Zencache uses disk to save the pages (or you can use my workaround as explained above). I suggested it should natively support Memcache for also page caching. Memcache could then manage page expiration and will be a LOT faster than using disk.

xberg avatar Jan 02 '16 10:01 xberg

I also use Redis as transient / object caching so I would very much appreciate support for Redis as well.

xberg avatar Jan 02 '16 10:01 xberg

+1 for Memcached/Redis-Support for CometCache!

carstenwawer avatar Feb 29 '16 12:02 carstenwawer

:+1:

theperfectwill avatar Feb 29 '16 17:02 theperfectwill

As I wrote back in July I do not understand the purpose of memcache / redis here. You can simply move the whole cache folder to a memory folder and that's all done: no more disk access. See my note from July which then made it to a knowledge base article: You can force to use memory by mounting the WordPress cache folder to tmpfs. I do this with zencache's cache folder and it is now served by memory.

xberg avatar Feb 29 '16 20:02 xberg

@xberg I quite understand your point, and I could do it myself - but will I make the effort? And what about other people with less skills at the OS level? To get memcached or redis servers running is - on Ubuntu/Debian at least - simply a matter of installing one package, and it runs. Redis is the only system being mentioned here which offers persistence. But it is also not the fastest option, as data is passed via TCP or Unix Sockets. Which for the WP Cache is needless overkill, as it can be rebuilt at the drop of a hat. What I normally do in similar cases is use Nginx + PHP-FPM, and then shared memory via APCu. That way, the shared memory is in the space of the master FPM process and shared with its children, so that's really efficient - low on memory, low on needless repetition, very fast on access. That said, first you need to compile APCu and load it (as a PHP module), so using a temp filesystem in memory is probably not more challenging then getting APCu running, and also not much different in speed.

timreeves avatar Mar 01 '16 08:03 timreeves

+1 for Memcached support in the GUI (Redis support would be great too). We generally don't have access to our clients' servers (nor do they), so mounting the cache folder to tmpfs is rarely an option. In instances in which Memcached is available on the server, we generally install W3TC instead of Comet Cache.

In different terms, this is about 10 sales of Comet Cache Pro per day that you -- and we -- are missing out on.

AJ1976 avatar Jun 08 '16 13:06 AJ1976

Another +1 for memcache support.

eojeel avatar Jul 07 '16 12:07 eojeel

+1 just purchased the Pro Unlimited version. Can't wait for this release for Memcache

jpSimkins avatar Apr 13 '17 17:04 jpSimkins

Just a quick note here for everyone subscribed to this GitHub issue: The next release of Comet Cache Pro will include support for Memcached / AWS ElastiCache and since we could use all the help we can get testing this new feature we're doing something special this time around and opening the next Comet Cache Pro Beta to everyone, even non-Pro customers.

If you're not a Pro customer and you're interested in helping test this feature, please send an email to [email protected] with the following subject line: "I want to help test Issue #47" I'll send you an email with details as soon as a beta version is available for testing (within the next week or so).

2017-04-26_13-03-54

raamdev avatar May 15 '17 20:05 raamdev

This is fantastic news! I'm a pro user and will report back on this when it's released. I was using tmpfs up until now.

xberg avatar May 15 '17 22:05 xberg

I can't wait to test this out!

jpSimkins avatar May 16 '17 22:05 jpSimkins

Hi, When is this releasing? Many thanks!

xberg avatar Jun 01 '17 19:06 xberg

Hi, Any info on realease date? thanks

xberg avatar Jun 29 '17 23:06 xberg

@xberg We're hoping to have a release out within the next week or two. This GitHub issue will be updated once a release occurs.

raamdev avatar Jul 03 '17 20:07 raamdev