availo / wowza-vhost-loadbalancer

Virtualhost-capable loadbalancer for Wowza Media Server
19 stars 7 forks source link

Real VHost Based LB solution needed #5

Closed pilgrims1 closed 10 years ago

pilgrims1 commented 10 years ago

Hi you..... like several reply... I already succeed in run both LB Listener & Sender one Physical Server. availo01 availo02

Of cause .... I put same lines into every VHost.xml too. But they say nothing to LB Listener.

  1. If I run two physical two server, vhost based load balancing works as my hope?
  2. If any setting is can't achieve my goal, can you make modified module for me with some pay????

Thank you for your reading

brynjare commented 10 years ago

Hi again pilgrims1,

Thank you for your interest in this module, and for taking the time to create a new issue for your question!

I have tested locally here, and can confirm that it's possible to run both the Sender and the Receiver on the same Wowza installation, in two separate vhosts - since the HTTPStreamers.xml is now created per VHost. (Previously, this would create a problem with load balancing HTTP streams.)

This does require some changes to the module in order to work, though - so I will have to prepare a new version and commit it to github before it's possible to achieve it on your server. Unfortunately, I can't give any guarantees as to when I'm able to upload the next version - but I may be able to commit the current WIP and let you guys play around with it in a test environment.

Unless you also have at least one other physical server to loadbalance to, however, I am still trying to understand what you are hoping to achieve by this approach. If you don't mind, please feel free to explain how you want the load balancing to work (preferably with an example scenario), and I'll be happy to consider whether any other changes are needed for it to be feasible.

If you haven't done so already, I would recommend you to enable "DEBUG" (instead of INFO) in log4j.properties, as this will make your Wowza server tell you a lot more about what is going on while troubleshooting the load balancer.

pilgrims1 commented 10 years ago

This is my goal.... vhost lb diagram 01

I want to run as possible as many VHosts and edge in it as physical server machine can host.....

and each VHosts already binded each own IPs.

And each VHosts act like edge server....

every LB sender and listener work well....

thru this..... I can service more connections.

Can you help me???

pilgrims1 commented 10 years ago

Can you teach me make or send example HTTPStreamer.xml ???? I can't find any existing that file and can't find detail guide for that file... :)

brynjare commented 10 years ago

You can use jar fx wms-server.jar 'com/wowza/wms/conf/HTTPStreamers.xml' to extract the relevant file from the jar file, and then follow the "Step 4b" from the manual, to replace the original module with the redirector modules.

(The new HTTPStreamers.xml file should be placed in the same folder as the VHost.xml where you have com.availo.wms.plugin.vhostloadbalancer.HTTPLoadBalancerRedirector enabled.)

This is the HTTPStreamers.xml I've been using while testing version 4, but there may have been some changes since I'm still on version 4.0.3:

