edit-icon download-icon

Customize configurations

Last Updated: Mar 20, 2018

You can use the config module of Alibaba Cloud Go SDK to customize configurations.

  1. config := NewConfig().
  2. WithEnableAsync(true).
  3. WithGoRoutinePoolSize(5).
  4. WithMaxTaskQueueSize(1000)
  5. client, err := ecs.NewClientWithOptions("<region-id>", config, credential)

Note: The config module of Alibaba Cloud Go SDK does not support the following calling method:

config := &Config{EnableAsync: true,}

The following table shows the supported custom configurations.

Configuration
Default value
Description
Note
AutoRetry
true
Whether to enable automatic retry.
-
MaxRetryTime
3
The maximum number of retries.
If the automatic retry is enabled, the maximum time consumption for a single call is:
Timeout (MaxRetryTime + 1)
Timeout
10time.Second
Timeout value.

Full-link timeout, including establishing connection, redirecting, and reading response.

When the value is zero, no timeout occurs.
HttpTransport
nil
Enable configuration of net/http.client.
You can configure Go HTTP client with this configuration, such as persistent connection.
EnableAsync
false
Whether to enable the asynchronous call.
-
MaxTaskQueueSize
1000

The length of the asynchronous queue.

This configuration takes effect only when EnableAsync is set to true.
When the queue is full, new calls are congested.
GoRoutinePoolSize
5

The maximum number of concurrent connections

This configuration takes effect only when EnableAsync is set to true.

-
Thank you! We've received your feedback.