HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Questions about caching in Vanilla

phreakphreak Vanilla*APP (White Label) & Vanilla*Skins Shop MVP
edited November 2013 in Feedback

Hi all,

I run a Vanilla forum under 2.0.18.8 and recently i reached about 2.500 Visitors a day with some hundred users. I'm looking for a caching integration but i'm totally plain regarding Vanillas capability in this field. The overall server load is around 4% but 2-3 times a day the server load peaks and it seems like the database drops out, returning within 1-2 minutes. The server crashes.

I'm in talks with my hoster and we decided to add a 60 GB SSD for the Database and might use a caching that is supported by Vanilla. I've read through several threads and it seems that Vanilla supports "Memcached" and "APC", although i do not get all the technical details. Ok, then there is Nginx, which was stated by some, improves Vanillas performance as well, but my hoster is not providing this for a managed server of my size.

My idea now was to let the hoster install "Memcached" and add the SSD and then monitor what happens. But here might be more smarter ideas from you or in articles i should dive into to get the best out of it. Would be great if you can point me to some things. Thanx

The Server:
Intel® Core™ i3-2100, 2 x 3,1GHz Processor, Hyper-Threading
4 GB RAM
1 TB SATA (RAID 1)

Btw: i came across this article:
http://smerity.com/articles/2012/install_vanilla_forums.html

  • VanillaAPP | iOS & Android App for Vanilla - White label app for Vanilla Forums OS
  • VanillaSkins | Plugins, Themes, Graphics and Custom Development for Vanilla

