git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Simulating network throttling

From
Jeff King <peff@peff.net>
Date
Jun 17, 2021, 07:19 UTC
Message-ID
<YMr3dwW/hnNhptFN@coredump.intra.peff.net>
In-Reply-To
<YMqB1mT9yeRCuA/N@camp.crustytoothpaste.net>
On Wed, Jun 16, 2021 at 10:57:26PM +0000, brian m. carlson wrote:
Show 10 quoted lines
> On Linux, you can also use the tc command to do traffic shaping and
> policing to allow only a certain amount of bandwidth, and you can use it
> in conjunction with iptables or nftables to do it only on certain ports
> or IPs.  It's very powerful and doesn't suffer from the limitations of
> proxies, but it also is rather complicated to set up, so you may want to
> try a proxy first to see if it meets your needs with less work.
> 
> OpenBSD's (and FreeBSD's, Darwin's, etc.) pf supports the same
> functionality but with a much nicer and easier to use interface (and I
> say this as a Linux user).

Yeah, these are both good suggestions that work transparently with any protocol. I second the notion that tc is complicated to set up. ;)

If you really just want a pipe that will do rate-limiting in one direction, many tools (e.g., "pv", which is available in debian) will do it. That's hard to use with http, but you can stick it into an ssh pipeline:

  $ git clone git@github.com:torvalds/linux.git
  Cloning into 'linux'...
  remote: Enumerating objects: 8129587, done.
  Receiving objects:   2% (163965/8129587), 70.89 MiB | 20.22 MiB/s
  ^C
  $ GIT_SSH_COMMAND='f() { ssh "$@" | pv -qL 512k; }; f' \
    git clone git@github.com:torvalds/linux.git
  Cloning into 'linux'...
  remote: Enumerating objects: 8129587, done.
  Receiving objects:   0% (15263/8129587), 7.57 MiB | 512.00 KiB/s
  ^C
-Peff
Previous: brian m. carlson
Message 4 of 4 in “Simulating network throttling”
  1. Bagas SanjayaJun 16, 2021
  2. Bryan TurnerJun 16, 2021
  3. brian m. carlsonJun 16, 2021
  4. Jeff KingJun 17, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.