Redis online store: HGETALL for wide reads, and an opt-in GIL-free client (valkey-glide) for get_online_features
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 45/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- python, redis
- Ambito
- backend, databases, performance
Direzione di ricerca
Look at the RedisOnlineStore class in feast/infra/online_stores/redis.py, focusing on _read_features_per_fv and the batched get_online_features logic. The change involves switching from HMGET to HGETALL when the number of fields exceeds a threshold (like 50) and filtering the response. For the valkey-glide client, examine how the online store config parses connection_string and client options. Start by running existing tests for the Redis online store to ensure they pass, then add a test for the HGETALL path and the new client option.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Is your feature request related to a problem? Please describe.
The Python get_online_features path against the Redis online store is slow for wide reads, and the cost is on the client, not the server. Our shape is 4 FeatureViews, ~90 fields, 350 to 500 entities per call, served from a FastAPI process that does other work at the same time.
Two separate problems show up:
-
HMGET on listpack-encoded hashes scans once per requested field. Redis and Valkey keep a hash as a listpack up to
hash-max-listpack-entries(default 128 on Redis 7 and Valkey 8). Our hashes have ~120 fields, so every HMGET of ~90 fields does ~90 linear scans. Measured on Valkey 8 withINFO commandstats, same 500 keys:command server time per command server time per 500-entity read HMGET, 94 named fields 25.8 us 12.9 ms HGETALL (123 fields) 5.6 us 2.8 ms HGETALL returns about a third more bytes and is still 4.6x cheaper for the server. This is the optimization #3337 asked for in 2022 (the Java server switches to HGETALL above 50 features); that issue was closed by the stale bot without a change.
-
The Python client work holds the GIL in thousands of short bursts per read. redis-py packs every command, hiredis parses every reply, and each socket receive releases and reacquires the GIL. Then the SDK turns every
ValueProtoblob into a Python object. In a process with other threads running Python, every one of those reacquires waits out the switch interval, so the read time depends on how busy the rest of the process is.Same machine, same data, Feast 0.66 (which already has the single-pipeline read from #6337), 500 entities, ~90 fields across 4 views, p50 of 40 runs:
read path alone while another thread runs pure-Python work get_online_features(redis-py + hiredis)140 ms 946 ms same field plan, one HGETALL per entity through valkey-glide (Rust core), decode in Python 43 ms 160 ms The 6x gap under contention is the part that matters in production. It does not show up in a single-threaded benchmark.
Describe the solution you'd like
Two changes to RedisOnlineStore, independent of each other:
-
In
_read_features_per_fv/ the batchedget_online_features, issue HGETALL instead of HMGET when the number of requested hash fields crosses a threshold (the Java server uses 50), and pick the requested fields out of the reply. Everything else stays the same: same_redis_key, same_mmh3field names, same_ts:<view>presence check. -
An opt-in client for the Redis online store that runs the pipeline off the GIL. valkey-glide (
valkey-glide-syncon PyPI) is an official Valkey client with a Rust core; a non-atomicBatchis one FFI call, so the whole fetch runs with the GIL released and returns once. It speaks RESP to Redis and Valkey and supports TLS and cluster mode. Aconnection_string-compatibleclient: glideoption onRedisOnlineStoreConfigwould keepfeature_store.yamlas the single place the store is configured.
Describe alternatives you've considered
- The Go feature server. It needs the file registry (we use the SQL registry) and a separate Python transformation service for on-demand views, and the Python wheel does not ship the Go library.
get_online_features_async. Same Python parsing on the same GIL; measured within a few percent of the sync path.- Lowering
hash-max-listpack-entrieson the server so hashes become hashtables. That does remove most of the HMGET cost (7.4 ms to 1.1 ms server time in our test) but costs ~40% more memory and is an operator-side change; HGETALL gets most of the same win from the client. - Reading
OnlineResponse.protodirectly instead ofto_dict(). Worth about 20%, but the redis-py fetch is still the part that stalls under contention.
We have both changes running in a fork of the read path and are happy to contribute either as a PR if there is interest in the direction.
Additional context
Related: #3337 (HGETALL request, closed stale), #4711 and #6337 (single pipeline across feature views, merged; the numbers above are with that in place), #3649 (registry from_proto overhead, a separate cost).
- Lingua principale
- Python
- Stelle
- 7.4k
- Fork
- 1.5k
- Merge medio
- 2g 6h
- PR unite (30g)
- 107
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di feast-dev/feast
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
I maintainer di solito rispondono entro 1 giorno
-
BigQuery data quality monitoring fails: PRIMARY KEY placed outside the column list in monitoring table DDLForse già presa @liron-velocity l’ha presa 51 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
get_online_features silently drops a join key value when it shares a name with an OnDemandFeatureView's RequestSource fieldForse già presa @OHMFOHS l’ha presa 99 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
kind/bug priority/p2
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
feast-dev/feast#6778 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di feast-dev/feast
Issue simili
-
Public benchmark import end-to-end test fails when the test stack's worker runs the parity jobApertaaccepted
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
future-agi/future-agi#6392 ·
I maintainer di solito rispondono entro 1 giorno
-
memmapped_arange ignores the start value and drops the last point above the memmap thresholdForse già presa @prathameshfuke l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
StingraySoftware/HENDRICS#213 ·
-
Bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 2 giorni
-
bot-triaged module: decompositions module: edge cases module: int overflow module: primTorch oncall: pt2 triage review
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno