Configure AWS API ECS services
On AWS, Terraform module v6.0 introduces ECS as the target runtime for the API, split into three services by workload type. Each service scales automatically through Application Auto Scaling, adjusting its running task count between a minimum and maximum based on multiple metrics, including CPU target tracking and event loop timing. The module exposes optional variables to tune per-task size and task counts. The defaults are suitable for most deployments. See Upgrade to Terraform module v6 for the migration. 1024 CPU units equal 1 vCPU.braintrust-api handles general API traffic.
braintrust-api-ingest handles ingestion paths (/logs3, /logs3/overflow, /otel/v1/*).
braintrust-api-background handles background paths (evals, function invocation, proxy).
For example, to raise the ingestion service’s floor for a high-volume deployment:
braintrust_api_ingest_min_count for deployments with spiky ingestion volume or if you expect a launch that will suddenly increase log traffic, and braintrust_api_background_min_count for heavy eval workloads.
Configure Helm API workload isolation
This feature is available to Kubernetes deployments using Helm chart 6.13.0+. AWS ECS deployments use the Terraform-managed routing described above.
api.workloadIsolation.enabled: true creates dedicated braintrust-api-ingest and braintrust-api-background Deployments and Services alongside the default braintrust-api pool. The pools share the same image and base configuration while allowing independent replica counts, resources, probes, rollout settings, and disruption budgets, so classified ingestion or background load does not consume the default API pool’s capacity.
Your ingress or gateway must keep braintrust-api as its default backend and route the following paths to the specialized pools:
If your ingress cannot match requests by HTTP method (for example, GKE Ingress), route the listed paths for all methods instead.
Pools use fixed replica counts by default. Configure them with
api.replicas, api.workloadIsolation.ingest.replicas, and api.workloadIsolation.background.replicas. On GKE, you can scale each pool automatically instead. See Configure GKE API autoscaling.
Roll out workload isolation for an existing deployment
For an existing deployment, stage the rollout so you can verify each pool before routing traffic to it:-
Create the pools without routing traffic to them or switching Brainstore’s internal AI proxy. Set
api.workloadIsolation.brainstoreAiProxyToBackground: falseand apply: -
Verify the ingest and background pools are ready. Then update your ingress or gateway to route the classified paths to the new Services, and set
brainstoreAiProxyToBackground: trueto switch Brainstore’s internal AI proxy to the background pool:
brainstoreAiProxyToBackground to the default API Service and verify it is serving them, then disable workload isolation in the chart. The chart cannot update an external ingress or gateway on its own, so disabling isolation before rerouting would leave the classified paths pointed at Services that no longer exist.
Integrate with the Istio VirtualService
When using the chart-managed Istio VirtualService, setvirtualService.workloadIsolation.enabled: true after the isolated pools are healthy. The chart then renders the ingest and background route contract before your existing virtualService.http rules. The classified routes take precedence, so do not use virtualService.http to override a classified path.
This option requires both virtualService.enabled: true and api.workloadIsolation.enabled: true. The chart fails to render if either is missing.
Configuration reference
Default pool availability settings
Helm chart 6.13.0 or later also exposes availability settings for the defaultbraintrust-api pool. The defaults preserve the chart’s previous behavior, so no configuration changes are required when upgrading. The ingest and background pools inherit these values as their base configuration.
Configure GKE API autoscaling
Settingapi.autoscaling.enabled: true renders a HorizontalPodAutoscaler and an AutoscalingMetric for each API pool. Each pool then scales on three signals:
- CPU utilization scoped to the
apicontainer, so sidecars andextraContainersdo not skew the measurement. - Node.js event-loop utilization, as a ratio from 0 to 1.
- Mean Node.js event-loop delay, in seconds.
Prerequisites
- Data plane v2.9.0 or later, which serves the Prometheus metrics endpoint on the API health server.
- GKE 1.35.1-gke.1396000 or later.
- The Performance HPA profile enabled on the cluster.
- The Autoscaling API enabled on the cluster.
roles/autoscaling.metricsWritergranted to every node service account.- The Autoscaling API included in your service perimeter, if you use VPC Service Controls.
helm install and helm upgrade fail fast if the chart detects a missing prerequisite, rather than rendering a partial configuration:
- Setting
cloudto anything other thangooglefails, because autoscaling is supported only on GKE. - A cluster without the
autoscaling.gke.io/v1beta1API fails. Verify withkubectl api-resources | grep autoscalingmetric.
Enable autoscaling
replicas from that pool’s Deployment and the HorizontalPodAutoscaler controls the replica count instead. The chart also sets ENABLE_PROMETHEUS_METRICS to true and exposes api.healthServer.port (8001 by default) on the api container so the AutoscalingMetric can scrape it. Account for that port in any network policy that restricts traffic to the API pods.
Override autoscaling per pool
Withapi.workloadIsolation.enabled: true, the ingest and background pools inherit every value under api.autoscaling and can override any of them under api.workloadIsolation.<pool>.autoscaling, including the metric targets and the scaling behavior:
api.workloadIsolation.brainstoreAiProxyToBackground at its default true, which switches Brainstore’s internal AI proxy to the background pool as soon as you apply it. See Roll out workload isolation for an existing deployment.
Setting api.workloadIsolation.<pool>.autoscaling.enabled: false keeps that pool at a fixed replica count while its siblings continue to scale. That pool’s replicas value is honored again.
For background on the GKE resource behind this feature, see Google’s Expose custom metrics for autoscaling.
Configuration reference
Configure Brainstore fast readers
Fast readers are isolated Brainstore nodes dedicated to serving predictable UI queries (paginated viewers, span and trace lookups), preventing resource-intensive ad-hoc queries from making the UI unresponsive.- GCP and Azure: Fast readers are enabled by default starting in Helm chart v5.0.0. See the configuration reference below.
- AWS: Fast readers are enabled by default (2 nodes) starting in Terraform module v5.5.0. On earlier module versions they are disabled by default. Set
brainstore_fast_reader_instance_countin your Terraform configuration to control the node count, or set it to0to opt out (recommended for sandbox or non-production deployments).
Configuration reference
Fast readers are configured under thebrainstore.fastreader key in your values.yaml. If you have customized brainstore.reader settings, mirror those customizations to brainstore.fastreader.
- Azure
- GCP Autopilot
Azure users must explicitly set
brainstore.fastreader.volume.size when using Azure Container Storage (enableAzureContainerStorageDriver: true):Brainstore resource configuration
This section applies to GCP and Azure deployments using the Helm chart (v5.0.1+). AWS deployments manage Brainstore resources automatically.
resources block for each Brainstore component (brainstore.reader, brainstore.writer, brainstore.fastreader) is passed through as-is to the Kubernetes pod spec. You can omit limits entirely, set them to {}, or supply any valid Kubernetes resource spec.
Auto-derived Brainstore environment variables
As of Helm chart v5.1.0,BRAINSTORE_RESPONSE_CACHE_URI and BRAINSTORE_CODE_BUNDLE_URI are automatically populated from your objectStorage configuration and do not need to be set manually. The chart derives these values as follows:
If you previously configured these via
extraEnvVars, remove those overrides after upgrading to v5.1.0 to avoid conflicts.