Hello!
I have a very interesting issue here.
Shortly:
We have a simple .NET Core 2.1 application that downloads stuff from FTP server within same network (10 GBit network) and achieves maximum speed of ~16 Mbps when launched within docker container.
Same app reaches 200 Mbps when started from outside docker.
There is nothing special, here is our test app code:
var client = new Ftp();
Rebex.Licensing.Key = "...";
client.ValidatingCertificate += (sender, args) => {
args.Accept();
};
var sslMode = SslMode.Explicit;
var ftpUri = new Uri("ftp://local-network-server/");
// Connect securely using explicit or implicit SSL.
if (ftpUri.Port > 0)
client.Connect(ftpUri.Host, ftpUri.Port, sslMode);
else
client.Connect(ftpUri.Host, sslMode);
client.SecureTransfers = true;
client.Timeout = (int) TimeSpan.FromMinutes(5).TotalMilliseconds;
client.Settings.KeepAliveDuringTransfer = true;
client.Settings.KeepAliveDuringTransferInterval = 60;
client.Settings.PauseBeforeUploadClose = true;
client.Settings.UseLargeBuffers = true;
client.UploadBufferLength = 256 * 1024; // 256 KB
client.Settings.SslReuseSessions = true;
// Connection is protected now, we can log in safely.
client.Login("user", "pass");
client.DownloadAsync("/path/to/folder", Directory.GetCurrentDirectory(), TraversalMode.Recursive, TransferMethod.Copy, ActionOnExistingFiles.OverwriteAll).Wait();
client.Disconnect();
Here is our Dockerfile:
FROM microsoft/dotnet:2.2-runtime
# Set current work dir.
WORKDIR /app
# Copy app build.
ADD ./bin/Debug/netcoreapp2.1/publish/ ./
# Start app.
ENTRYPOINT ["dotnet", "Expsz.dll"]
Rebex.FTP Nuget - 4.0.6930
Rebex.Common Nuget - 2.5.6930
Rebex.Networking Nuget - 3.5.6930
IMPORTANT
As an alternative I tried FluentFTP lib from within container, it doesnt have such issues and is able to achieve good speeds. Also fetching stuff via curl/wget also works good.
Any ideas? Might it be due to docker base image? Does Rebex.Ftp rely on some OS things?
Anything more I can provide to make things clear?
Any help is appreciated. Thanks!