Alibaba Cloud SDK provides advanced settings for HTTP connection pools, HTTPS requests, proxies, and timeout and retry mechanisms. You can use these settings to optimize performance, enhance security, and improve reliability in high-concurrency or restricted network environments.
HTTP connection pool settings
Use scenarios
-
High-concurrency requests: If your application sends a large number of concurrent HTTP requests, connection pools reuse existing TCP connections and reduce the overhead of frequent connection creation and teardown.
-
Performance optimization: You can set the connection pool size to limit the maximum number of connections. This prevents resource exhaustion and increases request processing efficiency.
Examples
-
An application concurrently calls multiple Alibaba Cloud services, such as Object Storage Service (OSS), Elastic Compute Service (ECS), and ApsaraDB RDS.
-
Uploading multiple files to OSS at the same time. Connection pools can significantly accelerate the upload process.
For more information about how to configure a connection pool, see Configure an HTTP connection pool.
HTTPS request settings
Use scenarios
-
Data security: HTTPS encrypts data in transit by using SSL/TLS, which prevents eavesdropping and tampering and ensures data integrity.
-
Compliance requirements: Industries such as finance and healthcare require encrypted data transmission, which makes HTTPS mandatory.
Examples
-
An application retrieves sensitive data, such as billing information and user privacy data, by calling Alibaba Cloud API operations.
-
An application must comply with General Data Protection Regulation (GDPR) or other data protection regulations.
For more information about how to configure HTTPS requests, see HTTPS request configuration.
Proxy settings
Use scenarios
-
Restricted network access: If your application runs behind a proxy server, such as in an enterprise intranet or firewall-controlled network, you can configure a proxy to reach external services.
-
Traffic monitoring: During development and debugging, you can route requests through a proxy to capture and analyze traffic.
Examples
-
An application deployed on an enterprise intranet uses an HTTP or HTTPS proxy to access Alibaba Cloud services.
-
Multiple applications in an enterprise share a proxy server that manages and routes requests to external services.
For more information about how to configure a proxy, see Configure a proxy.
Timeout settings
Use scenarios
-
Network stability: If network latency is high or server responses are slow, a proper timeout prevents requests from hanging indefinitely.
-
User experience: For user-facing applications, a proper timeout avoids prolonged waits when a service is unavailable.
Examples
-
If the network connection drops while a user uploads large files to OSS, a proper timeout terminates the request promptly and allows the user to retry the upload.
-
For time-consuming API operations such as batch operations, a proper timeout prevents prolonged waits.
For more information about how to configure a timeout period, see Timeout mechanism.
Retry settings
Use scenarios
-
Network jitter: In an unstable network, requests may fail intermittently. A retry mechanism automatically resends failed requests to increase the success rate.
-
Temporary service unavailability: If an Alibaba Cloud service is temporarily unavailable, a retry mechanism helps your application recover automatically.
Examples
If your application encounters intermittent network issues when calling an Alibaba Cloud service, you can configure the retry count and retry interval to increase the request success rate.
For more information about how to configure a retry mechanism, see Configure a retry mechanism.