<?xml version="1.0" encoding="UTF-8"?>
<Root version="1">
    <HTTPStreamers>
        <HTTPStreamer>
            <Name>mpegdashstreaming</Name>
            <Description>MPEG Dash Streaming</Description>
            <BaseClass>com.wowza.wms.httpstreamer.mpegdashstreaming.httpstreamer.HTTPStreamerAdapterMPEGDashStreamer</BaseClass>
            <ApplicationContextClass>com.wowza.wms.httpstreamer.mpegdashstreaming.httpstreamer.HTTPStreamerApplicationContextMPEGDashStreamer</ApplicationContextClass>
            <RequestFilters>*.mpd|*_mpd.m4s</RequestFilters>
            <IdleFrequency>250</IdleFrequency>
            <LiveStreamPacketizer>mpegdashstreamingpacketizer</LiveStreamPacketizer>
            <LiveStreamRepeater>mpegdashstreamingrepeater</LiveStreamRepeater>
            <Properties>
                <Property>
                    <Name>newSessionTimeout</Name>
                    <Value>8000</Value>
                    <Type>Integer</Type>
                </Property>
                <Property>
                    <Name>validSessionTimeout</Name>
                    <Value>25000</Value>
                    <Type>Integer</Type>
                </Property>
                <Property>
                    <Name>streamStreamType</Name>
                    <Value>httpstreamer</Value>
                </Property>
                <Property>
                    <Name>repeaterStreamType</Name>
                    <Value>httprepeater-edge</Value>
                </Property>
                <Property>
                    <Name>requestTimeout</Name>
                    <Value>12000</Value>
                    <Type>Integer</Type>
                </Property>
                <Property>
                    <Name>tcpTimeToLive</Name>
                    <Value>9000</Value>
                    <Type>Integer</Type>
                </Property>
                <Property>
                    <Name>tcpKeepAliveTimeout</Name>
                    <Value>9000</Value>
                    <Type>Integer</Type>
                </Property>
                <!--
                <Property>
                    <Name>mpegdashUserHTTPHeaders</Name>
                    <Value>Access-Control-Allow-Origin:*|Access-Control-Allow-Methods:GET, HEAD, OPTIONS</Value>
                </Property>
                -->
            </Properties>
        </HTTPStreamer>
        <HTTPStreamer>
            <Name>smoothstreaming</Name>
            <Description>Silverlight Smooth Streaming</Description>
            <BaseClass>com.wowza.wms.httpstreamer.smoothstreaming.httpstreamer.HTTPStreamerAdapterSmoothStreamer</BaseClass>
            <ApplicationContextClass>com.wowza.wms.httpstreamer.smoothstreaming.httpstreamer.HTTPStreamerApplicationContextSmoothStreamer</ApplicationContextClass>
            <RequestFilters>*/Manifest|*.ismv|*.isma|*.ismd|*clientaccesspolicy.xml</RequestFilters>
            <IdleFrequency>250</IdleFrequency>
            <LiveStreamPacketizer>smoothstreamingpacketizer</LiveStreamPacketizer>
            <LiveStreamRepeater>smoothstreamingrepeater</LiveStreamRepeater>
            <Properties>
                <Property>
                    <Name>newSessionTimeout</Name>
                    <Value>8000</Value>
                    <Type>Integer</Type>
                </Property>
                <Property>
                    <Name>validSessionTimeout</Name>
                    <Value>25000</Value>
                    <Type>Integer</Type>
                </Property>
                <Property>
                    <Name>streamStreamType</Name>
                    <Value>httpstreamer</Value>
                </Property>
                <Property>
                    <Name>repeaterStreamType</Name>
                    <Value>httprepeater-edge</Value>
                </Property>
                <Property>
                    <Name>requestTimeout</Name>
                    <Value>12000</Value>
                    <Type>Integer</Type>
                </Property>
                <Property>
                    <Name>tcpTimeToLive</Name>
                    <Value>9000</Value>
                    <Type>Integer</Type>
                </Property>
                <Property>
                    <Name>tcpKeepAliveTimeout</Name>
                    <Value>9000</Value>
                    <Type>Integer</Type>
                </Property>
                <!--
                <Property>
                    <Name>smoothUserHTTPHeaders</Name>
                    <Value>Access-Control-Allow-Origin:*|Access-Control-Allow-Methods:GET, HEAD, OPTIONS</Value>
                </Property>
                -->
            </Properties>
        </HTTPStreamer>
        <HTTPStreamer>
            <Name>cupertinostreaming</Name>
            <Description>Apple Cupertino Streaming</Description>
            <!--
            <BaseClass>com.wowza.wms.httpstreamer.cupertinostreaming.httpstreamer.HTTPStreamerAdapterCupertinoStreamer</BaseClass>
            -->
            <BaseClass>com.availo.wms.httpstreamer.HTTPStreamerAdapterCupertinoRedirector</BaseClass>
            <ApplicationContextClass>com.wowza.wms.httpstreamer.cupertinostreaming.httpstreamer.HTTPStreamerApplicationContextCupertinoStreamer</ApplicationContextClass>
            <RequestFilters>*.m3u8|*.m3u|*.ts|*.aac|*.mp3|*.m3u8key|*.webvtt</RequestFilters>
            <IdleFrequency>250</IdleFrequency>
            <LiveStreamPacketizer>cupertinostreamingpacketizer</LiveStreamPacketizer>
            <LiveStreamRepeater>cupertinostreamingrepeater</LiveStreamRepeater>
            <Properties>
                <Property>
                    <Name>newSessionTimeout</Name>
                    <Value>8000</Value>
                    <Type>Integer</Type>
                </Property>
                <Property>
                    <Name>validSessionTimeout</Name>
                    <Value>25000</Value>
                    <Type>Integer</Type>
                </Property>
                <Property>
                    <Name>streamStreamType</Name>
                    <Value>httpstreamer</Value>
                </Property>
                <Property>
                    <Name>repeaterStreamType</Name>
                    <Value>httprepeater-edge</Value>
                </Property>
                <Property>
                    <Name>requestTimeout</Name>
                    <Value>8000</Value>
                    <Type>Integer</Type>
                </Property>
                <Property>
                    <Name>tcpTimeToLive</Name>
                    <Value>9000</Value>
                    <Type>Integer</Type>
                </Property>
                <Property>
                    <Name>tcpKeepAliveTimeout</Name>
                    <Value>9000</Value>
                    <Type>Integer</Type>
                </Property>
                <!--
                <Property>
                    <Name>cupertinoUserHTTPHeaders</Name>
                    <Value>Access-Control-Allow-Origin:*|Access-Control-Allow-Methods:GET, HEAD, OPTIONS</Value>
                </Property>
                -->
            </Properties>
        </HTTPStreamer>
        <HTTPStreamer>
            <Name>sanjosestreaming</Name>
            <Description>San Jose Streaming</Description>
            <!--
            <BaseClass>com.wowza.wms.httpstreamer.sanjosestreaming.httpstreamer.HTTPStreamerAdapterSanJoseStreamer</BaseClass>
            -->
            <BaseClass>com.availo.wms.httpstreamer.HTTPStreamerAdapterSanJoseRedirector</BaseClass>
            <ApplicationContextClass>com.wowza.wms.httpstreamer.sanjosestreaming.httpstreamer.HTTPStreamerApplicationContextSanJoseStreamer</ApplicationContextClass>
            <RequestFilters>*manifest.f4m|*.abst|*crossdomain.xml</RequestFilters>
            <IdleFrequency>250</IdleFrequency>
            <LiveStreamPacketizer>sanjosestreamingpacketizer</LiveStreamPacketizer>
            <LiveStreamRepeater>sanjosestreamingrepeater</LiveStreamRepeater>
            <Properties>
                <Property>
                    <Name>newSessionTimeout</Name>
                    <Value>8000</Value>
                    <Type>Integer</Type>
                </Property>
                <Property>
                    <Name>validSessionTimeout</Name>
                    <Value>25000</Value>
                    <Type>Integer</Type>
                </Property>
                <Property>
                    <Name>streamStreamType</Name>
                    <Value>httpstreamer</Value>
                </Property>
                <Property>
                    <Name>repeaterStreamType</Name>
                    <Value>httprepeater-edge</Value>
                </Property>
                <Property>
                    <Name>requestTimeout</Name>
                    <Value>8000</Value>
                    <Type>Integer</Type>
                </Property>
                <Property>
                    <Name>tcpTimeToLive</Name>
                    <Value>9000</Value>
                    <Type>Integer</Type>
                </Property>
                <Property>
                    <Name>tcpKeepAliveTimeout</Name>
                    <Value>9000</Value>
                    <Type>Integer</Type>
                </Property>
                <!--
                <Property>
                    <Name>sanjoseUserHTTPHeaders</Name>
                    <Value>Access-Control-Allow-Origin:*|Access-Control-Allow-Methods:GET, HEAD, OPTIONS</Value>
                </Property>
                -->
            </Properties>
        </HTTPStreamer>
        <HTTPStreamer>
            <Name>dvrchunkstreaming</Name>
            <Description>DVR Chunk Streaming</Description>
            <BaseClass>com.wowza.wms.httpstreamer.dvrrepeater.HTTPStreamerAdapterDvrChunkStreamer</BaseClass>
            <ApplicationContextClass>com.wowza.wms.httpstreamer.dvrrepeater.HTTPStreamerApplicationContextDvrChunkStreamer</ApplicationContextClass>
            <RequestFilters>*.dvr</RequestFilters>
            <IdleFrequency>250</IdleFrequency>
            <LiveStreamPacketizer>dvrstreamingpacketizer</LiveStreamPacketizer>
            <LiveStreamRepeater>dvrstreamingrepeater</LiveStreamRepeater>
            <Properties>
                <Property>
                    <Name>newSessionTimeout</Name>
                    <Value>8000</Value>
                    <Type>Integer</Type>
                </Property>
                <Property>
                    <Name>validSessionTimeout</Name>
                    <Value>25000</Value>
                    <Type>Integer</Type>
                </Property>
                <Property>
                    <Name>streamStreamType</Name>
                    <Value>httpstreamer</Value>
                </Property>
                <Property>
                    <Name>repeaterStreamType</Name>
                    <Value>httprepeater-edge</Value>
                </Property>
                <Property>
                    <Name>requestTimeout</Name>
                    <Value>8000</Value>
                    <Type>Integer</Type>
                </Property>
                <Property>
                    <Name>tcpTimeToLive</Name>
                    <Value>9000</Value>
                    <Type>Integer</Type>
                </Property>
                <Property>
                    <Name>tcpKeepAliveTimeout</Name>
                    <Value>9000</Value>
                    <Type>Integer</Type>
                </Property>
            </Properties>
        </HTTPStreamer>

    </HTTPStreamers>
