Alibaba Cloud SDK for Go programming language.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1.2 KiB

← Logger | Concurrent(中文) | Asynchronous Call →

Concurrent Request

  • Due to the concurrency nature of the Go language, we recommend that you control the concurrent requests for the SDK at the application level.
  • In order to facilitate your use, we also provide a direct use of concurrent invocation mode, the relevant concurrency control by the SDK internal implementation.

Open SDK Client's concurrent function.

// Maximum Running Vusers
poolSize := 2
// The maximum number of requests that can be cached
maxTaskQueueSize := 5

// Enable asynchronous functionality at creation time
config := sdk.NewConfig()
            .WithGoRoutinePoolSize(poolSize)            // Optional,default:5
            .WithMaxTaskQueueSize(maxTaskQueueSize)     // Optional,default:1000
ecsClient, err := ecs.NewClientWithOptions(config)

// It can also be opened after client is initialized
client.EnableAsync(poolSize, maxTaskQueueSize)

← Logger | Concurrent(中文) | Asynchronous Call →