Introduction
This article describes how to improve the success rate and speed of COS SDK operations such as uploads and downloads by optimizing network performance.
Feature Overview
In mobile app development, network optimization is crucial for user experience, as inherent issues such as weak networks, DNS problems, and connection performance in mobile networks are more severe compared to fixed networks. Therefore, optimizing mobile network performance is particularly important.
COS SDK provides a series of network optimization features, including DNS resolution optimization, network route acceleration, weak network optimization, and custom network layer functionality.
Therefore, if you are particularly concerned about the success rate and latency of COS operations such as uploads and downloads, you can implement the network optimization solutions for COS access provided in this article.
Scheme Overview
|
| abnormal DNS resolution, domain hijacking, cross-network access, and so on | Integrate HTTPDNS with COS SDK |
| cross-border, cross-network, remote regions, and other long-distance complex network routes | COS SDK integrates with COS Global Acceleration, COS Global Acceleration + EdgeOne |
| Mobile weak network environment | COS SDK integrates with EdgeOne's QUIC protocol |
| APP already has a mature network optimization solution. | COS SDK integrates with custom network layer |
Optimization Methods
Option 1: DNS Resolution Optimization
Background and Problems
COS SDK uses LocalDNS by default. During DNS resolution, issues such as abnormal resolution, domain hijacking, and cross-network access may occur, leading to slow or failed COS operations such as uploads and downloads.
Abnormal resolution: causing failure to connect to the server and request failure.
Domain hijacking: resulting in access to non-COS servers and causing request and response failures.
Cross-network access: resulting in slow network requests, and even request timeouts and failures.
Optimized scheme
By integrating HTTPDNS, the aforementioned issues can be avoided, thus resolving challenges caused by abnormal domain resolution in mobile internet services. For details, see DNS Resolution Optimization. Billing Instructions
Although HTTPDNS offers a certain free quota, exceeding it will incur fees. For details, see the HTTPDNS pricing. Option 2: Network Route Acceleration
Background and Problems
Tencent Cloud has deployed storage centers in many regions worldwide, and customers can selectively enable these storage centers. However, even so, it remains unavoidable that some end-users are too far from the storage centers, and some customers have business scenarios requiring cross-region or even transoceanic access. Long-distance data access typically implies longer network paths and greater transmission latency. Moreover, if any intermediate node experiences network jitter, packet loss, or other issues, it will reduce the access speed and success rate of the entire link.
Optimized scheme
To address the poor network access quality caused by excessively long network paths in long-distance access scenarios, solutions like COS Global Acceleration and EdgeOne can forward user requests to the edge nodes closest to users, processing user data locally. Leveraging Tencent Cloud's acceleration network refined over years, these solutions then transmit data to storage centers via optimal paths. For details, see Network Path Acceleration. Billing Instructions
Option 3: Weak Network Optimization
Background and Problems
Although the coverage of 4G and 5G networks continues to expand, users may still encounter weak or unstable network signals in many areas, particularly in remote regions and indoor environments. Additionally, even in areas with good network coverage, users may experience degraded network performance due to network congestion or other factors.
In poor network conditions, you may encounter the following issues: slow connections, slow data transfer, high packet loss rates, and significant network fluctuations. These problems can adversely affect the success rate and speed of COS operations like uploads and downloads.
Optimized scheme
COS SDK supports the QUIC protocol. QUIC is a low-latency, high-reliability communication protocol implemented over UDP, with the standard HTTP/3 protocol being based on QUIC. QUIC supports 0-RTT connection establishment and multiplexing without head-of-line blocking. It enables user-space congestion control implementation on the client side, maximizing actual data transmission bandwidth utilization. Even in poor network conditions with high packet loss and latency, QUIC ensures high-quality data communication. Additionally, QUIC supports connection migration, allowing seamless network transitions during frequent network switching on mobile devices without service interruption.
By accessing the QUIC network via COS SDK through the EdgeOne network entry point that supports the QUIC protocol, and configuring COS-related settings. Billing Instructions
Method 4: Custom Network Layer
If the default network implementation of COS SDK does not meet your requirements, or if your APP already has a well-developed custom network library with related optimizations, you can implement a custom network layer in COS SDK.
This is a highly flexible approach where the optimization of network issues, effectiveness, and costs depends entirely on the developer's custom network layer.
Note:
The custom network layer feature requires a certain understanding of network programming. If you are not sure how to use this feature, we recommend using the default network implementation of COS SDK.
Best Practices
Due to varying business focus and user base across different developers, each of the aforementioned optimization approaches involves certain costs. Below are practical recommendations for some common scenarios.
Note:
The following recommendations are for reference only. Specific practices should be determined based on your business requirements and cost budget.
Domestic users: DNS resolution optimization
Overseas users: DNS resolution optimization + network path acceleration
Weak network environment: Weak network optimization
Example Projects