I have a webservice where people can download large files (think ISOs). Now since there is usually more than 1 person downloading, I would like a way to manage the share the of the total bandwidth a user receives. For example if we have premium and regular users and the server is at full throttle, the premium users would share 90% of the total bandwidth while the regular users only get around 10% (depending on their own internet connection of course).
It would be cool if I could adjust the maximum bandwidth per user from within a node js script that presumably communicates with some linux service that provides bandwidth management.
Is there a tool that would allow me to do something like this?
1 Answer
You need to look at the webserver you are using. The actual answer would depend on which one that is.
For Apache, you need to setup mod_ratelimit.
For nginx, the option is called limit_rate.
Other servers have their own versions of this functionality. Search in the documentation on your server.
Limiting by user is usually done by setting virtual servers - an anonymous user comes to primary web-site, logins - and by result of login is silently redirected to one of the VS. And each VS is setup with different parameters (including limits), different sets of scripts, etc.
How to setup a VS is also depends on the web-server itself.
-
So theres no option for more fine grained control?user2741831– user27418312022-09-08 13:26:24 +00:00Commented Sep 8, 2022 at 13:26