• How to scale video on demand streaming with Media Cache

    Media Cache is a read-through caching mechanism built-in with Wowza Streaming Engine™ software that increases the scalability of video on demand (VOD) streaming for your media server configuration. This article provides information about configuring the Media Cache feature in Wowza Streaming Engine Manager in production environments. It describes the default configuration on the server and how to change where content is stored and retrieved when using Media Cache.

    Notes:
    • Wowza Media Server™ 3.6.4 users can get the MediaCache AddOn by completing the AddOn Request form. After your license has been verified, within three business days, you'll receive an email with download instructions.

    • Wowza Streaming Engine 4.4.0 or later is required to use encrypted HTTP (https://) connections or Azure Blob storage account containers as Media Cache sources.

    • Wowza Streaming Engine 4.5.0 or later is required to use a Google Cloud Storage Bucket as a Media Cache source.

    Contents


    Configure Media Cache in Wowza Streaming Engine Manager
    Configure Media Cache stores
    Configure Media Cache sources
    About Media Cache properties
    Configure an application to use Media Cache
    Media Cache playback
    More resources

    Configure Media Cache in Wowza Streaming Engine Manager


    Note: Wowza Streaming Engine Manager requires authentication, which is the user name and password specified in the [install-dir]/conf/admin.password file.
    Wowza Streaming Engine automatically enables Media Cache when it starts; however, additional configuration is required in a production environment. By default, Wowza Streaming Engine Manager can be accessed by using the following URL:
    https://[wowza-ip-address]:8088/enginemanager
    After you've accessed Streaming Engine Manager, click the Server tab at the top of the manager, and then select Media Cache in the contents panel. The Media Cache page shows the default status as Enabled.



    Disable Media Cache

    Leaving Media Cache enabled has no adverse affect on performance and we recommend that you leave it enabled unless you have a specific reason to turn it off.

    If you decide to disable Media Cache, click Disable Media Cache. You will see the following notification:



    Media Cache is disabled but before your changes can take effect, you must restart the server by clicking Restart Now. It may take several seconds for the server to restart, but Media Cache will continue to show that the restart is required until this process is complete.

    Enable Media Cache

    You can enable Media Cache functionality by clicking Enable Media Cache. If you decide to re-enable Media Cache, the following notification is displayed.



    Media Cache is now enabled. However, before your changes can take effect, you must restart the server by clicking Restart Now. It may take several seconds for the server to restart, but Media Cache will continue to show that the restart is required until this process is complete.

    Configure Media Cache stores


    The default settings for Media Cache define a store location in a mediacache folder in the Wowza Streaming Engine installation directory ([install-dir]). This folder has a maximum size of 10GB, a maximum write rate of 16 MB per second, and a write rate bucket size of 64MB. These default settings are adequate for testing and for very low utilization; however, a production environment may require more space and resources.

    To see these settings, click on the Stores tab, and then click the Edit (pencil) icon for the default store.



    The Path setting allows the use of Wowza Streaming Engine variables. For example, the variable defined as ${com.wowza.wms.context.ServerConfigHome}/mediacache provides a folder named mediacache in the server configuration location. You can change this location and use the standard set of variables that are supported. If the folder you define doesn't exist, Wowza Streaming Engine will create it if you have the necessary permissions.

    Add a Media Cache store

    You can add more than one store for use with Media Cache. In most cases, this isn't required. However, if you have multiple disks and want to use them for cache storage, you must add a new store for each location. To do this, click the Stores tab, and then click Add Media Cache Store. The following screen will be displayed:



    The Path, Maximum Size, Write Rate, and Write Rate Max Bucket Size values are filled in by default, but the Store Name is required and must be unique (different from all other store names). The Description is optional. When you have entered the information for the new store, click Add. You will then see the following screen:



    You can see the same information as before about the store; however, now you should also see the Delete (trash can) icon, providing you the option to delete the store.

    Delete a Media Cache store

    You can delete any Media Cache store except the default store. To delete a store, click the Delete icon next to the required store and you will get the following prompt:



    Click OK to remove the store. You should then see the following screen:



    To completely remove the store, restart Wowza Streaming Engine as prompted. The store remains in use until the server is restarted.

    Configure Media Cache sources


    Media Cache can retrieve content from three different types of sources, providing very flexible deployment options. The sources can be any of the following:

    • File - Content is retrieved via standard file reads.
    • HTTP - Content is retrieved via standard HTTP requests. The HTTP connection can be encrypted using Secure Sockets Layer (SSL) certificates from a certificate authority.
    • Amazon S3 HTTP - Content is retrieved via HTTP requests that conform to Amazon S3 specifications.
    • Microsoft Azure - Content is retrieved from an Azure Blob storage account.
    • Google Cloud Storage - Content is retrieved from a Google Cloud Storage Bucket.

    Note: Microsoft Azure sources and HTTPS (SSL) requests are supported in Wowza Streaming Engine 4.4.0 and later. Google Cloud Storage Bucket sources are supported in Wowza Streaming Engine 4.5.0 and later.
    Click Sources to see a list of your sources, as shown below:



    The default dvrorigin source is already defined. This Media Cache source can't be removed as it allows interaction with Wowza nDVR. This entry can be ignored for the purposes of this tutorial.

    Click Add Media Cache Source, and you'll be presented with the following options:



    The Source Name must be a unique name across all the defined sources. The optional Description can include as much or as little detail as you want about the source. Also, you don't need to select a Source Type as the input fields available for the source will change when selected.

    Add a File source

    A Media Cache File source reads content from a file location. This source type is designed to allow retrieval from slower disk sources such as single large disks with lower RPMs, network attached storage (NAS), or even NFS storage locations. The options required are shown below:



    The Source Name, Prefix, Base Path, Minimum Time To Live, and Maximum Time To Live are all required. The Source Name and Prefix must be unique across all sources.

    The Prefix forms part of the URL that clients use to access content provided by this source and the Base Path is the file system location where the content can be found. A default of path1/ is provided in the Prefix field and, as you update information for the source, the Validate Configuration box automatically changes to match. You should check the field showing the full address to your content to make sure your content is located here before committing to adding the source. The Minimum Time To Live controls how soon content is removed from the cache store when it hasn't been accessed and space is needed. The Maximum Time To Live controls when content is removed from the store when it hasn't been accessed regardless of space requirements.

    Add an HTTP source

    A Media Cache HTTP source retrieves content from an HTTP 1.1-compliant web server. This source type is designed to allow retrieval from web servers to help you manage your content outside of Wowza Streaming Engine. No authentication is performed when using this method to make HTTP requests.



    The Source Name, Prefix, Base Path, Minimum Time To Live, and Maximum Time To Live are all required. The Source Name and Prefix must be unique across all sources.

    The Prefix forms part of the URL that clients use to access content provided by this source and the Base Path is the HTTP or HTTPS URL location where the content can be found. A default of https/ is provided in the Prefix field and, as you update information for the source, the Validate Configuration box automatically changes to match. The field showing the full address to your content should be checked to make sure your content is located here before committing to adding the source. The Minimum Time To Live controls how soon content is removed from the cache store when it hasn't been accessed and space is needed. The Maximum Time To Live controls when content is removed from the store when it hasn't been accessed regardless of space requirements.

    Notes:
    • When using a HTTPS source it is important to use the version of Java that ships with Wowza Streaming Engine to ensure Java SSL certificates are up to date.

    • Wowza provides free 256-bit SSL certificates to users with Subscription and Perpetual licenses via the Wowza StreamLock™ AddOn.

    Add an Amazon S3 HTTP source

    A Media Cache Amazon S3 HTTP source retrieves content from an HTTP 1.1 compliant web server. This source type is designed to allow retrieval from web servers that use S3-style authentication so you can manage your content outside of Wowza Streaming Engine.



    The Source Name, Prefix, Base Path, Minimum Time To Live, and Maximum Time To Live are all required. The Source Name and Prefix must be unique across all sources.

    The Prefix forms part of the URL that clients will use to access content provided by this source and the Base Path is the HTTP URL location where the content can be found. A default of amazons3/ is provided in the Prefix field and https://s3.amazonaws.com/ in the Base Path files. To access an S3 bucket, you must specify the AWS Access Key ID and the AWS Secret Access Key; otherwise, Media Cache can't authenticate. As you update information for the source, the Validate Configuration automatically changes to match. You should check the field showing the full address to your content to make sure your content is located here before committing to adding the source. The Minimum Time To Live controls how soon content is removed from the cache store when it hasn't been accessed and space is needed. The Maximum Time To Live controls when content is removed from the store when it hasn't been accessed regardless of space requirements.

    Add a Microsoft Azure source

    A Media Cache Azure source retrieves content from an Azure Blob storage account. This source type is designed to allow retrieval from an Azure Blob account using the API key and container name so you can manage your content outside of Wowza Streaming Engine.



    The Source Name, Prefix, Minimum Time To Live, and Maximum Time To Live are all required. The Source Name and Prefix must be unique across all sources.

    The Prefix forms part of the URL that clients will use to access content provided by this source. To access an Azure Blob account, you must specify the Blob Storage Account Name, Blob Storage Container Name and the Blob Storage Account Access Key; otherwise, Media Cache can't authenticate. Make sure to only include a single container name as a Media Cache source can only point to one container. The Minimum Time To Live controls how soon content is removed from the cache store when it hasn't been accessed and space is needed. The Maximum Time To Live controls when content is removed from the store when it hasn't been accessed regardless of space requirements.

    Add a Google Cloud Storage source

    A Media Cache GoogleCloudStorage source retrieves content from a Google Cloud Storage Bucket. This source type is designed to allow retrieval from a Google Cloud service account using either JSON or P12 private key certification (JSON is recommended) so you can manage your content outside of Wowza Streaming Engine.

    Note: You can create and access Google Cloud service accounts through the Google Developers Console. For more information about Google Cloud service accounts, see the Google Cloud Storage Authentication documentation.
    The Source Name, Prefix, Minimum Time To Live, and Maximum Time To Live are all required. The Source Name and Prefix must be unique across all sources.

    The Prefix forms part of the URL that clients will use to access content provided by this source. A default of https/ is provided in the Prefix field. To access a Google Cloud service account and bucket, you must specify the Google Private Key Type, Google Service Account Email Address, and private key file information; otherwise, Media Cache can't authenticate.

    If you're using a JSON private key file for certification, select JSON as the Google Private Key Type, open the downloaded JSON private key file in a text editor, and then copy and paste the file contents into the Google JSON Private Key box.



    If you're using a P12 private key file for certification, copy the downloaded P12 private key file to your Wowza Streaming Engine [install-dir]/conf directory. Then select P12 as the Google Private Key Type, enter the name of the file (including the file extension) in Google P12 Private Key File Name, and enter the password to access the private key Google P12 Private Key Password.



    The Minimum Time To Live controls how soon content is removed from the cache store when it hasn't been accessed and space is needed. The Maximum Time To Live controls when content is removed from the store when it hasn't been accessed regardless of space requirements.

    Delete a source

    To delete a Media Cache source, click the Sources tab on the Media Cache page, and then click the Delete (trash can) icon for the source you want to remove.



    You'll be prompted to confirm that you want to delete the source.



    After you've clicked OK to confirm your deletion, the source will be deleted, but to completely remove it, you must restart the server as prompted at the top of the page.

    About Media Cache properties


    There are several properties that affect Media Cache, store, and source behavior. Users with administrative permissions can access the Properties tabs to customize these settings. Only advanced users should change properties. The primary reason to edit properties is to improve performance.

    For information on how to configure Media Cache properties, including adding custom properties, see the Wowza Streaming Engine Media Cache User's Guide (PDF).

    Configure an application to use Media Cache


    To use Media Cache in an application, you must create a VOD Edge application, as shown below:



    After you've selected the correct application type, you can choose a name. For the purposes of this tutorial, use the name mediacache. After choosing your application type and entering your application name, click Add. You'll see the following screen:



    You can now access one or more defined Media Cache sources. By default, all sources are made available to an application. After you make any changes, you must click Save and then Restart before your changes will take effect.

    Media Cache playback


    Playback from a File source

    To play content from a File source:

    • Use the application named mediacache.

    • Use an example File source with the prefix path1.

    • Use a file named sample.mp4 in your source location.

    • Use the following URLs and examples:

      Adobe Flash Player (RTMP)


      Server: rtmp://[wowza-ip-address]/mediacache
      Stream: mp4:path1/sample.mp4

      Adobe Flash player (San Jose/Flash HTTP)


      https://[wowza-ip-address]:1935/mediacache/_definst_/mp4:path1/sample.mp4/manifest.f4m

      Apple iOS device (Cupertino/Apple HTTP Live Streaming)


      https://[wowza-ip-address]:1935/mediacache/_definst_/mp4:path1/sample.mp4/playlist.m3u8

      Microsoft Silverlight (Smooth Streaming)


      https://[wowza-ip-address]:1935/mediacache/_definst_/mp4:path1/sample.mp4/Manifest

      MPEG-DASH player


      https://[wowza-ip-address]:1935/mediacache/_definst_/mp4:path1/sample.mp4/manifest.mpd

      RTSP/RTP player or device


      rtsp://[wowza-ip-address]:1935/mediacache/_definst_/mp4:path1/sample.mp4

    Playback from an HTTP source

    To play content from an HTTP source:

    • Use the application named mediacache.

    • Use an example HTTP source with the prefix https.

    • Use a file named sample.mp4 on the remote HTTP server.

    • Use the following URLs and examples:

      Adobe Flash Player (RTMP)


      Server: rtmp://[wowza-ip-address]/mediacache
      Stream: mp4:https/sample.mp4

      Adobe Flash player (San Jose/Flash HTTP)


      https://[wowza-ip-address]:1935/mediacache/_definst_/mp4:https/sample.mp4/manifest.f4m

      Apple iOS device (Cupertino/Apple HTTP Live Streaming)


      https://[wowza-ip-address]:1935/mediacache/_definst_/mp4:https/sample.mp4/playlist.m3u8

      Microsoft Silverlight (Smooth Streaming)


      https://[wowza-ip-address]:1935/mediacache/_definst_/mp4:https/sample.mp4/Manifest

      MPEG-DASH player


      https://[wowza-ip-address]:1935/mediacache/_definst_/mp4:https/sample.mp4/manifest.mpd

      RTSP/RTP player or device


      rtsp://[wowza-ip-address]:1935/mediacache/_definst_/mp4:https/sample.mp4

    Note: If using HTTPS (SSL) requests, you can substitute https:// for https:// in the URL examples.

    Playback from an Amazon S3 HTTP source

    To play content from an Amazon S3 HTTP source:

    • Use the application named mediacache.

    • Use an example S3 source with the prefix amazons3.

    • Use a file named sample.mp4 on the remote S3 server.

    • Use the following URLs and examples:

      Adobe Flash Player (RTMP)


      Server: rtmp://[wowza-ip-address]/mediacache
      Stream: mp4:amazons3/sample.mp4

      Adobe Flash player (San Jose/Flash HTTP)


      https://[wowza-ip-address]:1935/mediacache/_definst_/mp4:amazons3/sample.mp4/manifest.f4m

      Apple iOS device (Cupertino/Apple HTTP Live Streaming)


      https://[wowza-ip-address]:1935/mediacache/_definst_/mp4:amazons3/sample.mp4/playlist.m3u8

      Microsoft Silverlight (Smooth Streaming)


      https://[wowza-ip-address]:1935/mediacache/_definst_/mp4:amazons3/sample.mp4/Manifest

      MPEG-DASH player

      https://[wowza-ip-address]:1935/mediacache/_definst_/mp4:amazons3/sample.mp4/manifest.mpd

      RTSP/RTP player or device


      rtsp://[wowza-ip-address]:1935/mediacache/_definst_/mp4:amazons3/sample.mp4

    Playback from a Microsoft Azure source

    To play content from an Azure source:

    • Use the application named mediacache.

    • Use an example Azure source with the prefix https.

    • Use a file named sample.mp4 on the remote server.

    • Use the following URLs and examples:

      Adobe Flash Player (RTMP)


      Server: rtmp://[wowza-ip-address]/mediacache
      Stream: mp4/sample.mp4

      Adobe Flash player (San Jose/Flash HTTP)


      https://[wowza-ip-address]:1935/mediacache/_definst_/mp4:https/sample.mp4/manifest.f4m

      Apple iOS device (Cupertino/Apple HTTP Live Streaming)


      https://[wowza-ip-address]:1935/mediacache/_definst_/mp4:https/sample.mp4/playlist.m3u8

      Microsoft Silverlight (Smooth Streaming)


      https://[wowza-ip-address]:1935/mediacache/_definst_/mp4:https/sample.mp4/Manifest

      MPEG-DASH player

      https://[wowza-ip-address]:1935/mediacache/_definst_/mp4:https/sample.mp4/manifest.mpd

      RTSP/RTP player or device


      rtsp://[wowza-ip-address]:1935/mediacache/_definst_/mp4:https/sample.mp4

    Playback from a Google Cloud Storage source

    To play content from a Google Cloud Storage source:

    • Use the application named mediacache.

    • Use an example Google Cloud Storage source with the prefix https.

    • Use a file named sample.mp4 in a bucket named myBucket on the remote server.

    • Use the following URLs and examples:

      Adobe Flash Player (RTMP)


      Server: rtmp://[wowza-ip-address]/mediacache
      Stream: mp4:https/myBucket/sample.mp4

      Adobe Flash player (San Jose/Flash HTTP)


      https://[wowza-ip-address]:1935/mediacache/_definst_/mp4:https/myBucket/sample.mp4/manifest.f4m

      Apple iOS device (Cupertino/Apple HTTP Live Streaming)


      https://[wowza-ip-address]:1935/mediacache/_definst_/mp4:https/myBucket/sample.mp4/playlist.m3u8

      Microsoft Silverlight (Smooth Streaming)


      https://[wowza-ip-address]:1935/mediacache/_definst_/mp4:https/myBucket/sample.mp4/Manifest

      MPEG-DASH player

      https://[wowza-ip-address]:1935/mediacache/_definst_/mp4:https/myBucket/sample.mp4/manifest.mpd

      RTSP/RTP player or device


      rtsp://[wowza-ip-address]:1935/mediacache/_definst_/mp4:https/myBucket/sample.mp4

    More resources



    Originally Published: 10-02-2010.
    Updated: For Wowza Streaming Engine 4.5.0 on 06-23-2016.

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