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

Slower with memcache than without cache!

Discussion in 'Server Configuration and Hosting' started by MTBeros, Apr 19, 2015.

  1. MTBeros

    MTBeros Member

    Hello, I have an VPS with 512MB of RAM (yes, I know is little, but really I don't need more for my forum atm).

    I've installed nginx 1.6, mariadb 10 and php-fpm 5.6 with zend opcache and memcache.

    When I configure the memcache on my xenforo:

    PHP:
    $config['cache']['enabled'] = true;
    $config['cache']['frontend'] = 'Core';
    $config['cache']['frontendOptions'] = array(
    'caching' => true,
    'lifetime' => 3600,
    'cache_id_prefix' => 'xf_'
    );
    $config['cache']['backend'] = 'Memcached';
    $config['cache']['backendOptions'] = array(
            
    'compression' => true,
            
    'servers' => array(
                    array(
                            
    // your memcached server IP /address
                            
    'host' => '127.0.0.1',
                            
    // memcached port
                            
    'port' => 11211,
                    )
            )
    );
    The performance is a little lower that if I don't configure any cache system.

    Here a simple apache benchmark
    Without cache:

    With memcache:
    Practically the times are the same with and without cahe, how can be possible? I specified a 128MB for memcache, and I'm alone in this server only loading the home.

    And now, the funny part:
    I'm configuring this server in order to replace my old (actually production) server, similar machine, but with very much slower disks, with Apache 2.2, php5.4 running as mod_php and mysql 5.5.

    And here's the same apache benchmark of my production server (with memcache enabled also):
    46.85 rps! 4 times more than my new server with SSD disks, and opcache instead of apc, nginx 1.6 (caching the static content) and php-fpm.
    I'm benchmarking with this: ab -kc 100 -n 1000 "http://www.mtberos.com/"

    What's wrong with my new server?

    Thanks a lot!
     
  2. Xon

    Xon Well-Known Member

    It depends, are you seeing paging, exhausting free memory? Ideally during a request diskaccess should be quite low.

    If so, you might have too much memory pressure and need to slim memory usage down.

    You probably only need about 64mb or even 32mb of memory for memcache. And will likely need to tune MySQL to disable performance schema stuff as it is a memory hog which eats memory as the higher the max connections in my.cnf is set.
     
  3. Mouth

    Mouth Well-Known Member

    Set compression to false, it's inefficient
     

Share This Page