CURLSMultiMBS Max*** Parameters

I need to download several thousand files via SFTP. I’ve followed the MBS “CURLS sftp batch download” example pretty closely. It works fine for 800 files, but 4,800 files just sits there forever with no TransferFinished events ever firing. I’m calling the Perform method every 10ms.

I see that there are a number of “Max” parameters:

MaxConcurrentStreams
MaxConnects
MaxHostConnections
MaxTotalConnections

but these are not explained well in the MBS docs and the defaults are not listed. I cannot find these parameters in the CURL project’s documentation either.

Do I need to set some or all of these parameters in order to download 4,000-10,000 files? Which parameters and to what values?

If I increase MaxTotalConnections to 5000, a few files download, then I get “Could not resolve host” (return code 6) errors for the rest. The server I’m downloading from is AWS. The files are stored in six different server directories.

I think you might be overloading the DNS service.

Try setting MaxConnects and MaxTotalConnections to smaller values (maybe start at 4).

1 Like

There is a limit on file/socket handles, so it may good to stay below 200 concurrent connections.

Probably you may just have 10 so your app can process them quickly.

And please call perform in a timer to keep it going.

If I set these properties to small values like 4 or 10, nothing ever happens - TransferFinished never fires.

Perform is being called every 10ms as I mentioned, same as the example project.

The magic number is ≈900 files. If 900 or less, it works. If 905 or more, TransferFinished is never called. I haven’t found any correlation with the Max___ properties.

This is a total aggregate number among five separate CURLSMultiMBS objects, each one downloading an equal number concurrently from a different server directory, i.e. 180 files per instance works but 181 files per instance doesn’t. But I know that one individual instance works for least 800 downloads, so it seems the limitation is on total simultaneous downloads for all instances.

While it was working well under MacOS as long as I stayed under the 900-file limit, it was a disaster under Windows, with many many “login denied” errors and failures creating MTOutputFiles. I rearranged the code to download each directory-worth of files sequentially so there is never more than one instance of CURLSMultiMBS at any given time - it works OK, but slower and not as much fun to watch as the simultaneous parallel downloads.