Using Varnish for Streaming Live and VoD Media
Using Varnish for Streaming Live and VoD Media
When it comes to streaming media, a proxy solution can be of big benefit. But there are often a lot of questions around what can and cannot be done. Read on for some FAQs about how Varnish can be used in this scenario.
Join the DZone community and get the full member experience.Join For Free
xMatters delivers integration-driven collaboration that relays data between systems, while engaging the right people to proactively resolve issues. Read the Monitoring in a Connected Enterprise whitepaper and learn about 3 tools for resolving incidents quickly.
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 that 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 the 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 offers 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.
Published at DZone with permission of Pål Hermunn Johansen , DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.