Skip to content

Commit

Permalink
Fix to slow performance of PipeBlob uploads (#2821)
Browse files Browse the repository at this point in the history
* test

* tets

* update

* upload concurrency perf fix

* fix concurrency upload perf

* fixed linting issues, updated readme

* lint

* listing with OAuth support added + e2e test

* updated var name, error format strings

* trigger CI

* fixed linting errors
  • Loading branch information
wonwuakpa-msft authored Oct 10, 2024
1 parent 76430e9 commit 8c32b42
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 10 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# AzCopy v10

AzCopy v10 is a command-line utility that you can use to copy data to and from containers and file shares in Azure Storage accounts.
AzCopy V10 presents easy-to-use commands that are optimized for high performance and throughput.

Expand Down
22 changes: 22 additions & 0 deletions cmd/copy.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import (
"net/url"
"os"
"runtime"
"strconv"
"strings"
"sync"
"time"
Expand Down Expand Up @@ -1347,6 +1348,27 @@ func (cca *CookedCopyCmdArgs) processRedirectionDownload(blobResource common.Res
func (cca *CookedCopyCmdArgs) processRedirectionUpload(blobResource common.ResourceString, blockSize int64) error {
ctx := context.WithValue(context.TODO(), ste.ServiceAPIVersionOverride, ste.DefaultServiceApiVersion)

// Use the concurrency environment value
concurrencyEnvVar := glcm.GetEnvironmentVariable(common.EEnvironmentVariable.ConcurrencyValue())

pipingUploadParallelism := pipingUploadParallelism
if concurrencyEnvVar != "" {
// handle when the concurrency value is AUTO
if concurrencyEnvVar == "AUTO" {
return errors.New("concurrency auto-tuning is not possible when using redirection transfers (AZCOPY_CONCURRENCY_VALUE = AUTO)")
}

// convert the concurrency value to int
concurrencyValue, err := strconv.ParseInt(concurrencyEnvVar, 10, 32)

//handle the error if the conversion fails
if err != nil {
return fmt.Errorf("AZCOPY_CONCURRENCY_VALUE is not set to a valid value, an integer is expected (current value: %s): %w", concurrencyEnvVar, err)
}

pipingUploadParallelism = int(concurrencyValue) // Cast to Integer
}

// if no block size is set, then use default value
if blockSize == 0 {
blockSize = pipingDefaultBlockSize
Expand Down
2 changes: 0 additions & 2 deletions cmd/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,6 @@ func (cooked cookedListCmdArgs) handleListContainerCommand() (err error) {
// isSource is rather misnomer for canBePublic. We can list public containers, and hence isSource=true
if credentialInfo, _, err = GetCredentialInfoForLocation(ctx, cooked.location, source, true, common.CpkOptions{}); err != nil {
return fmt.Errorf("failed to obtain credential info: %s", err.Error())
} else if cooked.location == cooked.location.File() && source.SAS == "" {
return errors.New("azure files requires a SAS token for authentication")
} else if credentialInfo.CredentialType.IsAzureOAuth() {
uotm := GetUserOAuthTokenManagerInstance()
if tokenInfo, err := uotm.GetTokenInfo(ctx); err != nil {
Expand Down
18 changes: 11 additions & 7 deletions e2etest/zt_newe2e_list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ func init() {
type ListSuite struct{}

func (s *ListSuite) Scenario_ListBasic(svm *ScenarioVariationManager) {
srcService := GetRootResource(svm, ResolveVariation(svm, []common.Location{common.ELocation.Blob()}))
srcService := GetRootResource(svm, ResolveVariation(svm, []common.Location{common.ELocation.Blob(),
common.ELocation.File()}))

svm.InsertVariationSeparator(":")
body := NewRandomObjectContentContainer(svm, SizeFromString("1K"))
Expand All @@ -38,12 +39,15 @@ func (s *ListSuite) Scenario_ListBasic(svm *ScenarioVariationManager) {
AzCopyCommand{
Verb: AzCopyVerbList,
Targets: []ResourceManager{
srcObj.Parent().(RemoteResourceManager).WithSpecificAuthType(EExplicitCredentialType.SASToken(), svm, CreateAzCopyTargetOptions{
SASTokenOptions: GenericServiceSignatureValues{
ContainerName: srcObj.ContainerName(),
Permissions: (&blobsas.ContainerPermissions{Read: true, List: true}).String(),
},
}),
srcObj.Parent().(RemoteResourceManager).WithSpecificAuthType(ResolveVariation(svm,
[]ExplicitCredentialTypes{EExplicitCredentialType.OAuth(),
EExplicitCredentialType.SASToken()}), svm,
CreateAzCopyTargetOptions{
SASTokenOptions: GenericServiceSignatureValues{
ContainerName: srcObj.ContainerName(),
Permissions: (&blobsas.ContainerPermissions{Read: true, List: true}).String(),
},
}),
},
Flags: ListFlags{},
})
Expand Down

0 comments on commit 8c32b42

Please sign in to comment.