A search feature has ten thousand tenants on one vector store near its memory limit: an index per tenant or pooled shards by tenant key, and what happens when one tenant outgrows its pool?
answer
- the long tail of tiny tenants
- fixed overhead per index
- noisy neighbour in a pool
- promotion threshold
- flip one tenant's route
basics
~20 sNeither pure shape usually holds: ten thousand tiny indexes each pay fixed overhead, and pooled shards let one tenant crowd its neighbours. Most teams pool small tenants by tenant key and promote large ones to dedicated shards past a threshold.
solid answer
~50 sAn **index per tenant** gives clean isolation of load, one-step tenant deletion and per-tenant settings, but every index carries fixed overhead (memory, metadata, open files) and many stores cap the index count, so ten thousand mostly tiny tenants waste capacity on structure, not data. **Pooled shards** routed by tenant key amortise that overhead, but a small tenant's query becomes a heavily filtered search over everyone's vectors, one tenant's traffic slows its shard-mates, and deleting a tenant leaves tombstones. When a pooled tenant outgrows its shard, the shard hits its memory limit and every tenant on it suffers. The usual answer is tiered: tiny tenants pooled or searched exhaustively, large tenants promoted to dedicated shards past a size or traffic threshold, by building their new shards from kept vectors, mirroring writes, flipping their route and removing them from the pool. The lead owns the default, the threshold and who pays.
code
yaml · 11 lines# illustrative tenant placement policy (field names invented)
default_placement: pooled
pooled:
route_by: tenant_id
shards: 32
exhaustive_search_below_vectors: 50000
promotion:
when_vectors_exceed: 2000000
or_query_share_exceeds: 0.05
target: dedicated_shards
dedicated_shard_max_vectors: 5000000go deeper
Recall the two shapes: a separate index for each tenant, or shared shards where the tenant ID routes the query.
Explain what each shape costs: fixed per-index overhead and count limits on one side, filtered search, noisy neighbours and tombstones on the other.
Lay out the promotion path for a tenant that outgrows its shard: build, mirror writes, verify, flip the route, remove and compact.
Own the policy: the default shape, the promotion threshold, whether big tenants pay for dedicated capacity, and the move tooling built before it is needed.
## The two pure shapes A multi-tenant search feature stores every tenant's vectors in one vector store and must keep each tenant's queries inside that tenant's data. Placement has two pure shapes: - **Index per tenant.** Each tenant gets its own approximate nearest-neighbour index (or its own collection). A query goes straight to that index. - **Pooled shards with a tenant routing key.** Tenants share a fixed set of shards; the tenant ID decides which shard holds a tenant's vectors, and the query is routed there and restricted to that tenant inside it. Whichever shape is chosen, the check that keeps one tenant from reading another's data is an authorization question, covered with tenant scoping in retrieval. This question is about **capacity and placement**. ## What an index per tenant costs - **Fixed overhead per index.** Every index carries metadata, buffers, file handles and often a preallocated structure. A scenario's 10 MB per index across 10,000 tenants is **100 GB** of overhead before a single vector, on a store already near its memory limit. - **Index-count limits.** Many stores limit how many indexes or collections one cluster holds, or degrade as the count grows. - **Tiny graphs.** A graph index over a few thousand vectors buys little over a plain scan and still costs build time and memory. - **In its favour:** one tenant's load stays in its index, deleting a tenant drops one index and frees its memory at once, and each tenant can have its own settings or even its own encoder. ## What pooled shards cost - **Filtered search for small tenants.** A tenant with 0.1% of a shard's vectors runs a search over a graph built for everyone; most of the walk lands on other tenants' vectors. How stores handle such a selective filter is covered with metadata filtering; the placement answer is to keep small tenants off huge shards or search them exhaustively. - **Noisy neighbours.** A tenant's traffic spike or bulk import slows every tenant on its shard. - **Deletion.** Removing a tenant deletes each of its vectors, leaving tombstones until the shard is compacted. - **Growth.** A tenant that keeps growing fills its shard. ## Let the size distribution decide Tenant sizes are usually a long tail. Suppose, as a scenario, 9,900 tenants hold under 50,000 vectors each and 100 hold millions. For the small ones an **exhaustive scan** is often cheapest: 20,000 vectors at 768 dimensions is 15,360,000 multiply-adds per query, a few milliseconds on one core, exact, and with no graph to build or maintain. For the large ones a dedicated graph index pays off. | Tenant tier | Placement | Search | |---|---|---| | Tiny (under a scenario's 50,000 vectors) | Pooled shards, routed by tenant key | Exhaustive scan of that tenant's vectors | | Medium | Pooled shards sized for a few such tenants | Graph search restricted to the tenant | | Large (past the promotion threshold) | Dedicated shards for that tenant | Graph search, fanned out over its own shards | ## When one tenant outgrows its pool The symptom is a pooled shard at its memory limit, or with latency well above its peers, because one tenant now dominates it. Moving that tenant: 1. **Detect** it from per-tenant vector counts and query share, against a stated promotion threshold. 2. **Build** dedicated shards for that tenant from kept vectors while the pool keeps serving it. 3. **Mirror** that tenant's new writes and deletes to both places during the move. 4. **Verify** counts and sample-query parity between the old and new placement. 5. **Flip** that tenant's route to the new shards in one step. 6. **Remove** its vectors from the pool and schedule compaction there. A promoted tenant larger than one shard is itself split across several, and its queries fan out across those. ## What the lead decides There is no single right answer; the lead sets standing policy: - the **default** shape for a new tenant; - the **promotion threshold** (vectors, query share or contract tier) and who triggers it; - whether large tenants **pay** for dedicated capacity, and how that shows in pricing; - whether some contracts **require** dedicated placement regardless of size; - the **tooling** to move a tenant, built before the first tenant needs it. ```yaml # illustrative tenant placement policy (field names invented) default_placement: pooled pooled: route_by: tenant_id shards: 32 exhaustive_search_below_vectors: 50000 promotion: when_vectors_exceed: 2000000 or_query_share_exceeds: 0.05 target: dedicated_shards dedicated_shard_max_vectors: 5000000 ```
- How do you move a tenant that has outgrown its pool without a gap in its results?Build its dedicated shards from kept vectors while the pool keeps serving it, mirror its new writes and deletes to both placements, verify vector counts and sample-query results match, flip that tenant's route in one step, then delete it from the pool and compact. The tenant is never served from a half-built placement.
- What does deleting a whole tenant cost in each shape?With an index per tenant, dropping the index frees its memory at once. In pooled shards every vector is deleted individually and stays as a tombstone until the shard is compacted, which costs search quality and memory meanwhile, so large offboardings are scheduled with compaction.
- Why can a small tenant's query be slow on a large pooled shard, and what placement fixes it?The shard's graph is built over everyone's vectors, so a search restricted to a tenant holding a tiny fraction wanders through other tenants' nodes; the filter mechanics are a retrieval-filtering topic. Placement fixes it by grouping small tenants on smaller shards or scanning their few vectors exhaustively.
- An index per tenant is always the safest default, whatever the tenant count.
- Pooling tenants on shared shards removes the need for a tenant check at query time.
- A tenant that outgrows its pooled shard can simply be split in place.
- Tenant size distribution does not affect the placement choice.
- Every tenant needs an approximate index, however few vectors it holds.