Alibaba Cloud Storage Anti-sealing: Alibaba Cloud OSS Large File Resumable Transfer and Multi-threaded Multipart Upload Depth Guide

cloud 2026-06-05 阅读 17
3

In mobile Internet distribution, audio and video services or big data transmission scenarios, we often need to process hundreds of MB or even several GB of large files (such as game APK, iOS IPA installation package, 4K video, etc.). If you directly use ordinary form upload (Form Upload) or simple file upload (PutObject), the whole transmission will collapse directly when the network is slightly shaken, or when the mobile phone switches base stations or tunnels are disconnected, and users can only restart from 0%.

In order to solve the stability and speed problems of large file transmission,

Alibaba Cloud OSS

Multipart upload (Multipart Upload)

with

The resumable upload (Resumable upload) mechanism. This article will completely abandon the lengthy slangs of official documents and take you through customs quickly from core principles, underlying logic to actual code architecture. At the same time, for the core heartache point of installation package distribution, the depth of how to achieve through architecture design.

Alibaba Cloud OSS anti-blocking

,

Alibaba Cloud Storage APK Anti-Ban

and also

Alibaba Cloud OSS IP address anti-blocking

.

1. the underlying logic: What are multipart upload and resumable upload?

Simply put, multipart upload is to "shred" a large file into multiple small data blocks (Parts) and send them

Alibaba Cloud OSS

The nodes are finally merged into a complete file in the cloud.

Resumable upload is based on multipart upload, adding a

Local Record Point (Checkpoint)

. It records in real time which shards have been successfully uploaded. Once the network is disconnected or the process is killed, when the upload is triggered again, the program will read the Checkpoint file, skip the completed parts directly, and only download or upload the remaining parts.

The core of multipart upload is three steps:

Initialize fragment request (InitiateMultipartUpload): Tell OSS that I want to upload a large file, and OSS will return a unique UploadId for the whole network after receiving it.

Parallel upload of parts (UploadPart): The program takes this UploadId and uploads each part concurrently in multiple threads. Each shard must specify a unique PartNumber(1-10000).

Complete multipart upload (CompleteMultipartUpload): After all the parts are uploaded, a merge command is sent to OSS. OSS will concatenate these parts to generate the final file.

2. Core Code Implementation: Multithreaded Fragmentation and Breakpoint Continuation

Take the mainstream enterprise Java SDK as an example to show how to enable multi-thread acceleration and breakpoint recording. (Other languages such as Python, Go, and Node.js have exactly the same logic).

1. Basic dependency introduction

<

dependency>

<groupId>com.aliyun.oss</groupId>

<artifactId>aliyun-sdk-oss</artifactId>

<version>3.17.4</version> </dependency>

2. Advanced upload parameter configuration

Through

UploadFileRequest

class, we can turn on thread pool and breakpoint resume extremely easily, without manually writing the underlying shard loop.

3. Industry Acupoint: "Anti-Sealing" High-Level Architecture in APK/IPA Large File Distribution

The completion of the large file transfer is only the first step. In actual business, many teams will

Alibaba Cloud OSS

As a distribution channel for application stores, grayscale tests, or mobile apps (APK for Android, IPA for iOS).

At this time, you will encounter an extremely cruel reality: due to frequent download streams, malicious reports from competitors in the same industry, or directly triggering the sensitive word risk control of WeChat/QQ's built-in green network, your download link often displays "poison/intercepted" in WeChat, and even causes Aliyun officials to directly cut off your OSS default domain name access in order to protect themselves.

How to really do well

Alibaba Cloud OSS anti-blocking

,

Alibaba Cloud Storage APK Anti-Ban

and also

Alibaba Cloud OSS IP address anti-blocking

? The following three layers of "body armor" must be introduced at the architectural level ":

1. Forcibly block the default domain name and use a custom anti-sealing domain name cluster

The iron rule of survival: Never expose * .oss-cn-xxx.aliyuncs.com to end users.

Once the default domain name is complained or risk control is caused due to some characteristics of APK/IPA, the entire bucket will be deleted.

Correct approach: Bind a custom domain name (such as static.yourdomain.com) on the OSS side. At the same time, prepare multiple sets of completely independent alternate domain names as a polling pool.

