Skip to main content

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:
An index of dense vectors contains records with one dense vector each.
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.
Calculate size (assuming no sparse vectors)
Where:
  • ID size and Metadata size are measured in bytes, averaged across all records.
  • Each Dense vector dimension uses 4 bytes.
Example calculationsThese examples assume 8-byte IDs:
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:
To maintain optimal performance, provision additional shards to keep your index at 70-80% capacity. For example, a 500 GB index should have three shards (750 GB capacity = 67% full), not two shards (500 GB capacity = 100% full).

Example shard calculations

Other considerations

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:
For example, if one replica handles 50 QPS at your target latency and you need 150 QPS, you need three replicas. For how throughput scales with replicas and how to size for high availability, see Replicas.

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.
If you don’t restore your test index from a backup, you can upsert or import your data.
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.
Don’t migrate your production index yet. At this point, you’re just testing your workload.
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:Continue iterating until you meet your requirements with room for growth.