Installation Package Acceleration

Updated at:

Installation package acceleration speeds up dependency package downloads in Instant Service instances. After you enable it, the system injects and attempts to start a P2P download proxy in the environment. The proxy agent uses caching and peer-to-peer distribution for eligible download requests to reduce redundant back-to-origin requests and improve download efficiency.

Prerequisites and scope

  • Installation package acceleration is a template-level capability. You can enable it when you create a template or use the one-click option to enable it on an existing template in the Ready state.

  • Using the one-click option creates a new derived template. This does not modify the original template or affect instances that have already been created.

  • This feature is available only in select regions. If the console does not show the Installation Package Acceleration toggle or the one-click entry, the feature is not yet available in your region.

  • Only GET requests to download domains on the platform-configured allowlist are processed.

  • Wildcard domains are not supported. Domains not on the allowlist connect directly without acceleration.

  • Dynamic APIs, login requests, non-GET requests, and domains not on the allowlist bypass the P2P download proxy.

How it works

After you enable installation package acceleration, you do not need to modify installation commands, configure a proxy manually, import certificates, or change domain name resolution. The system handles eligible download requests automatically.

  • If the same dependency package is already cached in the cluster, subsequent downloads can be served from the cache or a P2P node, which reduces redundant back-to-origin requests.

  • When multiple instances download the same dependency package at the same time, they can share downloaded data blocks.

  • The first download, a cold cache, or no available nodes may still result in a download from the origin server.

  • Acceleration performance depends on origin server rate limiting, network quality, dependency package size, and cache hit rate.

Supported download sources

The following common download sources are accelerated by default:

Type

Common domains

Python / PyPI

pypi.tuna.tsinghua.edu.cn

China mirrors

mirrors.aliyun.com, mirrors.cloud.aliyuncs.com, mirrors.tuna.tsinghua.edu.cn

npm / Node.js

registry.npmmirror.com, npmmirror.com

Conda

repo.anaconda.com

Go

goproxy.cn

Note

The platform may adjust the allowlist by region. The actual scope depends on your environment configuration. For request-level constraints, see Prerequisites and scope.

Enable installation package acceleration

You can enable installation package acceleration when you create a template or use the one-click option to enable it on an existing template. Instances created from an enabled template inherit the acceleration capability automatically.

Enable when you create a template

  1. Go to the Instant Service workspace and create a template.

  2. Select From Image or From Public Template as the creation method.

  3. Turn on the Package Acceleration toggle.

  4. Fill in the remaining required information and submit.

  5. After the template build completes, check whether the installation package acceleration badge appears in the template list.

If the page does not show the Package Acceleration toggle, the feature is not available in your region.

Important

When you save an instance directly as a template, you cannot enable installation package acceleration for the first time. The new template inherits only the state of the source instance. To enable the feature, create the template from an image, a compatible public template, or a compatible existing template instead.

Enable acceleration on an existing template with the one-click option

  1. Go to the Instant Service workspace and open the template list.

  2. On the Private Templates tab, select a template in the Ready state that does not have acceleration enabled.

  3. Click the more actions icon (⋮) in the actions menu, then click Package Acceleration.

  4. The system creates a new derived template based on the selected template and enables acceleration automatically.

  5. Wait for the new template build to complete.

  6. Create an instance from the new template. Wait until the template is Ready before you start validation by completing the checks in Verify acceleration is active.

Important

The one-click option does not modify the original template or affect instances that have already been created. The success message indicates only that the build of the new template has started.

Inheritance rules

Installation package acceleration is a template-level capability. The inheritance behavior is as follows:

  • After you enable the feature on a template, instances created from that template inherit it automatically.

  • New templates derived from an enabled template continue to inherit the capability.

  • You cannot disable the capability in a derived template. Even if you pass enablePackageAccelerate: false, the inherited capability is not removed.

  • If you need a template without acceleration, create it from the original image or a source that does not have acceleration enabled.

The following table describes the behavior for different creation paths:

Creation path

Can enable

Behavior

Create from image

Yes

The system injects and starts the acceleration capability during the build.

Build from image through E2B

Yes

You can enable it regardless of whether build steps are included.

Rebuild from template

Yes

You can enable it when the build process runs again.

Derive from template without rebuild

Depends on source template

