Skip to content

App and game distribution

Installers and game assets are large and released in bursts: in the few hours after a new version ships or a server launches, downloads run many times higher than usual. Distribution has to be fast and stable, keep third-party sites from hotlinking installers and beta builds from leaking, and avoid accidentally overwriting a version that's already released.

Typical challenges

ChallengeWhat it looks like
Release peaksMassive downloads the moment a new version ships strain the origin and bandwidth
Accidental overwritesA packaging script runs twice and overwrites an installer that's already released
Download experienceThe browser opens the installer as text, or the downloaded file name is wrong
Beta leaksLinks to beta builds get forwarded to public channels
HotlinkingThird-party download sites link directly to your installers, and you pay for the traffic
Overseas playersDownloads are slow for overseas users
Hot updatesAsset bundles update often and must take effect quickly while still making full use of the cache

Industry examples

The products mentioned here only illustrate common needs in the industry and don't imply that they use Bitiful.

Update day for a major mobile game: open-world games like Genshin Impact

Background: Asset packages for a major version update are often several GB. In the few hours after the update opens, huge numbers of players download at once, and overseas players pour in at the same time.

How Bitiful helps:

  • Put asset packages in separate directories by version number. Versioned files are cached for a long time, and only the version manifest isn't cached;
  • Before the update opens, prefetch the new assets to nodes on the Cache purge page, and turn on global nodes to cover overseas players;
  • On update day, watch bandwidth at 1-minute granularity in Usage, filter failed downloads by status code in Live logs, and expand them to see the region and client;
  • To roll back, just change the version manifest back to the old version. The old assets are still in the cache and in storage.

Result: The moment the update opens, there's no need to fetch from the origin and compete for bandwidth, failed downloads can be pinpointed on the spot, and rolling back takes changing just one file.

Direct-install packages on the official websites of global apps

Background: Many apps and tools aimed at overseas markets offer APK, DMG, and EXE direct-install packages on their official websites. Third-party download sites often link directly to these installer URLs, leaving the developer to pay for the traffic, and links to beta builds leak easily too.

How Bitiful helps:

  • Distribute installers through a CDN domain (the bucket's default domain can't serve .apk or .ipa downloads). Download links carry response-content-disposition so browsers download them directly with the correct file name, and edge rules limit per-connection speed;
  • Referer hotlink protection refuses embedding by third-party download sites, and the beta directory requires an advanced authentication signature;
  • The release system writes official versions with If-None-Match: *, so even if a packaging script runs by mistake, it can't overwrite an installer that's already released.

Result: Downloads are faster and more stable, hotlinking traffic disappears, beta builds stop leaking, and releases are safer.

What each part of Bitiful does

CapabilityWhat it does here
S4 object storageStores installers and asset bundles for every version. A single file can be up to hundreds of TiB, and past versions are kept without tiers
Multipart uploadThe build system uploads large installers concurrently and can retry a single failed part
Conditional requestsReleases carry If-None-Match: *, so an existing version isn't overwritten
Sub-user permissionsCI can write only to builds/, and only the release system can write to releases/
Simul-TransferTesters download internal build artifacts while they're still uploading
CDNPublic installer downloads must go through the CDN (the bucket's default domain can't serve .apk or .ipa files). Nearly 3,000 nodes, with global nodes available
Rewrite response headers with link parametersLinks carry response-content-disposition, so installers download directly with the file name you set
Edge rules: CORS and speed limitLimit per-connection speed to control costs
Edge rules: blockingReferer hotlink protection, blocking third-party download sites, and controlling distribution by region
Advanced authenticationBeta builds can be downloaded only through links with a signature and an expiry
Cache rulesCache versioned installers and assets for a long time, and don't cache the version manifest
Purge and prefetchPush the new version to nodes before release, and purge the version manifest after release
Certificate CenterAuto-renews the download domain's HTTPS certificate, so an expired certificate doesn't break updates
Usage / Top content / Live logsWatch bandwidth by the minute on release day, and investigate the status codes and regions of failed downloads

Versioned directories

builds/{branch}/{buildNumber}/app.apk         CI build artifacts (internal)
releases/{version}/app-{version}.apk          Release installers
releases/{version}/app-{version}.dmg
hotfix/{assetVersion}/{assetBundle}.bundle    Hot-update assets
latest.json                                   Version manifest

File names include the version number and their contents never change, so they're safe to cache for a long time. Only latest.json gets updated.

CI uploads and overwrite protection

CI uploads build artifacts with a sub-user that can write only to builds/. The release system copies packages that pass testing to releases/ with If-None-Match: * on the write. If the target already exists, it returns 412, so a released version isn't overwritten.

Configure the download domain

Bind a CDN domain and turn on HTTPS. If you have many overseas users, choose global nodes. Set these edge rules:

# CORS and speed limit: limit per-connection speed for installers
http.request.uri.path.extension in {"apk" "ipa" "dmg" "exe" "zip"}

# Cache: don't cache the version manifest
http.request.uri.path eq "/latest.json"

# Advanced authentication: require signatures for the beta directory
starts_with(http.request.uri.path, "/beta/")

Then add Referer hotlink protection and third-party download site blocking as needed. Generate signed links for the beta directory with advanced authentication.

Prefetch before release

After the new version is uploaded and before you update latest.json, prefetch the new installer URLs on the Cache purge page so nodes cache them in advance.

Switch versions

Update latest.json to point to the new version and submit a URL purge for that file. Clients read the manifest and download from the new address.

Monitor on release day

In Usage, watch bandwidth and status codes at 1-minute granularity. In Live logs, filter by status code for 4xx and 5xx, and expand failed requests to see their region and User-Agent.

Key practices

Why installers should go through the CDN

The bucket's default domain has a single-thread speed limit, forces downloads in the browser, and can't serve installers such as .apk and .ipa, so it's only suitable for testing and programmatic reads and writes. Use a CDN domain for public distribution. See Limits.

Control download costs

PracticeEffect
Per-connection speed limitBarely noticeable for normal downloads, while multi-threaded downloaders can't multiply bandwidth without limit
Referer hotlink protectionTraffic from third-party download sites is rejected outright
Block unusual User-AgentsStops bulk scraping
Resource packagesBuy resource packages before release season to lower the unit price

Hot-update assets

Asset bundles go in separate directories by version number, and clients download the changed assets according to the manifest. Asset files are cached for a long time, and only the manifest is purged. To roll back, point the manifest back to the old version; the old assets are still in the cache and in storage.

Internal builds downloadable within seconds

When CI uploads build artifacts with a single PutObject, testers add no-wait=10 to the download link (include it in the signature for private files) and can start downloading during the upload. Large files uploaded with multipart upload can be downloaded only after the upload completes. See Simul-Transfer.

Launch checklist

  • Installer file names include the version number, and only the version manifest gets updated
  • CI and the release system use different sub-users, and releases carry If-None-Match: *
  • The download domain has HTTPS turned on with auto-renewing certificates
  • Download links carry response-content-disposition, and per-connection speed limits, hotlink protection, and no caching for the manifest are configured
  • Signature authentication is turned on for the beta directory
  • Prefetch before release, and purge the manifest after release
  • Someone watches Usage and Live logs on release day