Scale video-on-demand streaming with Wowza Streaming Engine Media Cache

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

Configure Media Cache in Wowza Streaming Engine Manager


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 effect 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 Wowza Streaming Engine by clicking Restart Now. It may take several seconds for Wowza Streaming Engine to restart, but Media Cache will continue to show that the restart is required until this process is complete.

Configure Media Cache stores


Stores define where on demand file sources are cached by Wowza Streaming Engine when requested by clients. 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 10 GB, a maximum write rate of 16 MB per second, and a write rate bucket size of 64 MB. These default settings are adequate for testing and for very low utilization; however, a production environment may require more space and resources.

Note: We recommend that you do not change the default store unless you are an advanced user and have a specific need to do so. You can, however, create, edit, and delete other stores.

To see these settings, click 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.

  1. Click the Stores tab, and then click Add Media Cache Store.

 
  1. On the Basic tab, enter the following values:
     
    • Store Name – The Store Name must be unique and can’t contain less-than (<), greater-than (>), colon (:), quotation (' and "), forward slash (/), backslash (\), pipe (|), question mark (?), asterisk (*), double-dot (..), and tilde (~) characters.
    • Description – A description of the Media Cache store.
    • Path – The path to the storage location where files are cached. The path value must be unique and can't contain less-than (<), greater-than (>), quotation (' and "), backslash (\), pipe (|), question mark (?), and asterisk (*) characters.
    • Maximum Size – The maximum amount of data that can be stored in this cache store, in gigabytes (GB).
    • Write Rate – The maximum rate that content can be written to the cache store.
    • Write Rate Max Bucket Size – The maximum amount of content that is cached before the write rate is throttled.
  2. Click Add.

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.

Edit or delete a Media Cache store

  • To edit a Media Cache store, click the Edit icon for the store.
  • To delete a Media Cache store, click the Delete icon for the store. You can delete any Media Cache store except the default store.

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


Sources are the locations from which Wowza Streaming Engine retrieves the content to be cached. 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 from network-attached file systems, including network file systems and any device that's recognized as a disk by the operating system.
  • 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.
Notes:
  • 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.
  • To address issues with custom modules and SSL connections to external web services, see Troubleshoot custom module connections to external web services. For Google Compute Engine sources, you may need to import certificates for both accounts.google.com:443 and storage.googleapis.com:443.
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 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:


 
  • Prefix – The first part of the URL that clients use to access content from this source. The Prefix must be unique across all sources. A default of path1/ is provided in the Prefix field.
  • Base Path – The file system location where the content can be found.
  • Validate Configuration – The full address to the location that Media Cache uses to find this source. This field updates automatically as you specify the Prefix and Base Path.
  • Minimum Time To Live – Controls how soon content is removed from the cache store when it hasn't been accessed and space is needed.
  • 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. Both HTTP and HTTPS (SSL) requests are supported.


 
  • Prefix – The first part of the URL that clients use to access content from this source. The Prefix must be unique across all sources. A default of http/ is provided in the Prefix field.
  • Base Path – The HTTP or HTTPS URL where the content can be found.
  • Validate Configuration – The full address to the location that Media Cache uses to find this source. This field updates automatically as you specify the Prefix and Base Path.
  • Minimum Time To Live – Controls how soon content is removed from the cache store when it hasn't been accessed and space is needed.
  • 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 licenses with active maintenance and support, including trial licenses, via the Wowza StreamLock™ AddOn.

Add an Amazon S3 HTTP source

A Media Cache AmazonS3 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.


 

  • Prefix – The first part of the URL that clients use to access content from this source. The Prefix must be unique across all sources. A default of amazons3/ is provided in the Prefix field.
  • Base Path – The HTTP URL where the content can be found. The default Base Path for AmazonS3 is http://s3.amazonaws.com/.
  • AWS Access Key ID and AWS Secret Access Key – Enter your Amazon S3 key ID and secret access key to enable Media Cache to sign HTTP requests so that they're authenticated for access to protected content. These values can't contain spaces.
  • Use Amazon S3 bucket name in domain – Select this option to include the bucket name in the domain name. Otherwise, the bucket name is included in the URL path.
  • Validate Configuration – The full address to the location that Media Cache uses to find this source. This field updates automatically as you specify the Prefix and Base Path.
  • Minimum Time To Live – Controls how soon content is removed from the cache store when it hasn't been accessed and space is needed.
  • Maximum Time To Live – Controls when content is removed from the store when it hasn't been accessed regardless of space requirements.
Note: If you created your Amazon S3 bucket within the last 24 hours, you’ll need to add the custom properties awsSigningVersion and awsDefaultRegion. For more information, see Configure source properties for Wowza Streaming Engine Media Cache.

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.


 
  • Prefix – The first part of the URL that clients use to access content from this source. The Prefix must be unique across all sources. A default of http/ is provided in the Prefix field.
  • Blob Storage Account Name – Your Azure Blob account name. This value can't contain spaces.
  • Blob Storage Container Name – The name of a container in your Azure Blob storage. A Media Cache Source can point to only one container in Azure Blob storage.
  • Blob Storage Account Access Key – The primary or secondary access key for the Azure Blob account.
  • Minimum Time To Live – Controls how soon content is removed from the cache store when it hasn't been accessed and space is needed.
  • 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.
  • Prefix – The first part of the URL that clients use to access content from this source. The Prefix must be unique across all sources. A default of http/ is provided in the Prefix field.
  • Google Service Account Email Address – The email address (or account ID) used with your service account.
  • Google Private Key Type – The type of private key file certificate that you selected and downloaded when creating your service account (JSON or P12).
  • Minimum Time To Live – Controls how soon content is removed from the cache store when it hasn't been accessed and space is needed.
  • Maximum Time To Live – Controls when content is removed from the store when it hasn't been accessed regardless of space requirements.

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.

Edit or delete a source

  • To edit a Media Cache source, click the Edit icon for the source.
  • To delete a Media Cache source, click the Delete icon for the source.

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

About Media Cache properties


There are several properties that control 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 more information on Media Cache properties, see the following articles:

Configure an application to use Media Cache


With Media Cache configured and enabled, you can use it in an application. Media Cache must use the VOD Edge application type.

  1. In Wowza Streaming Engine Manager, click the Applications tab, and then click Add Application in the contents panel.
  2. On the Add Application page, click VOD Edge.

 
  1. Enter a name for the application. For the purposes of this tutorial, use the name mediacache.
  2. Click Add.

 
  1. Under Playback Types, select the output formats you want to stream to. By default, all supported playback types are selected.
     
    Note: For more information about playback types, see Understanding protocols and output file formats supported by Wowza Streaming Engine.
  2. Under Media Cache Sources, choose one of the following:
     
    • All Media Cache Sources are available – Makes all sources available to the application.
    • Some Media Cache Sources are available – Lets you select the source or sources you want to make available to the application.
  3. Click Save, and then restart Wowza Streaming Engine.

Media Cache playback


The following table lists URL formats for supported protocols using an example application named mediacache and an example file named sample.mp4. For each URL, [source] should be replaced with the appropriate prefix for the source type:

  • File – path1
  • HTTP – http
  • Amazon S3 – amazons3
  • Azure – https
  • Google Cloud Storage – https/[bucket-name]

Playback URL formats

Protocol Playback URL
Apple iOS device (Cupertino/Apple HTTP Live Streaming) https://[wowza-ip-address]:1935/mediacache/_definst_/mp4:[source]/sample.mp4/playlist.m3u8
MPEG-DASH player https://[wowza-ip-address]:1935/mediacache/_definst_/mp4:[source]/sample.mp4/manifest.mpd
RTSP/RTP player or device rtsp://[wowza-ip-address]:1935/mediacache/_definst_/mp4:[source]/sample.mp4
Adobe Flash Player (RTMP) Server – rtmp://[wowza-ip-address]/mediacache
Stream – mp4:[source]/sample.mp4
Adobe Flash player (San Jose/Flash HTTP) https://[wowza-ip-address]:1935/mediacache/_definst_/mp4:[source]/sample.mp4/manifest.f4m
Microsoft Silverlight (Smooth Streaming) https://[wowza-ip-address]:1935/mediacache/_definst_/mp4:[source]/sample.mp4/Manifest

More resources