Enabled if the source environment contains compatible acceleration components. Otherwise, the system falls back — the build succeeds, but the resulting template does not include this capability.

Save from instance

No

Inherits only the state of the source instance. Cannot be used to enable the feature.

For older or incompatible templates, the system falls back automatically. The build process continues and does not fail due to missing or incompatible acceleration components, but the resulting template may not gain installation package acceleration.

API and E2B compatibility

You can enable installation package acceleration in the following ways:

  • Dashboard API request body: enablePackageAccelerate

  • Software development kit or extended header: X-EAS-Enable-Package-Accelerate

  • Dashboard runtime environment variable: ENABLE_PACKAGE_ACCELERATE

  • E2B ENV step: ENABLE_PACKAGE_ACCELERATE

The switch is resolved in the following order of precedence, from highest to lowest:

  1. Region switch

  2. Inherited enablement

  3. Request body enablePackageAccelerate

  4. X-EAS-Enable-Package-Accelerate header

  5. Dashboard runtime environment variable

  6. First E2B ENV step

  7. false

  • Only the first ENV step is read. Subsequent ENV steps with the same name do not take effect.

  • Switch values must be true or false.

Verify acceleration is active

Query template status

After the template build completes, query the template information:

curl -sS "https://<sandbox-api-host>/templates/<templateID>" \
  -H "X-API-KEY: <group-token>"

If the features field in the response contains packageAcceleration, installation package acceleration is enabled for the template:

{
  "templateID": "my-template",
  "features": ["packageAcceleration"]
}
Note

packageAcceleration is a template-level capability marker. It indicates only that the capability has been written into the template; it does not guarantee that acceleration components in existing environments have started successfully. For templates derived from old templates, old instances, or other existing environments, the system may fall back due to missing or outdated components. To ensure installation package acceleration is effective, we recommend rebuilding the template from a new image and including enablePackageAccelerate: true in the build request.

Check from within an instance

After you create an instance from a template with installation package acceleration enabled, run the following checks in the instance terminal:

Command

Expected result

grep -q '^ENABLE_PACKAGE_ACCELERATE=true$' /root/sandbox.env && echo enabled

Outputs enabled

systemctl is-active sandbox-supervisor

Outputs active

curl -sf http://127.0.0.1:28082/health

Returns a successful response

If all preceding checks pass, the environment variable is uniquely set, the proxy agent process is running, and the health check succeeds. Use these checks only to confirm that the acceleration capability has started. They do not guarantee that a specific download will hit the cache. Actual download speed still depends on cache hit rate and network conditions.

Usage notes

  • Do not manually set http_proxy, https_proxy, CA certificates, or /etc/hosts. The system handles these automatically when the capability is enabled.

  • Installation package acceleration affects only dependency package downloads. It does not change business code execution logic.

  • If your package manager uses a private source, a proxy source, or an unconfigured mirror domain, those downloads are not accelerated.

  • The first download may not show a noticeable speed improvement. Repeated or concurrent downloads of the same dependency are more likely to benefit.

  • Instances created from a template with acceleration enabled inherit the capability automatically. You cannot disable it in a derived template.

FAQ

Why can't I see the installation package acceleration toggle or the one-click entry in the console?

Installation package acceleration is not available in your region. Contact your platform administrator to confirm region support.

Why are some dependency package downloads not faster?

Common reasons include:

  • The dependency source domain is not on the allowlist.

  • The download is not a GET request.

  • This is the first download and no local cache exists.

  • The origin server or intermediate network applies rate limiting.

  • No P2P or cache nodes are currently available.

Why doesn't a template saved from an instance have acceleration enabled?

Saving an instance as a template is a snapshot operation that copies only the source instance's current state. It cannot enable the feature for the first time. Create the template from an image or a compatible template instead.

Why doesn't an old template show the acceleration badge after a build?

Old templates may lack compatible acceleration components or have components that do not meet version requirements. The system falls back automatically without blocking the build, but the resulting template does not have the capability.

Why can't I disable acceleration in a derived template?

Installation package acceleration is inherited as a template capability by derived environments. You cannot disable it in a derived template. If you need a template without acceleration, create it from a source that does not have acceleration enabled.

Why didn't the original template change after I used the one-click option?

The one-click option creates a new derived template. It does not modify the original template or affect instances that have already been created. Use the newly generated template to create subsequent instances.