Skip to main content

Bundle Optimization

Styra DAS uses internal bundle-building optimization rather than OPA's. You can also take advantage of OPA's bundle optimization features. This can be done by setting the optimization_level field in the bundle registry settings for a particular System.

Setting the value to 1 or 2 is equivalent to unpacking the bundle, then running opa build -O {optimization_level} to create a new, optimized bundle. The result of this process is placed into the bundle registry instead of the original.

note

After changing the optimization level setting, your existing bundles will not be rebuilt. A policy or data change is required before new bundles will be built with the new optimization setting.

You can check the existing bundle registry settings through the /v1/systems/:id API, for example:

curl -LSs -H "Authorization: Bearer $DAS_API_TOKEN" "$DAS_URL/v1/systems/$SYSTEM_ID"

This should yield a result similar to:

{
"request_id": "48b7bc73-3eaf-4608-8f90-0f2fdbc01fab",
"result": {
// ...
"bundle_registry": {
"max_bundles": 100,
"max_deployed_bundles": 9,
},
// ...
}
}

The bundle optimization setting may be changed by making a PUT request to the same API endpoint, for example:

curl -LSs -X PUT --data '{"bundle_registry": {"optimization_level": 1}}' -H "Authorization: Bearer $DAS_API_TOKEN" -H "Content-Type: application/json" "$DAS_URL/v1/systems/$SYSTEM_ID"

The updated settings will be included in the response body. The bundle_registry field should now look similar to:

{
"request_id": "66056c07-8b1a-469a-8843-c335c552822f",
"result": {
// ...
"bundle_registry": {
"max_bundles": 100,
"max_deployed_bundles": 9,
"optimization_level": 1
},
// ...
}
}