Vertical vs. horizontal scaling
Vertical scaling increases the size of your existing pods, while horizontal scaling adds pods or replicas. Adding replicas also improves resilience and is an important part of a highly available (HA) setup. The following sections explain both approaches so you can choose the right strategy for your index.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 isx1. 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 doesn’t result in downtime. Reads and writes continue uninterrupted during the scaling process, which completes in about 10 minutes. You can’t reduce the pod size of your indexes.
The number of base pods you specify when you initially create the index is static and can’t 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 can’t be changed with vertical scaling. If you want to change your pod type while scaling, then horizontal scaling is the better option.
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.- Console
- API
- Open the Pinecone console.
- Select the project containing the index you want to configure.
- Go to Database > Indexes.
- Select the index.
- Click ellipsis (…) menu > Configure.
- In the dropdown, choose the pod size to use.
- Click Confirm.
The size change can take up to 15 minutes to complete.
Decrease pod size
After creating an index, you can’t vertically downscale the index/pod size. Instead, you must create a collection and then create a new index from your collection and specify your desired pod size.Check the status of a pod size change
To check the status of a pod size change, use the Describe an index endpoint. Thestatus 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 the Get index stats operation 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 isn’t 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.
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 doesn’t require downtime. Throughput in terms of queries per second (QPS) scales linearly with the number of replicas per index.When to add replicas
Add replicas for two reasons:- Data redundancy and availability: When you add a replica to your index, the Pinecone controller chooses a zone in the same region that doesn’t currently have a replica, up to a maximum of three zones. Your fourth and subsequent replicas are hosted in zones that already have a replica. If your application requires multizone redundancy, we recommend this approach.
- Increased QPS: Each new replica adds another pod for reading from your index and generally increases QPS by the same amount as a single pod. For example, if you consistently get 25 QPS for a single pod, each replica adds 25 more QPS.
How to add replicas
To add replicas, use theconfigure_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.