File upload and serve extremely slow

33 Views Asked by At

I have this published asp.netcore app on Ubuntu LTS server. It should receive and save audio files on server. Here's how I implemented it (Audio is IFormFile, the request is sent as formdata):

if (dto.Audio != null && dto.Audio.ContentType.Contains("audio"))
{
    string path = "Audio/" +
        Path.GetRandomFileName().Remove(7, 4) +
        dto.Audio.FileName[^4..];
    using (var fs = System.IO.File.Create("wwwroot/" + path))
        dto.Audio.CopyTo(fs);
}

It's working, but very slow. Taking about 6-7 mins to upload, and same for serving the file of around 30 MB size.

The app is handling requests itself (Kestrel), I'm not using reverse proxy.

0

There are 0 best solutions below