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

Change Xcache to (Opcache and (APCU or Memcached)) for PHP 5.4?

Discussion in 'Server Configuration and Hosting' started by Amin Sabet, Feb 7, 2015.

  1. Amin Sabet

    Amin Sabet Well-Known Member

    I'm on PHP 5.4 and not planning to change to PHP 5.5 any time soon because I have both vB and XF sites, and vB seems to have some issues with PHP 5.5. I'm on a single, dedicated server running Litespeed webserver with Litespeed cache.

    I'm currently using Xcache but was thinking of uninstalling that and installing Opcache + either APCU or Memcached. Would this change make a noticeable difference to site performance? Appreciate any insights from those who have tried this.
     
  2. Solidus

    Solidus Well-Known Member

    Around 15% performance improvement from Xcache to Opcache. Combine it with memcached, it works great.
     
    Amin Sabet likes this.
  3. Amin Sabet

    Amin Sabet Well-Known Member

    Opcache alone = 15% improvement from Xcache

    or

    Opcache + memcached = 15% improvement from Xcache
     
  4. Solidus

    Solidus Well-Known Member

    Opcache alone.
     
  5. Amin Sabet

    Amin Sabet Well-Known Member

    Nice. I've uninstalled Xcache and installed Opcache. So far so good. Now I just need to figure out how to install Memcached.
     
  6. Solidus

    Solidus Well-Known Member

  7. Amin Sabet

    Amin Sabet Well-Known Member

    Thanks for that! Is memcached a better option than APCU?

    Also, I noticed that the linked instructions refer to installing php-pecl-memcache. I already checked the option to install memcache via easyapache when I compiled Apache/PHP. Is it okay to follow these instructions which seem to re-install that while installing memcached?
     
  8. RoldanLT

    RoldanLT Well-Known Member

    I think for PHP 5.4, it's best to use APC.
     
  9. Solidus

    Solidus Well-Known Member

    From my experience, memcached. No benchmarks though.
    You've installed the PHP extension but have you installed the library files? Check for memcached under /etc/sysconfig/
     
  10. Amin Sabet

    Amin Sabet Well-Known Member

    No, I don't have memcached under etc/sysconfig/. I'll follow the directions at the link you provided. Thanks again.
     
  11. Solidus

    Solidus Well-Known Member

    yum install memcached will do it

    here is my /etc/sysconfig/memcached file

    Code:
    PORT="11211"
    USER="memcached"
    MAXCONN="1024"
    CACHESIZE="1024"
    OPTIONS="-l 127.0.0.1"
    
     
    Amin Sabet likes this.
  12. Mouth

    Mouth Well-Known Member

    1 Gb of RAM for memcached is a LOT. You should only need 128 Mb for a busy XF, 256 Mb at most.
     
  13. Solidus

    Solidus Well-Known Member

    It's already using around 300mb. I have the RAM to spare to it's not an issue.
     
  14. Amin Sabet

    Amin Sabet Well-Known Member

    Thanks for all the help. I think I got memcached installed. How do I verify that it is working?
     
  15. Solidus

    Solidus Well-Known Member

    Run command memcached-tool 127.0.0.1 stats
    check get-hits
     
    Amin Sabet likes this.
  16. Amin Sabet

    Amin Sabet Well-Known Member

    Last edited: Feb 8, 2015
  17. Amin Sabet

    Amin Sabet Well-Known Member

    Looks like memcached is working well:

    Code:
    root@bms [~]# memcached-tool 127.0.0.1 stats
    #127.0.0.1:11211   Field       Value
             accepting_conns           1
                   auth_cmds           0
                 auth_errors           0
                       bytes      962130
                  bytes_read     9333793
               bytes_written  1321219651
                  cas_badval           0
                    cas_hits           0
                  cas_misses           0
                   cmd_flush           0
                     cmd_get      444056
                     cmd_set         926
                 conn_yields           0
       connection_structures          23
            curr_connections          16
                  curr_items         251
                   decr_hits           0
                 decr_misses           0
                 delete_hits           4
               delete_misses           0
                   evictions           0
                    get_hits      443457
                  get_misses         599
                   incr_hits           0
                 incr_misses           0
              limit_maxbytes  1073741824
         listen_disabled_num           0
                         pid       32419
                pointer_size          64
               rusage_system    3.075532
                 rusage_user    0.794879
                     threads           4
                        time  1423358842
           total_connections         110
                 total_items         926
                      uptime        7845
                     version       1.4.4
    

    And from PHP Info looks like Opcache also working:

    Code:
    Zend OPcache
    Opcode Caching Up and Running
    Optimization Enabled
    Startup OK
    Shared memory model mmap
    Cache hits 144779
    Cache misses 1233
    Used memory 123809552
    Free memory 10408176
    Wasted memory 0
    Interned Strings Used memory 5671928
    Interned Strings Free memory 2716680
    Cached scripts 1229
    Cached keys 1392
    Max keys 7963
    OOM restarts 0
    Hash keys restarts 0
    Manual restarts 0
    

    Thanks again, everyone, for the help!
     
    Last edited: Feb 8, 2015
  18. Solidus

    Solidus Well-Known Member

    Awesome. Did you make any changes to opcache.ini?
     
  19. Amin Sabet

    Amin Sabet Well-Known Member

    No, should I?

    Edit: Maybe I did. Are those the settings in php.ini?
     
  20. Solidus

    Solidus Well-Known Member

    No, they are in /etc/php.d/opcache.ini (or something similar, mine is 10-opcache.ini)
     

Share This Page