Repository navigation
Description
Is your feature request related to a problem? Please describe.
The Go feature server has no Bigtable online store. NewOnlineStore accepts sqlite, redis, dynamodb and
postgres, and docs/reference/online-stores/bigtable.md lists "readable by Go: no". Teams that run Bigtable as
their online store have to serve through the Python feature server, even when they would otherwise deploy
the Go server.
Two things in the current Go code shape what a Bigtable store needs:
- Python names Bigtable tables by entity set. The table is
<project>.<sorted entity names joined by "-">
(_get_table_nameinbigtable.py).OnlineStore.OnlineReadreceives feature view names and entity keys,
and the keys carry join keys, not entity names. The two often differ (entitydriver, join keydriver_id),
so a Go store can't derive the table name from whatOnlineReadgives it today. - The serving layer reads join-key groups one after another.
GetOnlineFeaturesloops over
groupedRefsand calls the store once per join-key group. A group can span more than one Bigtable table,
and the groups are read in turn, so whatever parallelism a request gets has to come from inside the
store's read for each group.
Describe the solution you'd like
A read-only Go Bigtable store that serves exactly what Python's feast materialize already writes, with no
data migration and one feature_store.yaml for both servers:
-
Same layout as the Python store. Table name as above, including the md5 shortening rules and
__dummy
for entityless views. Row keyhex(murmur3_x64_128(serialize_entity_key(key, v3))) + "#" + feature_view.
Column familyfeatures, one qualifier per feature holding a serializedfeast.types.Value, and an
event_tsqualifier holding an ISO 8601 timestamp. Reads take only the newest cell version, which is the
value Python returns. Parity fixtures generated from the in-tree Python store pin all of this. -
Same config section. The Go store reads
type: bigtable,project_id,instanceandapp_profile.
A few read settings only Go uses (keys_per_request,max_concurrent_chunks,read_timeout_ms,
max_inflight_reads,max_inflight_wait_ms,adaptive_chunking,disable_metrics) are added to
BigtableOnlineStoreConfigas optional fields, becauseFeastConfigBaseModelsetsextra="forbid"and
Python would otherwise reject the shared file. All default toNone, so existing files behave as before. -
Fan-out inside the store. Row keys are split into small
ReadRowsrequests (5 keys by default) sent in
parallel, up to a per-read limit. An optional server-wide cap rejects a read withRESOURCE_EXHAUSTEDwhen
the slots it needs are not free withinmax_inflight_wait_ms(default 0, so it rejects at once rather
than queueing). A per-read timeout bounds the whole read. -
An optional interface for entity names, so
OnlineStoreitself doesn't change:// EntityAwareOnlineStore is implemented by stores that need each feature view's // entity names to locate data, such as Bigtable, which names tables by entity set. type EntityAwareOnlineStore interface { OnlineReadWithEntities(ctx context.Context, entityKeys []*types.EntityKey, featureViewNames []string, featureNames []string, entityNamesByView map[string][]string) ([][]FeatureData, error) }
readFromOnlineStorechecks for it and passes entity names from the request's own copy of its feature
views, the same copy the entity keys were built from. Every other store keeps callingOnlineReadas today.
Scope limits, stated up front: reads only (Python stays the writer), join keys of type STRING, BYTES, INT32 or
INT64 (the same as the other Go stores), and entity_key_serialization_version: 3.
Since this adds a new store and an optional serving interface, please say if you'd like it to go through
the RFC process first. Two points I'd like maintainer input on in any case:
- Interface. Is the optional
EntityAwareOnlineStoreacceptable, or would you rather widenOnlineRead
for every store? - Metrics. Nothing in the Go server measures online store reads today. The implementation adds three
Prometheus series with afeast_bigtable_prefix (read duration by status, chunks sent and rows found by
table). Are per-store series fine, or would you prefer a shared naming scheme, or no metrics in the first
PR?
Describe alternatives you've considered
- Add entity names to
OnlineReadfor every store. Simpler to read, but it touches the four existing Go
stores and their tests for a parameter only one store uses. The optional interface keeps the change to one
call site. - Have the store look up entity names in the registry itself. The registry cache can refresh mid-request,
so the store could see a different schema from the one the keys were built with, and it would have to
repeat the stream-view-over-batch-view precedence thatlistAllViewsalready applies.
Additional context
I have an implementation with unit tests against bttest (no emulator needed) and Python-generated parity
fixtures, and it has been checked value-for-value against the Python server on a real Bigtable instance. I'll
open the PR against this issue.
Related: #2326 (the Python Bigtable online store) and #3259 (reading several feature views in one call; this
store already reads every requested view of a table in the same requests). Reading join-key groups
concurrently in GetOnlineFeatures would help multi-entity requests on every store; it's out of scope here.
Activity