-   Linux - Software (
-   -   lftp - Limit new connections per unit time (

Patchmaster 09-08-2018 01:36 PM

lftp - Limit new connections per unit time
I regularly download from a remote server using lftp. Somewhere between the server and me the speed per connection is being limited. The only solution I've found is to use lots of connections and lftp is great for this. The only issue is I see a number of connections that get delayed for a minute or more, I assume because either ssh on my end or the ftp server on the other end won't accept more than X connections per Y seconds from the same source. So I'm wondering if there's a way to pace the new connections made by lftp. I know I can limit the total connections, but what I want is to limit it to, say, one new connection per second. I still want 16 connections per file, I just want lftp to pace itself making those connections. I've looked through the available settings several times and nothing jumps out at me on how to do this. Is it possible?

Turbocapitalist 09-09-2018 07:04 AM

According to the manual page you should be able to set the vairable net:connection-limit to cap the maximum number of concurrent connections. If that works then you can make it permanent in ~/.lftprc or ~/.lftp/rc.


man lftp
Though that such sets the number not the rate at which they are opened.

Patchmaster 09-09-2018 12:50 PM

Thanks, but I'm aware of that setting. I want the connections to be made, just not all at the same time. I have an alias set up that queues a single file download with pget using 16 connections. If I do 'job' right after running the queue command I see that 13 of the connections have been established and are downloading. Three of the connections say "Delaying before reconnect" with a number of seconds remaining. It seems to start at 30 seconds and count down. On the second try the remaining three connections are made. While it's obviously not the end of the world, I'm seeing that 30 seconds as wasted time and I'd like to find a way for those connections to be made faster. There clearly needs to be some delay but I'm guessing 30 seconds is much longer than it needs to be.

There are some settings related to "dynamic connections" but I've not yet found a good explanation of how they work.

All times are GMT -5. The time now is 08:27 PM.