Skip to main content
For the complete documentation index for agents and LLMs, see llms.txt.

Configure Service Hosting and Cost

Tune how much compute a service gets, how many replicas run, and how long the service stays active. These settings balance responsiveness against cost.


Prerequisites​

Scale the Service and Control Cost​

These settings apply only to this service. If the same pipeline is also deployed on its own, configure that deployment separately in the pipeline deployment settings.

Credit cost

Credits consumed ≈ min replicas × hours deployed. Services on standby or in inactive status consume no credits.

For a full breakdown, see Understand Your Pipeline Usage.

  1. In Haystack Enterprise Platform, click Gateway in the navigation and open the service.
  2. Click Settings and go to the Hosting section.
  1. Choose a preset, or select Custom to set your own values:
    • High demand: For production traffic that needs high availability and scaling.
    • Low demand: For testing or services that are used rarely.
    • Custom: Set Min replicas, Max replicas, and Idle timeout yourself.
  2. Confirm your changes.

You can change these settings at any time. To check whether the service needs more resources before you change them, see Check Service Metrics.

To cap how many requests one replica serves at the same time, see Limit Requests per Replica with the REST API.

What Min Replicas Guarantees​

If your service answers slowly right after it starts, this is why. Min replicas keeps that many replicas claimed and ready for your service. It guarantees at least one ready replica, not that every replica has already loaded your pipeline. A replica in the minimum set loads the pipeline when it receives its first request. A pipeline with a long preparation, for example one that loads a local embedding model, answers slowly on a replica that hasn't loaded it yet.

You can see this after:

  • The first activation of a service.
  • A revision switch, when you publish a new revision to the service.
  • A top-up, when the platform starts a replacement to bring the service back up to Min replicas.

During this time, queries can take much longer than usual. A streaming response can send only ping events with phase set to cold_start. If many queries wait on replicas that are still loading, the service can reject further queries with a Too many pending requests for this version error. For details on cold_start pings, see Stream Pipeline Responses with the REST API.

Replicas in the minimum set consume credits while they are claimed, including before they load the pipeline.

Warm a service before you send load

After an activation or a revision switch, send a few test queries before real traffic arrives. Send about one query for each replica you expect, with the Try it section of the service or with the REST API. Wait until the queries answer in your normal response time, then start the load. If a query fails with Too many pending requests for this version, wait and send the test queries again.

Shorten the Cold Start​

Warming hides a cold start, but a faster pipeline start removes it. To shorten the start:

  • Avoid large dependencies. Every package under dependencies in the pipeline YAML, and every external dependency of a custom component, is installed when a replica prepares your pipeline. Large packages, such as torch, transformers, or sentence-transformers, can add minutes. Use the components that come with Haystack Platform where you can, and add only the packages your pipeline needs.
  • Don't load models locally. A component that downloads and loads a model on the replica, such as a local embedder, ranker, or language model, repeats that work on every replica that starts. Use a hosted model instead: the model stays loaded on the provider's side, and the replica only makes an API call. For the options, see Using Hosted Models and External Services.

Load a model locally only if it's a hard requirement, for example because your data can't leave the platform, and only if you can afford the cold start. In that case, pick the smallest model that meets your needs and warm the service before every expected load.

After you change the pipeline and publish a new revision, send a test query and compare the response time with your normal response time. For help reading the results, see Check Service Metrics.

Run a Pipeline Larger Than 256 KB​

Saving a pipeline or index configuration larger than 256 KB fails with error 413. This limit applies when you create, validate, or update a pipeline, pipeline version, or index, in Builder or through the API. The limit doesn't apply to a YAML configuration pushed to a service as a revision, so run a pipeline over 256 KB as a serverless service. You push the YAML with the REST API, and you can't edit the pipeline in Builder afterwards. For the steps, see Run a Pipeline Larger Than 256 KB with the REST API.

What To Do Next​