Giter Site home page Giter Site logo

Comments (3)

XiaoningLiu avatar XiaoningLiu commented on May 24, 2024

Hi @connor4312

I think main reason for the slow uploading is because BlockBlobURL.upload is not a parallelism uploading, it's a convenience layer uploading method.

For high performance uploading, please use uploadStreamToBlockBlob and other public methods provided in highlevel.ts. They fully support parallel upload.

BTW, how do you know "This indicates that BlockBlobUrl.upload does not consume the file stream? uploadStreamToBlockBlob internally calls into BlockBlobURL.upload to upload chunks.

from azure-storage-js.

connor4312 avatar connor4312 commented on May 24, 2024

how do you know "This indicates that BlockBlobUrl.upload does not consume the file stream? uploadStreamToBlockBlob internally calls into BlockBlobURL.upload to upload chunks.

I can tell this because the Parser stops emitting entry events. In the quoted section of the docs, they say that's how they work. Using .upload causes it to stall, but using uploadStreamToBlockBlob works, and just piping to a temp file on the filesystem also works.

I think main reason for the slow uploading is because BlockBlobURL.upload is not a parallelism uploading, it's a convenience layer uploading method. For high performance uploading, please use uploadStreamToBlockBlob and other public methods provided in highlevel.ts. They fully support parallel upload.

Should this be the way it works? As a naive consumer I would expect blob.upload() to "just work". Instead I got mysterious timeouts, and just randomly tried uploadStreamToBlockBlob because I was looking through Github issues and stumbled upon it mentioned in another issue. It's very non-obvious that attempting parallelism with blob.upload() would fail in this way.

from azure-storage-js.

XiaoningLiu avatar XiaoningLiu commented on May 24, 2024

Hi @connor4312

Is the timeout error thrown by blobURL.upload? If there are any errors thrown by blobURL.upload, please share the full error message to us. And you can also enable the logging, and share the logs to us for debugging.

  const pipeline = StorageURL.newPipeline(sharedKeyCredential, {
    logger: {
      log: console.log,
      minimumLogLevel: HttpPipelineLogLevel.INFO
    }
  });

At least, you should not use blobUrl.upload in this scenario. Because blobUrl.upload accepts a stream factory method instead of a stream. The stream factory method needs to return a new stream starting from the offset 0 in data source every time. This is because blobUrl.upload will retry when network broken, and it needs a new stream to start a new HTTP request. But method () => file will share the existing file stream. I'm not sure this is the root cause. But I cannot think of other reasons besides the poor network speed, which may stall a upload, because the readable stream is directly passed into https://github.com/axios/axios the underline request module.

parser.on('entry', file => {
  blobUrl.upload(Aborter.none, () => file, file.size, {
    blobHTTPHeaders: {
      blobContentType: mime.getType(file.path)!,
    },
  });
});

We will make the documentation about blobURL.upload and highlevel APIs more clear.

from azure-storage-js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.