Skip to content

Account for the striped locks in index_gt::memory_usage - #16

Merged
thevar1able merged 1 commit into
ClickHouse/v2.26.6from
fix-striped-locks-memory-usage
Oct 31, 2026
Merged

thevar1able merged 1 commit into
ClickHouse/v2.26.6from
fix-striped-locks-memory-usage

Conversation

@thevar1able

Copy link
Copy Markdown
Member

striped_locks_gt (new in v2.26) replaced the per-node lock bitset and allocates ceil2(max(4 * threads * connectivity_max, 256)) * 128 bytes, but index_gt::memory_usage does not include it. With 128 threads and ClickHouse's default connectivity of 32, that is 4 MiB per index. ClickHouse uses memory_usage as the weight of entries in the vector similarity index cache, so the cache could exceed its limit.

This adds striped_locks_gt::memory_usage and includes it in index_gt::memory_usage. Checked with a probe: after try_reserve(index_limits_t(16, 128)) with connectivity 16, memory_usage reports 2,121,984 bytes instead of 24,704.

Related: ClickHouse/ClickHouse#128293

🤖 Generated with Claude Code

`striped_locks_gt` replaced the per-node lock bitset and allocates
`ceil2(max(4 * threads * connectivity_max, 256)) * 128` bytes, which
`memory_usage` did not include. With 128 threads and the default
connectivity of ClickHouse (32), that is 4 MiB per index, and ClickHouse
uses `memory_usage` as the weight in its vector similarity index cache.

Related: ClickHouse/ClickHouse#128293

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@thevar1able
thevar1able merged commit 78b5cbf into ClickHouse/v2.26.6 Oct 31, 2026
thevar1able added a commit to ClickHouse/ClickHouse that referenced this pull request Oct 31, 2026
`striped_locks_gt`, new in `usearch` v2.26, was not included in
`index_gt::memory_usage`, which the vector similarity index cache uses as the
entry weight: about 4 MiB per index on a 64-core server.

ClickHouse/usearch#16

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant