• How to preload files for the Media Cache system (MediaCachePreload)

    The MediaCachePreload server listener for Wowza Streaming Engine™ media server software enables you to specify on-demand video files to preload into the Media Cache before first playback.

    Contents


    Prerequisites
    Installation
    Configuration
    Properties
    Usage
    For developers
    More resources

    Prerequisites


    Wowza Streaming Engine™ 4.0.0 or later is required.

    Installation


    1. Download wse-plugin-mediacachepreload.zip.

    2. Extract the contents from the downloaded (zipped) package, and then copy the lib/wse-plugin-mediacachepreload.jar file from the package to the lib folder in your Wowza Streaming Engine installation ([install-dir]/lib).

    3. Restart Wowza Streaming Engine.

    Configuration


    To enable the server listener, add the following server listener definition to your server configuration. See Configure server listeners for details.

    Base Class
    com.wowza.wms.plugin.mediacachepreload.ServerListenerMediaCachePreload

    Properties


    After enabling the server listener, you can adjust the default settings by adding the following properties to your server. See Configure properties for details.

    Path
    Name
    Type
    Value
    Notes
    /Root/Server mediaCachePreloadApplication String vod-edge Name of the Media Cache application. Use the default or an application name that includes the stream type of the file; otherwise, Streaming Engine will use the first application it finds in your applications folder. (default: not set)
    /Root/Server mediaCachePreloadTargetPath String ${com.wowza.wms.AppHome}/conf/mediacachepreloadtargets.txt Path where your target text file (.txt) is stored. If the text file is in a non-standard location (outside of the project default /conf folder), specify that path here. (default: ${com.wowza.wms.AppHome}/conf/mediacachepreloadtargets.txt)
    /Root/Server mediaCachePreloadLoadType String defaultBlockSize Type value that affects how the mediaCachePreloadLoadValue property is used, either defaultBlockSize or bytes. (default: defaultBlockSize)
    /Root/Server mediaCachePreloadLoadValue Integer 3 Number of blocks to load into the Media Cache. If the mediaCachePreloadLoadType is defaultBlockSize, Streaming Engine preloads this number of blocks into the Media Cache. If mediaCachePreloadLoadType is bytes, this number of bytes is loaded into the Media Cache. This setting can be overridden for individual files in the target's file (see below). (default: 3)
    /Root/Server mediaCachePreloadContentsDisplayInterval Integer 5000 Time, in milliseconds, to wait between a Media Cache contents dump within the logs. (default: 5000)
    /Root/Server mediaCachePreloadThreads Integer 5 Size of the thread pool used for preloading the Media Cache. (default: 5)
    /Root/Server mediaCachePreloadDebugLog Boolean true Flag that enables or disables extra debug logging. (default: false)

    Usage


    You can define a list of files that you want to preload in the [install-dir]/conf/mediacachepreloadtargets.txt file. As long as Wowza Streaming Engine is running, it will preload the listed files into Media Cache, as requested.

    You can update this file at any time while Wowza Streaming Engine is running to preload new cache items as needed. Each file to be preloaded must be specified on a new line in the target's file. Empty lines and comments (lines starting with "#") are ignored.

    Files must be defined with the full path as shown in the following example:
    #[prefix]:[mediacache-prefix]/[path-to-file]		[preload-value]
    #[preload-value] is optional and will override the mediaCachePreloadLoadValue property.
    
    # s3 example. load entire file
    mp4:amazons3/123456/test/myfile.mp4	-1 
    
    # NAS example. load 5 blocks
    mp4:content1/sample.mp4		5
    If you set the preload-value to -1, the entire file is preloaded.

    If you set the preload-value to 1 or greater, that number of blocks or bytes, depending on the mediaCachePreloadLoadType property setting, is preloaded.

    For developers


    Source code is available on GitHub.

    More resources


    How to scale video on demand streaming with Media Cache

    Wowza Media Cache Deployment Architecture white paper
    Wowza media server software and all components, including modules, source code, and other related items offered on this page, are copyrighted (c) 2006-2016 by Wowza Media Systems, LLC, all rights reserved, and are licensed pursuant to the Wowza Media Software End User License Agreement.
    Originally Published: For Wowza Streaming Engine on 02-26-2014.
    Updated: 06-14-2014.

    If you're having problems or want to discuss this article, post in our forum.