ASP.NET core memory consumption when loading a file in Azure Blob

When I upload a file to Azure Blob, the memory consumption seems pretty high. The following are data from 200 MB file downloads.

public async Task<IActionResult> PostFile(IFormFile file)
{
    var filePath = Path.GetTempFileName();

    using (var stream = new FileStream(filePath, FileMode.Create))
    {
        -> Memory used: 108 MB

        await file.CopyToAsync(stream);

        -> Memory used: 308 MB

        await blockBlob.UploadFromStreamAsync(stream);

        -> Memory used: 988 MB
    }
}

Since the file is already uploaded to the stream, I cannot understand the sharp increase in memory consumption caused by UploadFromStreamAsync (). I am using Microsoft.WindowsAzure.Storage 8.1.4 and .NET Core 1.1.

Am I doing something wrong or is this the expected behavior?

+4
source share
1 answer

My test application is an MVC application, so using it takes 243 memory.

Web api , MVC.

- api - 1G, :

enter image description here

- ?

.

.

, - , - 1G.

enter image description here

0

Source: https://habr.com/ru/post/1679265/


All Articles