crossbario / crossbar

Crossbar.io - WAMP application router
https://crossbar.io/
Other
2.05k stars 274 forks source link

Simple per-router-worker traffic shaping #1932

Open oberstet opened 2 years ago

oberstet commented 2 years ago

One feature that we probably could add relatively easy would be, using trickle to traffic shape WAMP traffic on listening ports of Crossbar.io router workers - for all realms run on that worker, that is "per listening worker", not even "per listening transport"!

We should check if at least Unix domain sockets opened by the worker run unlimited, and the bandwidth limitation only applies to the listening TCP sockets of the worker.

We should also check if trickle works well with Linux epoll, and if it works with shared ports (between worker processes) on Linux, and if it works for both router and proxy workers.

This would work then - even though not ideal, because it cannot limit on a per-connection basis, or per WAMP realm, which is what we'd ideally had.

TRICKLE(1)                                           BSD General Commands Manual                                           TRICKLE(1)

NAME
     trickle — a lightweight userspace bandwidth shaper

SYNOPSIS
     trickle [-h] [-v] [-V] [-s] [-d rate] [-u rate] [-w length] [-t time] [-l length] [-n path] [-P path] command ...

DESCRIPTION
     trickle is a userspace bandwidth manager.  Currently, trickle supports the shaping of any SOCK_STREAM (see socket(2)) connection
     established via the socket(2) interface.  Furthermore, trickle will not work with statically linked executables, nor with
     setuid(2) executables.  trickle is highly configurable; download and upload rates can be set separately, or in an aggregate
     fashion.