August 16, 2017
4 min read time

Using Varnish for Streaming live and VoD media - FAQs

Our recent webinar on live and OTT/on-demand video streaming brought up some frequently asked questions about using Varnish for streaming. I don’t think it’s an understatement to say that streaming - and enabling reliable, high-performance streaming - is a hot topic… so we’re going to address some of these questions here.

And we invite you to ask questions: What do you want or need to know about video streaming with Varnish?

How many CPUs would a Varnish Plus instance with MSE need with around 40TB of storage?

Not a lot of CPU power is needed.

In a normal server, CPU is not the limiting factor. Instead you should focus on memory and storage. Varnish has always been nice in terms of CPU usage, so we would advise that you use whatever the go-to CPU is for you at the time you set things up.

Is Varnish High Availability (VHA) compatible with an active/active Varnish cluster?

Most installations with VHA are run with an active/active VHA configuration. And they will both replicate content onto each other. It is not a master-slave relationship.

Part of the idea is that we are saturating the network - two Varnish servers, twice the amount of network interface cards that can send data to the clients. Of course, you also have the failover. You can have many side-by-side VHA instances, and this will give you a high degree of redundancy, but also the added capacity of using more than one Varnish server.

Can Varnish be deployed as an instance for both video-on-demand (VOD) and live video, or do you need it to be configured for the specific role or purpose?

The only reason we bring them up separately is because they are ‘different animals’. Linear video has limited storage requirements, with the video to be streamed divided into chunks to make it more manageable. With OTT/VoD, the end-user is accessing the long tail of content, so there isn’t the same ‘deadline pressure’ you have with live streaming (i.e., just-in-time segment publishing). However, there is more pressure to cache and serve video from a potentially vast library with terabytes of content.

It is possible to create a setup in which you make sure the correct server is contacted for different types of video - although both live and on-demand video have different requirements, a single server can handle them if you create different caching strategies to manage them. We’d clearly recommend having different Varnish servers to meet the different needs, though.

Are there any limitations on object size?

High quality video segments can get quite large. It used to be the case in Varnish 3 that this would be detrimental to time to first byte because you’d have to wait for the whole segment before you could send the first byte to clients, creating considerable latency. In Varnish 4 and more recent versions, object size isn’t as much an issue because these versions have separated frontend and backend requests and made many other streaming-related improvements, including that it starts to deliver content as soon as bits start flowing into server. In this way, caching bigger files isn’t really a problem.

Can you provide any recommendations to avoid buffer bloat?

The best advice we can give is to ensure that you ban or purge objects that you have realized should not be in the cache. That is, do whatever you can to control the objects in the cache.

Can this be combined with one or more CDNs?

As we see the use of CDNs evolve to include multiple CDN setups and hybrid setups that include both public and private CDNs, the idea of having control over how, when and from where they distribute content becomes increasingly important.

So, yes, many people are using multiple CDNs and different solutions to balance the load across them. We have a partnership with Cedexis, for example, which offers solutions that let you load balance among multiple CDNs. You should also consider cloud servers as a part of a multi-CDN setup. Varnish Software offer cloud servers with support for registered users.

What about HTTPS support?

To enable this encryption, you need to have an HTTPS terminator in front of Varnish; Varnish Software maintains Hitch, which is a high-performance, open source TLS/SSL proxy, which is used in Varnish to terminate HTTPS connections. Backend TLS is built into Varnish Cache Plus and will give you TLS support on both the frontend and backend.

Any questions?

Are there still any burning questions out there about using Varnish for streaming? We’re eager to hear them. Get in touch with us.

Meanwhile, you can watch the webinar, Live streaming and OTT with Varnish, on-demand to learn more.

watch the webinar

Photo by Meddy Huduti on Unsplash