all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Dietmar Maurer <dietmar@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox/proxmox-backup] Rate Limiter Implementation
Date: Tue,  9 Nov 2021 07:52:37 +0100	[thread overview]
Message-ID: <20211109065253.980304-1-dietmar@proxmox.com> (raw)

This implements a simple Token Bucket based rate limiter. That filter
can be used to:

- limit http client connection
- limit speed at server side (proxmox-backup-proxy)

There is also a new configuration file to configure the server side
rate limits: /etc/proxmox-backup/traffic-control.cfg

The server side filter dynamically updates when the user changes
configuration (even for existing connections).


Dietmar Maurer (proxmox/7):
  Implement a rate limiting stream (AsyncRead, AsyncWrite)
  RateLimitedStream: implement poll_write_vectored
  HttpsConnector: use RateLimitedStream
  RateLimitedStream: allow periodic limiter updates
  RateLimiter: avoid panic in time computations
  RateLimitedStream: implement peer_addr
  RateLimiter: add update_rate method

 proxmox-http/src/client/connector.rs          |  51 +++-
 proxmox-http/src/client/mod.rs                |   6 +
 .../src/client/rate_limited_stream.rs         | 233 ++++++++++++++++++
 proxmox-http/src/client/rate_limiter.rs       |  84 +++++++
 4 files changed, 366 insertions(+), 8 deletions(-)
 create mode 100644 proxmox-http/src/client/rate_limited_stream.rs
 create mode 100644 proxmox-http/src/client/rate_limiter.rs

Dietmar Maurer (proxmox-backup/9):
  pbs-client: add option to use the new RateLimiter
  proxmox-backup-client: add rate/burst parameter to backup CLI
  implement Servive for RateLimitedStream
  New DailyDuration type with nom parser
  DailyDuration: implement time_match()
  Add traffic control configuration config with API
  traffic_control: use Memcom to track. config versions
  implement a traffic control cache for fast rate control limiter
    lockups
  proxmox-backup-proxy: implement traffic control

 Cargo.toml                                    |   1 +
 pbs-api-types/src/lib.rs                      |   7 +
 pbs-api-types/src/traffic_control.rs          |  81 +++++
 pbs-client/src/http_client.rs                 |  24 +-
 pbs-client/src/tools/mod.rs                   |  23 +-
 pbs-config/src/lib.rs                         |   3 +-
 pbs-config/src/memcom.rs                      |  14 +
 pbs-config/src/traffic_control.rs             |  98 ++++++
 proxmox-backup-client/src/main.rs             |  19 +-
 proxmox-rest-server/Cargo.toml                |   1 +
 proxmox-rest-server/src/rest.rs               |  28 ++
 proxmox-systemd/src/daily_duration.rs         | 152 ++++++++++
 proxmox-systemd/src/lib.rs                    |   1 +
 proxmox-systemd/src/parse_time.rs             |  56 ++++
 proxmox-systemd/src/time.rs                   |   2 +-
 src/api2/config/mod.rs                        |   2 +
 src/api2/config/traffic_control.rs            | 283 ++++++++++++++++++
 src/bin/proxmox-backup-manager.rs             |   1 +
 src/bin/proxmox-backup-proxy.rs               |  25 +-
 src/bin/proxmox_backup_manager/mod.rs         |   2 +
 .../proxmox_backup_manager/traffic_control.rs | 105 +++++++
 src/cached_traffic_control.rs                 | 240 +++++++++++++++
 src/lib.rs                                    |   3 +
 23 files changed, 1161 insertions(+), 10 deletions(-)
 create mode 100644 pbs-api-types/src/traffic_control.rs
 create mode 100644 pbs-config/src/traffic_control.rs
 create mode 100644 proxmox-systemd/src/daily_duration.rs
 create mode 100644 src/api2/config/traffic_control.rs
 create mode 100644 src/bin/proxmox_backup_manager/traffic_control.rs
 create mode 100644 src/cached_traffic_control.rs

-- 
2.30.2





             reply	other threads:[~2021-11-09  6:53 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-09  6:52 Dietmar Maurer [this message]
2021-11-09  6:52 ` [pbs-devel] [PATCH proxmox 1/7] Implement a rate limiting stream (AsyncRead, AsyncWrite) Dietmar Maurer
2021-11-09  6:52 ` [pbs-devel] [PATCH proxmox-backup 1/9] pbs-client: add option to use the new RateLimiter Dietmar Maurer
2021-11-09  6:52 ` [pbs-devel] [PATCH proxmox 2/7] RateLimitedStream: implement poll_write_vectored Dietmar Maurer
2021-11-09  6:52 ` [pbs-devel] [PATCH proxmox-backup 2/9] proxmox-backup-client: add rate/burst parameter to backup CLI Dietmar Maurer
2021-11-09  6:52 ` [pbs-devel] [PATCH proxmox 3/7] HttpsConnector: use RateLimitedStream Dietmar Maurer
2021-11-09  6:52 ` [pbs-devel] [PATCH proxmox-backup 3/9] implement Servive for RateLimitedStream Dietmar Maurer
2021-11-09  6:52 ` [pbs-devel] [PATCH proxmox-backup 4/9] New DailyDuration type with nom parser Dietmar Maurer
2021-11-09  6:52 ` [pbs-devel] [PATCH proxmox 4/7] RateLimitedStream: allow periodic limiter updates Dietmar Maurer
2021-11-09  6:52 ` [pbs-devel] [PATCH proxmox-backup 5/9] DailyDuration: implement time_match() Dietmar Maurer
2021-11-09  6:52 ` [pbs-devel] [PATCH proxmox 5/7] RateLimiter: avoid panic in time computations Dietmar Maurer
2021-11-09  6:52 ` [pbs-devel] [PATCH proxmox-backup 6/9] Add traffic control configuration config with API Dietmar Maurer
2021-11-09  6:52 ` [pbs-devel] [PATCH proxmox 6/7] RateLimitedStream: implement peer_addr Dietmar Maurer
2021-11-09  6:52 ` [pbs-devel] [PATCH proxmox 7/7] RateLimiter: add update_rate method Dietmar Maurer
2021-11-09  6:52 ` [pbs-devel] [PATCH proxmox-backup 7/9] traffic_control: use Memcom to track. config versions Dietmar Maurer
2021-11-09  6:52 ` [pbs-devel] [PATCH proxmox-backup 8/9] implement a traffic control cache for fast rate control limiter lockups Dietmar Maurer
2021-11-09  6:52 ` [pbs-devel] [PATCH proxmox-backup 9/9] proxmox-backup-proxy: implement traffic control Dietmar Maurer

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

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

  git send-email \
    --in-reply-to=20211109065253.980304-1-dietmar@proxmox.com \
    --to=dietmar@proxmox.com \
    --cc=pbs-devel@lists.proxmox.com \
    /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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal