Title: feat: Batch DynamoDB online reads across feature views by NopeCharon · Pull Request #7134 · feast-dev/feast · GitHub
Open Graph Title: feat: Batch DynamoDB online reads across feature views by NopeCharon · Pull Request #7134 · feast-dev/feast
X Title: feat: Batch DynamoDB online reads across feature views by NopeCharon · Pull Request #7134 · feast-dev/feast
Description: What this PR does / why we need it: The generic OnlineStore._read_features_per_fv loop reads one feature view after another. For DynamoDB that means a sync get_online_features call spanning N feature views costs at least N sequential BatchGetItem round trips, and the async path sends at least N separate requests. Redis and PostgreSQL already override this seam to batch. This PR does the same for DynamoDB, as discussed in #3259, where per-store overrides were agreed as the approach. DynamoDB keeps each feature view in its own table, and one BatchGetItem request can read from several tables. The override: resolves every view's table name (versioning included) and entity ids up front; packs all of the keys into as few requests as possible, with at most batch_size keys per request across all of its tables. Each table keeps its own ProjectionExpression and ConsistentRead; sends the requests in parallel: a thread pool capped at max_read_workers on the sync path, asyncio.gather on the async path; splits the returned items back apart by table and entity id, and fills the response in grouped_refs order. For example, a request for 10 feature views and 5 entities now needs 1 BatchGetItem call instead of 10. BatchGetItem rejects a request that lists the same key twice for a table. So views that map to the same table, such as one feature view requested under two aliases, are read once, projecting the union of their requested features. Extra features in a row are already ignored when the response is filled. The gating follows the PostgreSQL implementation (#6832): A single-view request always takes the generic path, because there is nothing to combine. Requests larger than the new max_batched_result_rows setting (entity rows × feature views, default 2048) also take the generic path. At that size each view already fills requests of its own, so packing saves at most one partly filled request per view, while holding every view's items at once raises peak memory. Setting max_batched_result_rows: 0 turns batching off. Error and throttling behaviour does not change: any exception from batch_get_item still propagates, and UnprocessedKeys are handled the same way as in the per-view path. The item decoding in _process_batch_get_response moves into a shared _to_read_row helper, so both paths parse items the same way. Docs: the DynamoDB online store reference (new option plus a performance note) and the online server performance tuning guide. Which issue(s) this PR fixes: Refs #3259 Checks I've made sure the tests are passing. My commits are signed off (git commit -s) My PR title follows conventional commits format Testing Strategy Unit tests Integration tests Manual tests Testing is not required for this change New tests are in sdk/python/tests/unit/infra/online_store/test_dynamodb_batched_read.py. They run against moto-backed tables, and each one covers both the sync and the async override: One request serves three views (two of them share an entity id and a feature name, and the third is keyed on a different entity), and the response matches the generic per-view path exactly, including entities that are missing from one view. Keys are packed across tables up to batch_size. Aliases of one view read each key once, with the union projection. Projection is set per table. A single view, max_batched_result_rows: 0, or a request over the limit falls back to one online_read per view. Config default and validation. The existing DynamoDB unit tests still pass. Misc Release note: The DynamoDB online store now packs the reads of every feature view in a request into shared BatchGetItem calls, so requests that span several feature views need fewer round trips. The new max_batched_result_rows option controls this.
Open Graph Description: What this PR does / why we need it: The generic OnlineStore._read_features_per_fv loop reads one feature view after another. For DynamoDB that means a sync get_online_features call spanning N featu...
X Description: What this PR does / why we need it: The generic OnlineStore._read_features_per_fv loop reads one feature view after another. For DynamoDB that means a sync get_online_features call spanning N featu...
Opengraph URL: https://github.com/feast-dev/feast/pull/7134
X: @github
Domain: github.com
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:36e30d3d-7434-b304-5b5a-426804fa9390 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | 8654:3FDE19:31B725:4265D4:6AFE988D |
| html-safe-nonce | b61055728103f52735b9f7dffaa6da41c0ee7625c27573b088685d7d8c2d3ad3 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4NjU0OjNGREUxOTozMUI3MjU6NDI2NUQ0OjZBRkU5ODhEIiwidmlzaXRvcl9pZCI6IjEwMzkzNzMzMzQyODM3MjA4NDUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | bd7305e970bfe644637e7114cefa361ef3eed864aefaf31328e23ff339443f66 |
| hovercard-subject-tag | pull_request:5263804844 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/feast-dev/feast/pull/7134/files |
| twitter:image | https://avatars.githubusercontent.com/u/115794254?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/115794254?s=400&v=4 |
| og:image:alt | What this PR does / why we need it: The generic OnlineStore._read_features_per_fv loop reads one feature view after another. For DynamoDB that means a sync get_online_features call spanning N featu... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | b3c0f155eafc27e60db6e254d1ffff0e072e9ab3b4018a5ee518797c19d89f86 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/feast-dev/feast git https://github.com/feast-dev/feast.git |
| octolytics-dimension-user_id | 57027613 |
| octolytics-dimension-user_login | feast-dev |
| octolytics-dimension-repository_id | 161133770 |
| octolytics-dimension-repository_nwo | feast-dev/feast |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 161133770 |
| octolytics-dimension-repository_network_root_nwo | feast-dev/feast |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 4a10310af51a1bfffbedc4fd81cb582acf0cb0ff |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width