Distribution logic: The backend interface dynamically distributes different download link domain names according to the user's region, network environment, and even the request client. Once domain name A is found to be hijacked and blocked by operators in WeChat or some provinces, the system automatically and seamlessly switches to domain name B, and the source files inside OSS do not need to be moved at all. This is the most basic Aliyun OSS anti-blocking logic.

2. Pre-Aliyun CDN/Full Site Acceleration: Hide OSS Source Station and Defend Brush Amount

If users are allowed to directly connect to OSS to download hundreds of MB of APK or IPA, not only will the return traffic cost be astonishingly high

And once it suffers a DDoS attack, or is downloaded crazily with a script, it will result in a huge bill overnight.

Hide origin: By configuring Alibaba Cloud CDN, all download requests of users are intercepted on the edge node, and CDN initiates multi-thread back-to-origin to OSS.

Response to Blocking: If the CDN's accelerated domain name is blocked in WeChat, you only need to untie the domain name in the CDN console and change a new domain name to go online. The OSS source station is as stable as Mount Tai.

Security escort (anti-malicious brush volume): Enable URL authentication (timestamp anti-theft chain) on CDN. The download link has auth_key parameters and an expiration time (e. g. 5 minutes). Even if the user catches the installation package address, forwarding it is an invalid link, which completely solves the problem of malicious theft during the anti-blocking process of Aliyun storage APK.

3. Environmental judgment and forced jump out (social software ecological anti-interception)

Whether it is

Alibaba Cloud Storage APK Anti-Ban

Still

Alibaba Cloud OSS IP address anti-blocking

The vast majority of "blocked" occurred within WeChat or QQ.

Best Anti-Sealing Practice for Android APK: Write Environmental Judgment in H5 Download Landing Page. When it is detected that the User-Agent contains MicroMessenger (WeChat), the mask prompt "Please click on the upper right corner to select Open in Browser". More advanced technologies can use specific configuration response headers (such as Content-Disposition: attachment; filename = "app.apk"). In WeChat of some mainstream Android systems, it can directly wake up the system browser of the mobile phone to download automatically and avoid manual reporting.

The secure distribution channel of iOS IPA: iOS must follow Apple's official itms-services:// protocol to download IPA packages remotely, which relies on an HTTPS manifest.plist configuration file. Since WeChat has completely blocked the agreement, you must store plist files and real. ipa files in Aliyun OSS, and also guide users to open and download in Apple's native Safari browser in order to pull up iOS's enterprise sign or super sign installation process in compliance.

4. Advanced Maintenance: Clean up Unfinished Fragment Garbage (Save Money)

When using resumable upload and multipart upload, there is a very easy to ignore

The Expense Trap

: If a 1GB file is uploaded with only 500MB, the 500MB fragment will remain due to complete network interruption or the user uninstalling the software directly.

Invisible in your OSS storage space

, and continuously calculate the storage capacity fee! You don't see these fragments in the regular console list.

Solution: Configure lifecycle (Lifecycle) from

Move to clean up

To avoid these unfinished shards eating up your budget, be sure to do the following:

Go to the Alibaba Cloud OSS console and select the corresponding bucket.

Click Data Management-> Lifecycle-> Create Rules.

Policy Configuration: The policy is valid only based on: Fragmentation (select Fragmentation Cleanup). Remove expired fragments: Set the "file expiration days" to 3 days or 7 days.

In this way, any expired garbage fragments that cannot be merged due to network disconnection or abnormality will be automatically crushed and deleted by OSS, saving you a lot of money.

5. Summary

Efficient processing of large files, the bottom layer is

Alibaba Cloud OSS

Solid multi-threaded sharding and local Checkpoint breakpoint continuous transmission mechanism, which ensures the "hard power" of transmission ". In the upper-layer application and distribution network, the cooperation with custom domain name, CDN timestamp authentication, and WeChat environment jump-out guidance for mobile terminal (APK/IPA) constitutes the "soft power" of continuous business operation ".

Combine the two and your large file distribution system can run as fast as a sports car and be as secure and seal-proof as an armored car.

3
← 返回新闻中心