Scale pod-based indexes
This guidance applies to pod-based indexes only. With serverless indexes, you don’t configure any compute or storage resources, and you don’t manually manage those resources to meet demand, save on cost, or ensure high availability. Instead, serverless indexes scale automatically based on usage.
While your index can still serve queries, new upserts may fail as the capacity becomes exhausted. If you need to scale your environment to accommodate more vectors, you can modify your existing index and scale it vertically or create a new index and scale horizontally.
This page explains how you can scale your pod-based indexes horizontally and vertically.
Vertical vs. horizontal scaling
If you need to scale your environment to accommodate more vectors, you can modify your existing index to scale it vertically or create a new index and scale horizontally. This article will describe both methods and how to scale your index effectively.
Vertical scaling
Vertical scaling is fast and involves no downtime. This is a good choice when you can’t pause upserts and must continue serving traffic. It also allows you to double your capacity instantly. However, there are some factors to consider.
Increase pod size
The default pod size is x1
. You can increase the size to x2
, x4
, or x8
. Moving up to the next size effectively doubles the capacity of the index. If you need to scale by smaller increments, then consider horizontal scaling.
Increasing the pod size of your index does not result in downtime. Reads and writes continue uninterrupted during the scaling process, which completes in about 10 minutes. You cannot reduce the pod size of your indexes.
The number of base pods you specify when you initially create the index is static and cannot be changed. For example, if you start with 10 pods of p1.x1
and vertically scale to p1.x2
, this equates to 20 pods worth of usage. Pod types (performance versus storage pods) also cannot be changed with vertical scaling. If you want to change your pod type while scaling, then horizontal scaling is the better option.
You can only scale index sizes up and cannot scale them back down.
When to increase pod size
If your index is at around 90% fullness, we recommend increasing its size. This helps ensure optimal performance and prevents upserts from failing due to capacity constraints.
How to increase pod size
You can increase the pod size in the Pinecone console or using the API.
- Open the Pinecone console.
- Select the project containing the index you want to configure.
- Go to Database > Indexes.
- Select the index.
- Click the … button.
- Select Configure.
- In the dropdown, choose the pod size to use.
- Click Confirm.
- Open the Pinecone console.
- Select the project containing the index you want to configure.
- Go to Database > Indexes.
- Select the index.
- Click the … button.
- Select Configure.
- In the dropdown, choose the pod size to use.
- Click Confirm.
Use the configure_index
operation and append the new size to the pod_type
parameter, separated by a period (.).
Example
The following example assumes that docs-example
has size x1
and increases the size to x2
.
The size change can take up to 15 minutes to complete.
Check the status of a pod size change
To check the status of a pod size change, use the describe_index
endpoint. The status
field in the results contains the key-value pair "state":"ScalingUp"
or "state":"ScalingDown"
during the resizing process and the key-value pair "state":"Ready"
after the process is complete.
The index fullness metric provided by describe_index_stats
may be inaccurate until the resizing process is complete.
Example
The following example uses describe_index
to get the index status of the index docs-example
. The status
field contains the key-value pair "state":"ScalingUp"
, indicating that the resizing process is still ongoing.
Horizontal scaling
There are two approaches to horizontal scaling in Pinecone: adding pods and adding replicas. Adding pods increases all resources but requires a pause in upserts; adding replicas only increases throughput and requires no pause in upserts.
Add pods
Adding additional pods to a running index is not supported directly. However, you can increase the number of pods by using our collections feature to create a new index with more pods.
A collection is an immutable snapshot of your index in time: a collection stores the data but not the original index configuration. When you create an index from a collection, you define the new index configuration. This allows you to scale the base pod count horizontally without scaling vertically.
The main advantage of this approach is that you can scale incrementally instead of doubling capacity as with vertical scaling. Also, you can redefine pod types if you are experimenting or if you need to use a different pod type, such as performance-optimized pods or storage-optimized pods. Another advantage of this method is that you can change your metadata configuration to redefine metadata fields as indexed or stored-only. This is important when tuning your index for the best throughput.
Here are the general steps to make a copy of your index and create a new index while changing the pod type, pod count, metadata configuration, replicas, and all typical parameters when creating a new collection:
- Pause upserts.
- Create a collection from the current index.
- Create an index from the collection with new parameters.
- Continue upserts to the newly created index. Note: the URL has likely changed.
- Delete the old index if desired.
For detailed steps on creating the collection, see backup indexes. For steps on creating an index from a collection, see Create an index from a collection.
Add replicas
Each replica duplicates the resources and data in an index. This means that adding additional replicas increases the throughput of the index but not its capacity. However, adding replicas does not require downtime.
Throughput in terms of queries per second (QPS) scales linearly with the number of replicas per index.
When to add replicas
There are two primary scenarios where adding replicas is beneficial:
Increase QPS: The primary reason to add replicas is to increase your index’s queries per second (QPS). Each new replica adds another pod for reading from your index and, generally speaking, will increase your QPS by an equal amount as a single pod. For example, if you consistently get 25 QPS for a single pod, each replica will result in 25 more QPS.
If you don’t see an increase in QPS after adding replicas, add multiprocessing to your application to ensure you are running parallel operations. You can use the Pinecone gRPC SDK, or your multiprocessing library of choice.
Provide data redundancy: When you add a replica to your index, the Pinecone controller will choose a zone in the same region that does not currently have a replica, up to a maximum of three zones (your fourth and subsequent replicas will be hosted in zones with existing replicas). If your application requires multizone redundancy, this is our recommended approach to achieve that.
How to add replicas
To add replicas, use the configure_index
endpoint to increase the number of replicas for your index:
Next steps
- See our learning center for more information on vertical scaling.
- Learn more about collections.