Comments

  • LincLinc Detroit Admin

    APC is generic PHP caching. Your hosting provider should be able to enable it for you. It helps a lot.

  • ShadowdareShadowdare r_j MVP
    edited June 2014

    Memcached is a handy tool for storing data that are regularly accessed by the filesystem and database in memory. The cache can be distributed across many systems.

    I found the following Memcached config settings for Vanilla on a page on @Lincoln's GitHub a while back. After applying them, Vanilla began to store some data in the Memcached store immediately.

    // Cache
    $Configuration['Cache']['Enabled'] = true;
    //$Configuration['Cache']['Prefix'] = 'example_';
    $Configuration['Cache']['Method'] = 'memcached';
    $Configuration['Cache']['Memcached']['Store'] = array('localhost:11211');
    $Configuration['Cache']['Memcached']['Option'][Memcached::OPT_COMPRESSION] = true;
    $Configuration['Cache']['Memcached']['Option'][Memcached::OPT_DISTRIBUTION] = Memcached::DISTRIBUTION_CONSISTENT;
    $Configuration['Cache']['Memcached']['Option'][Memcached::OPT_LIBKETAMA_COMPATIBLE] = true;
    

    Add Pages to Vanilla with the Basic Pages app

  • phreakphreak Vanilla*APP (White Label) & Vanilla*Skins Shop MVP
    edited November 2013

    Thank you a lot guys. Would you choose the one or the other or both?

    @lincoln: Are there any config settings like the memcached for APC as well?

    @R_J also recommended in a private message that following settings might support the database in all the plugin connections. I will try that too, mention it here to bring your ideas up about it.

    $Configuration['Database']['ConnectionOptions'] = array(
    12 => TRUE,
    1000 => TRUE,
    1002 => "set names 'utf8');

    • VanillaAPP | iOS & Android App for Vanilla - White label app for Vanilla Forums OS
    • VanillaSkins | Plugins, Themes, Graphics and Custom Development for Vanilla
  • Varnish sits front of house for a quick turn around. It is a web accelerator. if you use a CDN you might not need this. if you are setting up a private CDN or what improve a CDN pull rate you set this up.

    Memcache is employed by the application to cache data and objects. You have enough memory for it, so go for it.

    Although APC is not used in this case to cahche vanilla object simply having it install and enabled can improve performance.

    nginx is a more efficient server than apache so this is an option. The problem is if you are looking for a full managed hosting with nginx, you options are still limited. Very few will support it full managed, and those that do, well like anything they are an unknown quantity. With a client, I found a guy, he turned out to be the most unreliable person. Like simply not replying to to a ticket for months, this is $$$ fully managed hosting support.

    If you are happy to go alone or negotiate the level of support then fine. However if you come under attack you will need a level of expertise.

    grep is your friend.

  • phreakphreak Vanilla*APP (White Label) & Vanilla*Skins Shop MVP

    Thanx @x00 for your explanations. I run about 100 websites on my server and they guys are pretty ok (with 24h hotline support and etc.).

    You wrote "Memcache", did you mean "Memcached" as they are pretty different things.

    So activating APC and Memcached in parallel isn't a bad thing, also not for forum software?

    • VanillaAPP | iOS & Android App for Vanilla - White label app for Vanilla Forums OS
    • VanillaSkins | Plugins, Themes, Graphics and Custom Development for Vanilla
  • ShadowdareShadowdare r_j MVP
    edited November 2013

    You can run APC and Memcached at the same time with Vanilla with no problems if they are configured properly. The apc_store function seems to be used in some parts of Vanilla, but not extensively, so you could upgrade to PHP 5.5+, which has replaced APC with Optimzer+, which has been shown to provide more performance in cases where the software doesn't use APC functions extensively.

    Add Pages to Vanilla with the Basic Pages app

  • ShadowdareShadowdare r_j MVP
    edited November 2013

    @phreak said:
    Are there any config settings like the memcached for APC as well?

    There seems to be two config settings related to APC used in /library/core/class.cache.php in the Vanilla 2.2 development builds:

    $Configuration['Garden']['Apc'] = FALSE;
    $Configuration['Garden']['Cache']['ApcPrecache'] = FALSE;
    

    Add Pages to Vanilla with the Basic Pages app

  • phreakphreak Vanilla*APP (White Label) & Vanilla*Skins Shop MVP

    @Shadowdare: Thank you for pointing me there.

    My hoster now told me that there is already "Zend Guard Loader" on my Server. And they recommend it over APC. Seems like Memcache (they don't speak about "MemchacheD") is the thing to add now. Mmhh...

    • VanillaAPP | iOS & Android App for Vanilla - White label app for Vanilla Forums OS
    • VanillaSkins | Plugins, Themes, Graphics and Custom Development for Vanilla
  • php memcache is not supported in vanilla, even though the cache class exists, I don't think it works. Certain version php memcache had bugs for a while, so I think most people used php memached.

    grep is your friend.

  • peregrineperegrine MVP
    edited April 2014

    @x00 said
    Although APC is not used in this case to cahche vanilla object simply having it install and enabled can improve performance.

    aside from downloading apc and installing module (e.g. with apache web server).

    and adding the extension to your ini file (probably depends on your OS)

    /etc/php5/apache2/conf.d/apc.ini
    extension=apc.so

    restart apache server.

    verify it in phpinfo.

    what else should you configure "to do it right" .

    any other settings to do or recommended?

    where do you look to see if it is even doing anything (aside from a performance test).

    Do you just set these to TRUE?

    @shadowdare pointed out some configs

        $Configuration['Garden']['Apc'] = FALSE;
        $Configuration['Garden']['Cache']['ApcPrecache'] = FALSE;
    

    also someone mentioned something about APC and make sure it doesn't cache config.php. HOW? where?

    any tutorials.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • peregrineperegrine MVP
    edited April 2014

    found this example on the web.
    [APC]
    extension=apc.so

    apc.enabled = 1    # Turn APC cache on
    apc.optimization  = 0    # Experimental keep off
    apc.shm_segments = 1    # Shared memory segments
    apc.shm_size = 256M  # Max shared memory dependent on OS
    apc.ttl = 7200
    apc.user_ttl  = 7200
    apc.num_files_hint = 1024
    apc.mmap_file_mask = /tmp/apc.XXXXXX
    apc.enable_cli = 1 # Allow command line php to function
    apc.cache_by_default  = 1 # Enabled, 0 for filters
    apc.max_file_size = 10M # Maximum cached file size
    apc.stat = 1 # 1 for dev, 0 for production, whether the source file is checke$
    ;apc.include_once_override = 1 # Use PHP5.3+ for include_once optimization
    

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

Sign In or Register to comment.