perf: Optimize protobuf parsing in Redis online store#6023
Open
abhijeet-dhumal wants to merge 2 commits intofeast-dev:masterfrom
Open
perf: Optimize protobuf parsing in Redis online store#6023abhijeet-dhumal wants to merge 2 commits intofeast-dev:masterfrom
abhijeet-dhumal wants to merge 2 commits intofeast-dev:masterfrom
Conversation
Signed-off-by: abhijeet-dhumal <abhijeetdhumal652@gmail.com>
0f5fc75 to
b6d8f45
Compare
Signed-off-by: abhijeet-dhumal <abhijeetdhumal652@gmail.com>
ntkathole
reviewed
Feb 25, 2026
| if ts_val: | ||
| res_ts.ParseFromString(bytes(ts_val)) | ||
| res_ts.ParseFromString( | ||
| ts_val if isinstance(ts_val, bytes) else bytes(ts_val) |
Member
There was a problem hiding this comment.
so 2-5ms per request savings from avoiding bytes() on already bytes value ?
ntkathole
reviewed
Feb 25, 2026
| if val_bin: | ||
| val.ParseFromString(bytes(val_bin)) | ||
| val.ParseFromString( | ||
| val_bin if isinstance(val_bin, bytes) else bytes(val_bin) |
Member
There was a problem hiding this comment.
isinstance seems unnecessary, Redis always returns bytes and also ParseFromString already accepts bytes natively, so no conversion needed. It can be simply:
val.ParseFromString(val_bin)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Optimize protobuf deserialization in the Redis online store to reduce latency in the feature retrieval hot path.
Changes
bytes()conversion when data is already bytes type (Redis returns bytes)_convert_redis_values_to_protobufExpected Behavior
Protobuf deserialization should skip unnecessary type conversions when data is already in the correct format.
Current Behavior
The code unconditionally calls
bytes()on every value, even when the data is already bytes. For 50 entities × 200 features = 10,000 unnecessary conversion checks per request.Performance Impact
ParseFromStringcumulative timeSteps to Reproduce
get_online_featuresfor 50 entitiesParseFromStringoverheadSpecifications
sdk/python/feast/infra/online_stores/redis.pyRelated