</Root>
brynjare commented 10 years ago

If I understand you correctly, you want to spread the outgoing traffic on multiple network interfaces on one physical server?

Since the incoming traffic would probably be a very small fraction of your outgoing traffic, I don't think you really need to use my module to achieve that. I would look into ethernet bonding instead, if that's your main goal. I haven't tried this on Wowza servers myself, but I would give that a shot first, before trying to adapt Wowza to this scenario.

If you need to spread the incoming traffic over multiple interfaces as well, it will probably get trickier, but load balancing traffic over multiple network interfaces on a single server can probably be done easier without trying to use multiple vhosts and this module.

This module is really designed to allow Wowza to receive incoming connections on any VHost (let's call them CustomerA, CustomerB and CustomerC) and then redirect that connection to the same customer's VHost on Server1, Server2, up to ServerX. So if CustomerB receives a connection on the loadbalancer, that connection will be sent to the VHost 'CustomerB' on Server1, Server2 or ServerX - depending on which of them has the least current traffic at the moment.

There is currently no way to redirect from CustomerA to CustomerB (or from "eth0" to "eth1", "eth2" or "eth3") locally on one server with this module - and I don't think it's feasible to start coding it in this module, since it's really designed for another scenario entirely.

When you are at the point where you need to add server2, server3, etc..., this module can be of some use to you - but I suspect it's not the solution you are looking for in order to maximise the traffic you can send from server1. Good luck, though - and please let me know if I have misunderstood your scenario, or if you figure out a good solution in some other way! :)

pilgrims1 commented 10 years ago

Thanks brynjare... I understood your module correctly.... My mistake was look your module only by word. And I also agree your advise..... And I already found solution through local programmer with some pay. Thank you for your reply.... ^^