Jump to content


These Forums Are Now Read-Only


For TubePress support, please post a question here or open a support ticket and we will be glad to assist.


Photo

Enable And Configure Your Tubepress Boot Cache

wordpress standalone-php tips performance

  • Please log in to reply
No replies to this topic

#1 eric

eric

    Lead Developer

  • TubePress Staff
  • 2787 posts

Posted 29 July 2013 - 05:38 PM

Starting with TubePress 3.1.0, TubePress can take advantage of a "boot cache" that can dramatically speed up TubePress. In our lab testing, we typically see a 300% - 400% reduction in execution time with the boot cache enabled.

Enabling the cache is easy! You'll just need a text editor. Here's how to do it...

  • Ensure that TubePress debugging is enabled.

    In standalone PHP environments, this is enabled by default. In WordPress environments, ensure the box at WP Admin > Settings > TubePress > Advanced > Enable Debugging is ticked. This will allow you to verify that the cache is working.
     
  • TubePress's boot process is controlled by a single file located within your TubePress content directory at config/boot.json.

    In TubePress 3.1.0+, this file and the config directory are included by default. In older versions of TubePress, simply create the config/boot.json file and fill it with the following contents:
    {
        "cache" : {
    
            "ioc-container" : {
    
                "enabled" : false
            },
    
            "add-ons" : {
    
                "enabled" : false
            },
    
            "classloader" : {
    
                "enabled" : false
            },
    
            "option-descriptors" : {
    
                "enabled" : false
            },
    
            "killer-key" : "tubepress_boot_cache_kill",
    
            "dir" : null
        },
    
        "add-ons" : {
    
            "blacklist": []
        },
    
        "classloader" : {
    
            "enabled" : true
        }
    }
    
  • Replace each instance of false with true, and set the value of killer-key to a random string.

    Your copy of config/boot.json should now look something like this:
    {
        "cache" : {
    
            "ioc-container" : {
    
                "enabled" : true
            },
    
            "add-ons" : {
    
                "enabled" : true
            },
    
            "classloader" : {
    
                "enabled" : true
            },
    
            "option-descriptors" : {
    
                "enabled" : true
            },
    
            "killer-key" : "tIEKrw84k7z760811D815363425xa15370W",
    
            "dir" : null
        },
    
        "add-ons" : {
    
            "blacklist": []
        },
    
        "classloader" : {
    
            "enabled" : true
        }
    }
    
  • Verify that the boot cache is working by examining your TubePress debug output. You should see something similar to the following:
    Default Boot Config Service: Attempting to read boot config from /var/www/ttg.lan/wordpress/wp-content/tubepress-content/config/boot.json 
    Default Boot Config Service: Successfully read boot config from /var/www/ttg.lan/wordpress/wp-content/tubepress-content/config/boot.json 
    Default Boot Config Service: classloader caching is enabled
    Default Boot Config Service: add-ons caching is enabled
    ...
    Default Add-on Discoverer: Successfully hydrated from cache file at ... /serialized-addons.txt
    Default Boot Config Service: ioc-container caching is enabled
    ...
    Default IOC Boot Helper: Successfully hydrated from cache file at ... /cached-ioc-container.php
    ...
    Default Boot Config Service: option-descriptors caching is enabled 
    Default Option Descriptor Reference: Successfully hydrated from cache file at ... /serialized-option-descriptors.txt
    ...
    TubePress Bootstrapper: Boot completed in 28.892893 milliseconds 
    
     If your debug output is missing any of these bolded phrases, it means that something is misconfigured. Feel free to post a question in the forum to get help.

 

That's it! The rest of this post details the contents of config/boot.json for advanced users. Let's examine each piece of the file...

        "ioc-container" : {

            "enabled" : false
        },

        "add-ons" : {

            "enabled" : false
        },

        "classloader" : {

            "enabled" : false
        },

        "option-descriptors" : {

            "enabled" : false
        },

This section of the file enables or disables the caching of individual elements of TubePress's internals. Most users will set all of these elements to either true or false.

 

        "killer-key" : "tubepress_boot_cache_kill",

The "killer key" can be used to remotely and securely clear TubePress's cache. The value of killer-key can be used as a query parameter to signal to TubePress to clear the boot cache. e.g. if the value of killer-key is tubepress_boot_cache_kill, then adding tubepress_boot_cache_kill=true to the URL of a TubePress gallery will clear the entire boot cache.
 

        "dir" : null

The dir option allows you to manually configure a directory where TubePress will store its boot cache. If you leave its value as null, TubePress will attempt to use the system's cache directory.

 

    "add-ons" : {

        "blacklist": []
    },

This section allows you to identify, by name, a set of add-ons that will be excluded from TubePress. If you are not using a particular add-on, adding it to the blacklist will improve TubePress's performance.

 

    "classloader" : {

        "enabled" : true
    }

By default, TubePress uses its own high-performance PSR-0 compliant classloader. If you would like to use a classloader defined elsewhere, you can set this value to false.







Also tagged with one or more of these keywords: wordpress, standalone-php, tips, performance