Load balancing video streams

Hi.

I want to set up haproxy which would load balance video streams. For example, backend endpoints are:

http://someserver/video/stream1.ts
http://otherserver/stream/stream1.ts

The questions are:
Is this even possible? Since I have no classic http response, how will I know when the backend server is down?

This works (backend section):

server someserver someserver:80 redir http://someserver/video/stream1.ts check
server otherserver otherserver:80 server redir http://otherserver/stream/stream1.ts check

Frontend:

acl is_iptv path_end .ts
use_backend iptv if is_iptv

But:
How will haproxy know that one of the server is down since there is no http response, but a video stream?

Also, I guess because I use “redir”, haproxy just redirects client to the first backend server and it doesn’t know what is happening, It will always send all clients to first server?

Anyway, is there any example how to deal with load balancing such backends (video streaming servers?), should I even use http, or tcp?

In ideal scenario, I would like the client who is connecting to the frontend .ts not even notice a break in the video stream when one of the backend .ts servers goes down.

Best regards,
Dragan

1 Like

Did you ever figure this out? I have a nearly identical problem that I’m trying to design a solution for.

This reminded me of a problem that you don’t typically see with HAProxy as HAProxy deals typically with TCP/HTTP where this is usually less of an issue.

However, if you’re ever using something like LVS to load balance UDP then this is a far more frequent issue! UDP can be really hard to check unless it responds with something, and not every UDP service does.

So my first suggestion is, have you considered using an ‘external’ health check so that you have the freedom to write whatever you need…? I mean, a check like this can do any number of crazy things… For example, I know of a crazy engineer that configured a check that physically connects to the server and checks if the service is running and healthy! He used windows WMI for Linux in this case but you get the idea, an external script might give you more options to go a little crazy and think outside the box if that’s what you need.

https://cbonte.github.io/haproxy-dconv/2.2/configuration.html#external-check