git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jeff King <peff@peff.net>
To: "brian m. carlson" <sandals@crustytoothpaste.net>
Cc: Bryan Turner <bturner@atlassian.com>,
	Bagas Sanjaya <bagasdotme@gmail.com>,
	Git Users <git@vger.kernel.org>
Subject: Re: Simulating network throttling
Date: Thu, 17 Jun 2021 03:19:19 -0400	[thread overview]
Message-ID: <YMr3dwW/hnNhptFN@coredump.intra.peff.net> (raw)
In-Reply-To: <YMqB1mT9yeRCuA/N@camp.crustytoothpaste.net>

On Wed, Jun 16, 2021 at 10:57:26PM +0000, brian m. carlson wrote:

> 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

      reply	other threads:[~2021-06-17  7:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-16  4:55 Simulating network throttling Bagas Sanjaya
2021-06-16  4:59 ` Bryan Turner
2021-06-16 22:57   ` brian m. carlson
2021-06-17  7:19     ` Jeff King [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YMr3dwW/hnNhptFN@coredump.intra.peff.net \
    --to=peff@peff.net \
    --cc=bagasdotme@gmail.com \
    --cc=bturner@atlassian.com \
    --cc=git@vger.kernel.org \
    --cc=sandals@crustytoothpaste.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).