Calculate the size of your index
To determine how many shards your index requires, calculate your index size and then apply the number of shards formula.Index size
A record can include a dense vector, a sparse vector, or both. Use the formula that matches your data to calculate total size:- Index of dense vectors
- Index of sparse vectors
- Index with both dense and sparse vectors
An index of dense vectors contains records with one dense vector each.Calculate size (assuming no sparse vectors)Where:
Records can also contain sparse vectors (when the index metric is set to
dotproduct), which can be useful for hybrid search. To learn how to calculate size in that case, see Index with both dense and sparse vectors.ID sizeandMetadata sizeare measured in bytes, averaged across all records.- Each
Dense vector dimensionuses 4 bytes.
Example: 500,000 records × (8-byte ID + (768 dense vector dimensions × 4 bytes) + 500 bytes of metadata) = 1.79 GB
Number of shards
To calculate the number of shards your index requires, divide the size of your index by 250 GB and round up:Example shard calculations
Other considerations
- Every index must have at least one shard. However, you can pause an index by reducing its replicas to 0.
- After you’ve created your index, monitor its fullness.
Add shards when index fullness reaches 70-80%, especially if you expect continued growth. Adding shards reduces storage fullness (index data is spread across shards, so each stores less) and memory fullness (with less data per shard, there’s less to cache in memory), helping you avoid write failures.
Number of replicas
To calculate the number of replicas your index requires, first test your workload to find the QPS a single replica can handle at your target latency. Then, use this formula, and round up:Test your workload
To choose between on-demand and dedicated read nodes, or to optimize your dedicated read nodes configuration, test with your actual workload. Performance varies based on factors such as the size of your index, vector dimensionality, metadata characteristics, and query patterns.1
Calculate the size of your index
Determine how many shards your index requires. See Calculate the size of your index.
2
Create and populate a test index
Populate a dedicated read nodes index with data representative of your workload.
3
Migrate your test index to dedicated read nodes (if necessary)
If your test index is on-demand, migrate it with a single
b1 replica to start.4
Run a load test
Send realistic query patterns against your test index, gradually increasing QPS. For example, start at 10 QPS for about 30 minutes, then step up in 10-QPS increments while monitoring latency. Note the QPS where latency crosses your target threshold.
5
Calculate replicas
From the QPS a single replica sustained, determine how many replicas you need for your target throughput.
6
Adjust and re-test
If you haven’t hit your performance and cost goals, change the configuration and test again:
- Add or remove shards for storage capacity
- Add or remove replicas for throughput
- Change node types for different performance characteristics