question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] Core 15x slower reading blobs than Framework

See original GitHub issue

Describe the bug I am seeing the v12 Blobs library taking 45 seconds to read a blob via netcore that the same library can read in 3 seconds in Net4.7

Expected behavior I would expect core to be at least as fast as framework

Actual behavior (include Exception or Stack Trace) Framework is 15x faster than core. Framework appears to have requests active in parallel, core seems to serialise 16kb chunks.

To Reproduce Run the following code (obviously providing a connection string for a premium blob) in both core and framework

using System.Diagnostics;
using Azure.Storage.Blobs;
using Azure.Storage.Blobs.Models;

 

namespace BlobTest
{
  class Program
  {
    static void Main(string[] args)
    {
      Stopwatch sw = Stopwatch.StartNew();
      BlobClient blobClient = new BlobClient(new Uri( <insert premium blob address here> ));
      int toRead = 500 * 1024 * 1024;
      byte[] byteBuffer = new byte[toRead];
      Azure.Response<BlobDownloadInfo> response = blobClient.Download(new Azure.HttpRange(0,toRead));
      using (BlobDownloadInfo result = response.Value)
      {
        int followOns = 0;
        long read = result.ContentLength;
        long read2 = result.Content.Read(byteBuffer, 0, byteBuffer.Length);
        while (read2 < read)
        {
            ++followOns;
            long read3 = result.Content.Read(byteBuffer, (int)read2, byteBuffer.Length - (int)read2);
            read2 += read3;
            Debug.Assert(read3 > 0, "Failed to read blob");
        }
        sw.Stop();
        Console.WriteLine($"Read {toRead} in {sw.ElapsedMilliseconds}ms {followOns} followOns");
      }
    }
  }
}

Environment:

  • Azure.Storage.Blobs 12.6.0
  • Comparing Net Framework 4.7.2 and dotnetcore 3.1.301
  • VS2019 16.6.2 Running on Azure VM D4sv3 with accelerated networking connecting to a premium block storage account in the same region (West Europe)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:12 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
jsquirecommented, Nov 23, 2020

Thank you for your feedback. Tagging and routing to the team best able to assist.

0reactions
jaschrep-msftcommented, Jan 29, 2021

Closing to favor #17305 as the solution to this situation.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Abp.EntityFramework does not work with Core 2.x #7550
I want to access MS EFCore directly instead of using Repository (which runs 15X slower than ASP.NET EF). My project is Angluar/Core.
Read more >
TechEmpower Framework Benchmarks: Round 20
I read once on HN that a lot of modern day deployment strategies and tooling seems like it was created because of very...
Read more >
Java 8's streams: why parallel stream is slower?
I have 2 core CPU (Intel i73520M), Windows 8 x64, and 64-bit Java 8 update 5. I am doing simple map over stream/parallel...
Read more >
Help me love Rust - compilation time
I have VS Code configured to run cargo clippy on save. It's a little sluggish compared to, say, TypeScript, where you get error...
Read more >
Entity Framework 7 bulk update - ExecuteUpdate (new) v ...
I finally got a chance to run some benchmarks comparing the new bulk update API in Entity Framework 7 v existing SaveChanges() method....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found