5

I have ADSL internet, and when there is an application uploading to the Internet at full speed (e.g. Skype or Chrome during file uploads), the download bandwidth becomes very very slow. Meaning I cannot practically browse webpages during uploads and even pinging 8.8.8.8 takes 2-3 seconds; normally that would take under 0.06 seconds.

In Mac OS X Mavericks (10.9) and earlier I used throttled to limit the outgoing traffic, so the internet was usable during uploads.

Throttled uses ipfw for throttling, which has been removed from Yosemite (10.10). The recommended alternative is pf, but the Mac OS X kernel does not have ALTQ support, which would enable the traffic shaping (so as I tried, all altq commands are simply ignored).

I also tried the Network Link Conditioner app, but that does not throttle the outgoing packages correctly, so the Internet is still unusable during uploads. The average outgoing bandwidth is limited, but it is waving/oscillating with a few seconds period.

So how can I limit the outgoing bandwidth? Or how can I raise the HTTP traffic priority at least? Can I install ipfw somehow? Any other idea?

Update: The configuration which works for me the best so far is to make HTTP/HTTPS/SSH unlimited and limit upload speed for everything else. This makes the internet usable when both the cloud backup and torrent uploading at the same time. Here is the script:

#!/bin/bash

# Reset dummynet to default config
dnctl -f flush

pfctl -F all

# Compose an addendum to the default config; creates a new anchor
(cat /etc/pf.conf &&
  echo 'dummynet-anchor "my_anchor"' &&
  echo 'anchor "my_anchor"') | pfctl -q -f -

# Configure the new anchor
cat <<EOF | pfctl -q -a my_anchor -f -
no dummynet quick on lo0 all
dummynet out all pipe 1
dummynet out proto icmp all pipe 2
dummynet out proto tcp to any port 443 pipe 2
dummynet out proto tcp to any port 80 pipe 2
dummynet out proto tcp to any port 22 pipe 2
EOF

# Create the dummynet queue
dnctl pipe 1 config bw 30Kbyte/s queue 50
dnctl pipe 2 config queue 50

# Activate PF
pfctl -E

To check that dnctl is properly configured run sudo dnctl list. You should see the 2 queues, the first one is limited, the second one is unlimited:

$ sudo dnctl list
00001: 240.000 Kbit/s    0 ms   50 sl. 1 queues (1 buckets) droptail
    mask: 0x00 0x00000000/0x0000 -> 0x00000000/0x0000
BKT Prot ___Source IP/port____ ____Dest. IP/port____ Tot_pkt/bytes Pkt/Byte Drp
    mask: 0x00 0x00000000/0x0000 -> 0x00000000/0x0000
BKT Prot ___Source IP/port____ ____Dest. IP/port____ Tot_pkt/bytes Pkt/Byte Drp
  0 udp         192.168.1.XX/XXX   XX.XX.XX.XX/XXX   1372  1517617  6 8010  96
00002: unlimited    0 ms   50 sl. 1 queues (1 buckets) droptail
    mask: 0x00 0x00000000/0x0000 -> 0x00000000/0x0000
BKT Prot ___Source IP/port____ ____Dest. IP/port____ Tot_pkt/bytes Pkt/Byte Drp
    mask: 0x00 0x00000000/0x0000 -> 0x00000000/0x0000
BKT Prot ___Source IP/port____ ____Dest. IP/port____ Tot_pkt/bytes Pkt/Byte Drp
  0 tcp         192.168.1.XX/XXX   XX.XX.XX.XX/XXX     27     4557  0    0   0
2
  • On Yosemite, you can use Icefloor... Gibs – user402563 Dec 28 '14 at 16:08
  • Thanks for the tip @gibs, but from the website: IceFloor runs on OS X 10.10 Yosemite with limited functionalities. Bandwidth management is not supported. – psmith Jan 2 '15 at 10:35
2

I ran into exactly this issue with the new Photos app. After installation, a photolibraryd app uploads all the photos in the background, causing the network congestion issues you cite. I too installed the Network Link Conditioner and set up a 256Kbps upload limit.

At first it didn't work. The reason was simple: the upload is a TCP connection (HTTPS on port 443). I had to disconnect first (I just shut off WiFi for a second) after enabling NLC. After that, the uploads resumed under the new NLC rule and I'm able to use my internet at the same time.

For further insight, take a look at your PF rules before and after enabling NLC. Notice that when NLC is enabled, you have a dummynet PF rule?! That's right, instead of supporting ALTQ, it appears that Apple made PF work with dummynet. I posted a bit more about PF on Mac OS X on my blog.

UPDATE: NLC is not needed. Dummynet pipes and queues can be created directly with dnctl. Read the accompanying man page for it for detailed instructions and examples of using it with pf.

2
  • I updated my answer with dnctl paragraph, which is a CLI tool that will do exactly what you want @psmith. – Matt Simerson Apr 18 '15 at 11:57
  • I upgraded to El Capitan and indeed the dnctl seems to work. I found a working configuration here: reddit.com/r/osx/comments/3g7dim/… – psmith Oct 24 '15 at 9:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.