Skip to content

Go feature server: support the Bigtable online store #7192

Open

Description

@timsmallwood

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:

  1. Python names Bigtable tables by entity set. The table is <project>.<sorted entity names joined by "-">
    (_get_table_name in bigtable.py). OnlineStore.OnlineRead receives feature view names and entity keys,
    and the keys carry join keys, not entity names. The two often differ (entity driver, join key driver_id),
    so a Go store can't derive the table name from what OnlineRead gives it today.
  2. The serving layer reads join-key groups one after another. GetOnlineFeatures loops over
    groupedRefs and 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 key hex(murmur3_x64_128(serialize_entity_key(key, v3))) + "#" + feature_view.
    Column family features, one qualifier per feature holding a serialized feast.types.Value, and an
    event_ts qualifier 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, instance and app_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
    BigtableOnlineStoreConfig as optional fields, because FeastConfigBaseModel sets extra="forbid" and
    Python would otherwise reject the shared file. All default to None, so existing files behave as before.

  • Fan-out inside the store. Row keys are split into small ReadRows requests (5 keys by default) sent in
    parallel, up to a per-read limit. An optional server-wide cap rejects a read with RESOURCE_EXHAUSTED when
    the slots it needs are not free within max_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 OnlineStore itself 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)
    }

    readFromOnlineStore checks 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 calling OnlineRead as 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:

  1. Interface. Is the optional EntityAwareOnlineStore acceptable, or would you rather widen OnlineRead
    for every store?
  2. Metrics. Nothing in the Go server measures online store reads today. The implementation adds three
    Prometheus series with a feast_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 OnlineRead for 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 that listAllViews already 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions