Help Center/ Object Storage Service/ SDK Reference/ .NET/ Initialization/ Configuring an Instance of ObsClient
Updated on 2024-05-08 GMT+08:00

Configuring an Instance of ObsClient

When you call the ObsConfig configuration class to create an instance of ObsClient, you can configure the agent, timeout duration, maximum allowed number of connections, and some other parameters listed in the following table.

Parameter

Description

Recommended Value

Endpoint

Endpoint for accessing OBS, which contains the protocol type, domain name (or IP address), and port number. For example, https://your-endpoint:443. For security purposes, you are advised to use HTTPS.

N/A

Timeout

Timeout duration for synchronous callings, in ms. The default value is -1, which indicates no timeout limitations.

N/A

ReadWriteTimeout

Timeout duration for transmitting data at the Socket layer, in ms. The default value is 60000.

[10000, 60000]

AsyncSocketTimeout

Timeout duration for asynchronous callings, in ms. The default value is -1, which indicates no timeout limitations.

N/A

MaxIdleTime

Allowed connection idle time, in ms. If a connection exceeds the specified value, the connection will be closed. The default value is 30000.

Default

ConnectionLimit

Maximum number of concurrently opened HTTP connections. The default value is 1000.

Default

MaxErrorRetry

Maximum number of retry attempts (caused by abnormal requests, 500 errors, and 503 errors). The default value is 3.

[1, 5]

ReceiveBufferSize

Size of the socket reception buffer. The default value is 8192.

[8192, 65536]

SecurityProtocolType

Encryption protocol type when HTTPS is used.

N/A

ProxyHost

Host address of the proxy server.

N/A

ProxyPort

Port ID of the proxy server.

N/A

ProxyUserName

User name used for connecting to the proxy server.

N/A

ProxyPassword

Password used for connecting to the proxy server.

N/A

ProxyDomain

Domain to which the proxy belongs

N/A

ValidateCertificate

Whether to verify the server certificate. The default value is false.

N/A

BufferSize

Read or write cache size used for uploading an object to the socket stream, in bytes. The default value is 8192.

Default

KeepAlive

Whether to use persistent connections to access OBS. The default value is true.

N/A

  • Parameters whose recommended value is N/A need to be set based on your needs.
  • If the network is unstable, you are advised to set larger values for Timeout AsyncSocketTimeout, and ReadWriteTimeout.
  • If the value of Endpoint does not contain any protocol, HTTPS is used by default.
  • For the sake of high DNS resolution performance and OBS reliability, you can set Endpoint only to the domain name of OBS, instead of the IP address.