Files
seaweedfs/seaweed-vector
Chris LuandClaude Opus 5.5 13334a59b9 vector: reuse the Lance session, version leases and opened tables across reads (#12573)
* vector: share one Lance session across reads

Each request opened its table in a session of its own, so every query
loaded and decoded the index again. Get, list and query now open in one
session the server keeps, sized by -index-cache-mb and
-metadata-cache-mb; writes keep a session of their own.

Lance keys some of its cached entries, such as a version's index list,
by location and version alone, and an index dropped and created again at
its location numbers its versions from 1 again: a shared session answered
a query on the new table with the old table's index. CreateIndex now
marks each table with an id in its schema metadata, and the session
starts over when a location turns up holding another table.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011UpvafvK8JpagF94MHWqwK

* vector: share a version lease among the reads of that version

Every get, list and query tagged the version it read and deleted the tag
afterwards: two filer writes and a manifest read per request. Reads of
one version now share one tag, which goes 10 s after the last read took
it; a tag is reused for at most 5 minutes, so a busy version never
reaches the reapers' TTLs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011UpvafvK8JpagF94MHWqwK

* vector: keep opened tables for the next read

A read built the table's store and read its latest manifest each time.
Reads now keep the opened table by location and encryption, up to 1024,
and move it to the latest version, which lists the versions and takes
the manifest from the session. A handle opened in an earlier session is
not reused.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011UpvafvK8JpagF94MHWqwK

* vector: key shared leases by manifest, and take one per version at once

A table dropped and created again within the linger reused, for a
version number the old table had, a lease whose tag the drop had
deleted. Leases are now keyed by the manifest's ETag as well. Reads that
arrive before a version has a lease wait for the first to take it,
rather than each writing a tag.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011UpvafvK8JpagF94MHWqwK

* vector: drop kept tables when the shared session starts over

A kept table holds the session it was opened in, so a replaced session
and its caches lived on in the handles of other tables until they were
evicted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011UpvafvK8JpagF94MHWqwK

* vector: prune shared lease slots only when they double

Every lease lookup scanned all slots under the map's lock, a cost that
grew with the versions read in the last linger.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011UpvafvK8JpagF94MHWqwK

* vector: shrink the lease slot map after a prune

After a burst the map kept its peak allocation, which every later prune
scanned.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011UpvafvK8JpagF94MHWqwK

* vector: keep a lease slot a read has taken through a prune

A read that took a slot and had not yet locked it could see the slot
pruned, and then pin through it while the next read pinned through a
new slot, writing a second tag.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011UpvafvK8JpagF94MHWqwK

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 16:26:50 -08:00
..

SeaweedFS vector engine

weed-vector serves the S3 Vectors data plane through the S3 gateway. Indexes use Lance tables on the cluster's filers and volume servers. Go and Rust volume servers use the same engine and API.

With a local weed mini cluster running:

weed-vector --masters=localhost:9333 --metrics-port=9329

Point an AWS S3 Vectors client at the S3 endpoint, normally http://localhost:8333. The engine registers with the masters automatically. --listen defaults to 127.0.0.1:8090; use an address reachable from the gateway when running on another host or in a container.

Setting Default Purpose
--masters Required Comma-separated master addresses
--listen 127.0.0.1:8090 gRPC listener and registered address
--filer-group Empty Filer group used for table storage
--read-cache-mb 512 Immutable data/index read cache; zero disables it
--nprobes Automatic ANN partitions searched per query
--metrics-port 0 HTTP metrics and health listener; zero disables it
--metrics-ip 127.0.0.1 HTTP listener address
--security-toml Discovered Cluster certificates, signing keys and encryption keys

The HTTP listener provides /health, /ready, and /metrics. Readiness requires an active registration with the master. The gRPC listener also implements the standard health service for vector_pb.VectorService and the whole server. These health statuses follow master registration.

Metrics use the SeaweedFS_vector_ prefix:

  • connected: active master registration.
  • request_total{type,code}, request_seconds{type}, and in_flight_requests{type}: engine requests and their gRPC outcomes.
  • query_results_total: vectors returned by queries.
  • cache_requests_total{result}, cache_bytes, and cache_entries: immutable read cache activity and occupancy.
  • storage_read_bytes_total and storage_read_seconds: storage fetches for cacheable immutable reads.

The S3 gateway separately publishes SeaweedFS_s3_ request metrics with type="s3vectors.<Operation>". Scrape both processes to distinguish gateway latency from engine work. Metrics and HTTP probes are unauthenticated; bind them to an internal address or restrict their network access.

For mutual TLS, configure [grpc.vector] for the engine's server certificate, [grpc.client] for its master/filer connections, and the cluster CA. HTTPS volume reads also use [https.client]. The engine follows the same signing and encryption configuration as the other cluster clients.

Run the Lance maintenance worker against the same masters and Lance namespace to build and update ANN indexes. Queries can scan data that has not been indexed yet. See the maintenance worker documentation and Helm chart for deployment settings.

The integration suite at test/s3vectors runs the same API and observability checks against both Go and Rust volume servers, including mutual TLS, signed volume reads, and encrypted volume data.