1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Memcached Or Not?

Discussion in 'Server Configuration and Hosting' started by Anthony Parsons, Aug 29, 2016.

  1. Anthony Parsons

    Anthony Parsons Well-Known Member

    I run php7 + opcache, mariadb 10.1 on an SSD cloud infrastructure... so read/write is pretty sweet.

    Is memcached really going to do a whole lot or not? I have read through older threads, but they were always based on spindle HDD's.

    Saying that, from reading, memcached targets session storage of string and such info, storing dynamic aspects for faster loading. Opcache is purely precompiling php scripts.

    So... is it worth using something like memcached? Are the results with php7, mariadb and SSD really going to be worth while when the data flows so easily without I/O being a factor?
  2. BamaStangGuy

    BamaStangGuy Well-Known Member

    We don't run it on our largest sites anymore. We try to keep configuration as simple as possible. Hardware is far outpacing the demands software can put on it these days. Technology is also making things a lot easier on the hardware instead of the other way around.
    Anthony Parsons likes this.
  3. Xon

    Xon Well-Known Member

    Using memcache (or redis with my addon) is useful as it will often save complex queries and cache the result.

    With redis, I implement a number of complex or write intensive queries as some very simple redis commands in my Trending Tag Content, Redis view counters, User Activity(not released here yet) Add-ons.

    I also use Redis/memcache caching to save complex queries in a large number of my other add-ons when on the hot-path for viewing forums/threads/etc.

    This makes a measurable performance difference, and allows savings even on modern hardware.
  4. motowebmaster

    motowebmaster Active Member

    I'm running Litespeed with Opcache and Memcache, on SSDs.

    I don't think you'll see a dramatic difference, but it did benefit me. I've got a non-XF app associated to my site that utilizes it heavily.
    Anthony Parsons likes this.
  5. thedude

    thedude Well-Known Member

    Use memcache (or redis if you use Xon's add-on)... Otherwise you're leaving some easy performance gains on the table.
    Xon likes this.
  6. TDUBS

    TDUBS Active Member

    I'm currently using @Xon's addon with Redis and it's excellent with noticeable performance enhancements.
    eva2000 and Xon like this.
  7. eva2000

    eva2000 Well-Known Member

    memcached and redis serve cache from memory which is generally faster than from ssd

    however, when it comes to memory and ssds not all memory and ssds are created equal so your mileage will vary and really depends on what is being served out of caching

    using both memcached and redis cache for my XF forums at https://community.centminmod.com/

    redis cache via @Xon XF redis cache addon and memcached for ngx_pagespeed caching https://centminmod.com/nginx_ngx_pagespeed.html :)
    Xon, Anthony Parsons and maszd like this.
  8. Anthony Parsons

    Anthony Parsons Well-Known Member

    Isn't a DB slotted into RAM automatically, so most queries are done via RAM and not direct to the DB? I remember reading @digitalpoint saying that the more RAM the better, because the more then that gets cached into RAM and subsequently delivered faster to the user.

    If I remember that correctly, that is. I have heaps of RAM... which is why I'm wondering whether or not there will be any noticable performance based on others who use SSD RAID stacks with plenty of RAM and if they found memcached to be useful or just a lag on bandwidth and resources.

    I have ran it before on HDD's, and from memory it increased bandwidth, but that didn't matter then compared to the gain achieved with HDD's being slow arsed things they are, compared to SSD's, especially in a cloud RAID.

    Useful insight thus far... maybe the best bet is to just experiment?

    Oh... big fan of your DB optimisation work @eva2000.
    eva2000 likes this.
  9. eva2000

    eva2000 Well-Known Member

    mysql can tune memory buffers to allow caching of data/indexes (if innodb or just indexes if myisam) but if your web app i.e. xenforo, wordpress etc allow for it you can cache much more than that so that it doesn't even touch mysql server which is still faster and allows your web app and site to scale much better. Also more so is that redis and memcached can be clustered or setup as remote servers to web app so that you can distribute the cache across web clusers if you have more than one web server.

    wordpress7 site with redis nginx level full page caching http://wordpress7.centminmod.com/232/wordpress-7-site-updates/ :)
    Anthony Parsons likes this.
  10. Anthony Parsons

    Anthony Parsons Well-Known Member

    Interesting... ok, time to go and experiment it is.
    thedude likes this.
  11. digitalpoint

    digitalpoint Well-Known Member

    My general rule of thumb is memcached/redis are hugely beneficial for multiple server setups (in fact, I'd argue it's a requirement). For a single server setup, not so much... in fact, it might be a little detrimental performance-wise if it's on an otherwise well setup/tuned server (there are other caching mechanisms designed for a single server setup that doesn't have the network connection overhead).
    Anthony Parsons likes this.

Share This Page