[icecast-dev] load balancing

Enrico Minack enrico.minack at informatik.tu-chemnitz.de
Wed Mar 24 10:44:31 PST 2004



> > What do you think?
> This sounds like it could be useful for some users. Do you want to send us
a
> patch?

I created this patch that adds load balancing to the Master-Slave-Feature:
http://www.maniac-site.de/download.php?user=maniacme2&file=icecast-2.0.0-loa
dbalanced-0.9.2.diff.gz

I'd be pleased if someone would test the patch and could tell me whether the
pached version works on your machines.

When <master-public-slave> in the configuration file is != 0, then the load
balancing feature is active. Then all slaves provides their bandwidth to the
clients via request to the one master. Therefore, users needn't to use yp
services to find public mirrors. A newly connected slave will be available
to the clients after one master-update-interval.

<p>And this is what it does:
- the master is aware of all slaves mirroring its sources
- when a client requests a source the master randomly selects a slave (or
itself) to serve the client
- a 'weak' slave is less likely to be selected for serving the client than a
'strong' one
- if a slave is selected, the master sends a 'HTTP/1.0 302 Temporarily
Moved' and a 'Location: ...' value
- an unlimited number of slaves for each source is possible

<p>And this is how it works
- the slave has a list of master sources in the global variable
- each element of this list contains the name of a source mirrored from the
master (since the slave can have its own additional sources)
- when a new source from the master is added to the source tree the mount
point is added to this list
- when a source is removed from the source tree the mount point is removed
from this list
- this list is used by slave.c to create the sourcelist.txt which is posted
to the master right before the streamlist.txt is requested from the master

- the master parses the sourcelist.txt file and adds the slave data to each
listed source
- for this I extended the source_t structure with a list of slaves
- each slave list element (slave_t) contains information about a slave
mirroring this source (ip, port, current listeners, new listeners, timeout)
- in connection.c this list is used to randomly select a slave and the
client is forwarded to it
- whether a slave timed-out is check when a client requests a source, right
before the random selection starts
- when an icecast server requests a source (as relay or slave) the master
won't forward to a slave
- the master uses the 'user-agent' attribute in the request of the client to
determine whether the client is an icecast server

<p>A load balanced slave is compatible with icecast server without the load
balancing patch, and vice versa, but there will be no load balancing
behaviour.

<p>Enrico M.

--- >8 ----
List archives:  http://www.xiph.org/archives/
icecast project homepage: http://www.icecast.org/
To unsubscribe from this list, send a message to 'icecast-dev-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the Icecast-dev mailing list