Throttling soundcloud upload network bandwidth
  • Hi all,

    I was wondering if there was a way to throttle the network bandwidth used to upload the recorded shows to soundcloud? I wouldn't want to necessarily throttle all network traffic to the PC although maybe that would be a simpler option..? The problem is that our stream stutters a bit at the top of each hour when the upload starts. We are currently using Airtime 2.0.3 on Ubuntu 10.04 server.

    Any ideas welcome

    thanks

    James
  • 2 Comments sorted by
  • Just noticed no one has replied to this so I'll post my solution here. It's a bash script called by /etc/network/interfaces with the following lines:

    $ cat /etc/network/interfaces

    ...
    up /path/to/script up
    down /path/to/script down

    $ cat /path/to/script

    #!/bin/bash

    if [ "$1" = "up" ]; then
    tc qdisc del dev eth0 root 2> /dev/null > /dev/null
    tc qdisc del dev eth0 ingress 2> /dev/null > /dev/null

    tc qdisc add dev eth0 root handle 1: htb default 13

    tc class add dev eth0 parent 1:0 classid 1:10 htb rate 10000mbit ceil 10000mbit
    tc class add dev eth0 parent 1:0 classid 1:20 htb rate 800kbit ceil 800kbit

    tc class add dev eth0 parent 1:20 classid 1:21 htb rate 400kbit ceil 800kbit prio 1
    tc class add dev eth0 parent 1:20 classid 1:22 htb rate 300kbit ceil 800kbit prio 2
    tc class add dev eth0 parent 1:20 classid 1:23 htb rate 100kbit ceil 800kbit prio 3

    # do not limit traffic to the LAN
    tc filter add dev eth0 protocol ip parent 1:0 prio 1 u32 match ip dst 192.168.0.0/24 flowid 1:10
    # limit remote access (ssh) to 400kbit (but can borrow up to 800kbit)
    tc filter add dev eth0 protocol ip parent 1:0 prio 1 u32 match ip sport xxxx 0xffff flowid 1:21
    # limit ftp uploads to 400kbit (but can borrow up to 800kbit)
    tc filter add dev eth0 protocol ip parent 1:0 prio 2 u32 match ip dport 20 0xffff flowid 1:21
    tc filter add dev eth0 protocol ip parent 1:0 prio 2 u32 match ip dport 21 0xffff flowid 1:21
    # limit uploads to soundcloud (178.249.136.151) to 100kbit (but can borrow up to 800kbit)
    tc filter add dev eth0 protocol ip parent 1:0 prio 3 u32 match ip dst $(ping -c 1 api.soundcloud.com | head -n 1 | awk '{print $3}' | tr -d '()') flowid 1:23
    # limit uploads to mixcloud (46.23.65.210) to 100kbit (but can borrow up to 800kbit)
    tc filter add dev eth0 protocol ip parent 1:0 prio 3 u32 match ip dst $(ping -c 1 api.mixcloud.com | head -n 1 | awk '{print $3}' | tr -d '()') flowid 1:23
    # limit general airtime access and general traffic on port 80 to 300kbit (but can borrow up to 800kbit)
    tc filter add dev eth0 protocol ip parent 1:0 prio 2 u32 match ip sport 80 0xffff flowid 1:22
    # limit any unclassified traffic to 100kbit (but can borrow up to 800kbit)
    tc filter add dev eth0 protocol ip parent 1:0 prio 3 u32 match ip src 192.168.0.3 flowid 1:23

    elif [ "$1" = "down" ]; then
    tc qdisc del dev eth0 root 2> /dev/null > /dev/null
    tc qdisc del dev eth0 ingress 2> /dev/null > /dev/null
    else
    echo "usage: up|down"
    fi
    Post edited by James Dunn at 2013-08-09 08:31:34
  • Vote Up0Vote Down hoerichhoerich
    Posts: 627Member, Airtime Moderator
    We run Airtime in our LAN and my solution is to use QoS on our Netgear FVS336GV2 Dual-WAN-Router.

    We got 2 WAN-Connections, one for Broadcast-Devices and Input Sources and one for anything else.
    I created different groups (Broadcast, Staff, VIP, Guest) and force them to use assigned WAN-connection and also limitted Upload-HTTP-traffic for Broadcast-Devices.

    Sure this is just a solution for local Servers, but this should be possible with any QoS-capable network device.

    Official Airtime Forum Manager
    --------------------------
    Most of the time an issue is located between keyboard and chair.