Throttle based on ETA time?

lem0nhead nginx-forum at forum.nginx.org
Sat Nov 17 00:18:02 UTC 2018


Hi!
I have a particular use-case for a nginx server which is used for
downloading big files (1-3 GBs).
Services call this server and start downloading, which usually takes ~2
minutes @ 1gbps server connection and 10 concurrent clients.
Let's say I want to have a 10min timeout for this download (if it doesn't
work, I will just retry at another time).
Now I see 2 possible bad scenarios:
1) I get a lot of simultaneous connections (~100), the download time
skyrocket and ALL of them fails;
2) I have just 10 connections (usual operation) but the latency increases
and the connection speed effectively drops to 100mbps. Again the download
time will skyrocket and ALL of them will fail.

The first one is easy: I can just limit the amount of concurrent clients to
a number that ensures my network can support them when working properly.

But the second one is trickier. The solution I can see something like
starting to drop 5% of the clients (newest first) each 20 seconds that the
ETA is over 8 minutes (so we have a margin until 10 minutes is reached).
Accidentally this would probably also solve the first scenario so I wouldn't
need to configure nginx in respect to the server it's running on; it would
be agnostic to it.

Do you think that could be a good solution? Any hints if I can find some
module that does that or something similar that I can use as inspiration to
write my own?

Thanks

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,282019,282019#msg-282019



More information about the nginx mailing list