Skip to content

Commit

Permalink
Final numbers?
Browse files Browse the repository at this point in the history
  • Loading branch information
jalauzon-msft committed Nov 26, 2024
1 parent 6fb6ba3 commit 3981932
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 56 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,6 @@ public override async Task RunAsync(CancellationToken cancellationToken)
StorageResource destination = LocalFileResourceProvider.FromDirectory(_destinationDirectory);

await RunAndVerifyTransferAsync(source, destination, cancellationToken);

GC.Collect();
GC.WaitForPendingFinalizers();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,12 @@
extern alias DMBlobs;
extern alias BaseBlobs;

using System;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
using Azure.Storage.DataMovement.Tests;
using BaseBlobs::Azure.Storage.Blobs;
using BaseBlobs::Azure.Storage.Blobs.Models;
using BaseBlobs::Azure.Storage.Blobs.Specialized;
using NUnit.Framework;
using DMBlobs::Azure.Storage.DataMovement.Blobs;
using System.Linq;

namespace Azure.Storage.DataMovement.Blobs.Tests
{
Expand All @@ -41,51 +36,5 @@ protected override async Task CreateBlobClientAsync(

protected override BlobType GetBlobType()
=> BlobType.Block;

[Test]
public async Task DownloadTransferTest()
{
BlobServiceClient service = ClientBuilder.GetServiceClient_OAuth(TestEnvironment.Credential);
BlobContainerClient container = service.GetBlobContainerClient("test-download-1");
using DisposingLocalDirectory testDirectory = DisposingLocalDirectory.GetTestDirectory();

await container.CreateIfNotExistsAsync();
Random random = new();
foreach (int i in Enumerable.Range(0, 5))
{
byte[] data = new byte[1048576];
random.NextBytes(data);
await container.UploadBlobAsync($"blob{i}", new BinaryData(data));
}

BlobsStorageResourceProvider blobProvider = new();
LocalFilesStorageResourceProvider localProvider = new();

TransferManager transferManager = new();
DataTransferOptions options = new()
{
InitialTransferSize = 8192,
MaximumTransferChunkSize = 8192,
};
TestEventsRaised testEvents = new(options);
DataTransfer transfer = await transferManager.StartTransferAsync(
blobProvider.FromClient(container),
localProvider.FromDirectory(testDirectory.DirectoryPath),
options);

CancellationTokenSource cts = new CancellationTokenSource(TimeSpan.FromSeconds(30));
await transfer.WaitForCompletionAsync(cts.Token);
testEvents.AssertUnexpectedFailureCheck();

await foreach (BlobItem blob in container.GetBlobsAsync())
{
string localPath = Path.Combine(testDirectory.DirectoryPath, blob.Name);
var response = await container.GetBlobClient(blob.Name).DownloadContentAsync();
byte[] expected = response.Value.Content.ToArray();
byte[] actual = File.ReadAllBytes(localPath);

Assert.That(actual, Is.EqualTo(expected));
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ internal class DataMovementConstants

internal static class Channels
{
internal const int MaxJobPartReaders = 64;
internal const int MaxJobPartReaders = 32;
internal static int MaxJobChunkReaders = Environment.ProcessorCount * 8;
internal const int JobPartCapacity = 1000;
internal const int JobChunkCapactiy = 1000;
internal const int DownloadChunkCapacity = 8;
internal const int DownloadChunkCapacity = 16;
}

internal static class ConcurrencyTuner
Expand Down

0 comments on commit 3981932

Please sign in to comment.