Title: [perf] Replace MessageToDict with optimized custom dict builder - 4x faster JSON serialization · Issue #6013 · feast-dev/feast · GitHub
Open Graph Title: [perf] Replace MessageToDict with optimized custom dict builder - 4x faster JSON serialization · Issue #6013 · feast-dev/feast
X Title: [perf] Replace MessageToDict with optimized custom dict builder - 4x faster JSON serialization · Issue #6013 · feast-dev/feast
Description: Current Behavior The feature server's /get-online-features endpoint uses google.protobuf.json_format.MessageToDict to convert protobuf responses to JSON. MessageToDict is a generic converter designed for any protobuf type, but for the kn...
Open Graph Description: Current Behavior The feature server's /get-online-features endpoint uses google.protobuf.json_format.MessageToDict to convert protobuf responses to JSON. MessageToDict is a generic converter design...
X Description: Current Behavior The feature server's /get-online-features endpoint uses google.protobuf.json_format.MessageToDict to convert protobuf responses to JSON. MessageToDict is a generic converter de...
Opengraph URL: https://github.com/feast-dev/feast/issues/6013
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[perf] Replace MessageToDict with optimized custom dict builder - 4x faster JSON serialization","articleBody":"## Current Behavior\nThe feature server's /get-online-features endpoint uses google.protobuf.json_format.MessageToDict to convert protobuf responses to JSON. MessageToDict is a generic converter designed for any protobuf type, but for the known GetOnlineFeaturesResponse structure, a type-specific converter is 4x faster.\n\n## Steps to reproduce\n\n- Deploy Feast feature server to Kubernetes\n- Call /get-online-features with 100 entities and 50 features\n- Profile the endpoint and isolate MessageToDict time\n- Observe ~12ms spent in MessageToDict (98% of serialization time)\n- Compare with proto binary serialization which takes only 0.1ms\n- Implement custom dict builder and observe 2.9ms (4x improvement)\n\n### Specifications\n\n- Feast version: 0.60.0\n- Python version: 3.11\n- Tested on: OpenShift/Kubernetes with Redis, PostgreSQL, DynamoDB\n\n### Benchmark Results\nTested with 100 entities, 50 features in-cluster:\n```\nCurrent (MessageToDict + orjson): 12.0ms\n- MessageToDict only: 11.8ms (98% of time!)\n- orjson (dict→JSON): 0.2ms\n\nCustom dict builder + orjson: 2.9ms\n- Custom builder: 2.7ms\n- orjson (dict→JSON): 0.2ms\n\nProto binary (for comparison): 0.1ms\n```\n\n#### Why MessageToDict is Slow\n- Reflection-based field discovery for ANY protobuf message\n- Dynamic type checking for each field\n- Generic handling of all value types (oneofs, repeated, maps)\n- CamelCase/snake_case conversion logic\n- For GetOnlineFeaturesResponse, we know the exact schema, so all this reflection is unnecessary.\n\n\n## Possible Solution\nAdd sdk/python/feast/feature_server_utils.py with a custom dict builder\n\nMetric | Before | After | Improvement\n-- | -- | -- | --\nSerialization (100 entities) | 12.0ms | 2.9ms | 4.1x faster\nSerialization (500 entities) | ~55ms | ~13ms | 4.2x faster\n","author":{"url":"https://github.com/abhijeet-dhumal","@type":"Person","name":"abhijeet-dhumal"},"datePublished":"2026-02-24T05:57:18.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/6013/feast/issues/6013"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:a6e9dc09-31f9-4af4-a8d1-807937b2e61a |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A4CE:3EE845:1EE1393:2A53B28:6A4EBFE8 |
| html-safe-nonce | e6cbc15db695da6d1877cc2f9658c3d99adc9868bad34691cadf0b55e6eec479 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNENFOjNFRTg0NToxRUUxMzkzOjJBNTNCMjg6NkE0RUJGRTgiLCJ2aXNpdG9yX2lkIjoiNzYyMDU2NTc0OTI5NjE4NTMyMCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 194675d76adf5bd2902775143e01085cc23ef36ca618eaaa7128e2fffa067d17 |
| hovercard-subject-tag | issue:3981697824 |
| github-keyboard-shortcuts | repository,issues,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/_view_fragments/issues/show/feast-dev/feast/6013/issue_layout |
| twitter:image | https://opengraph.githubassets.com/9b4716c4d2575d077d5d6560544b5d1c14213409326b07479a07294013dc9e52/feast-dev/feast/issues/6013 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/9b4716c4d2575d077d5d6560544b5d1c14213409326b07479a07294013dc9e52/feast-dev/feast/issues/6013 |
| og:image:alt | Current Behavior The feature server's /get-online-features endpoint uses google.protobuf.json_format.MessageToDict to convert protobuf responses to JSON. MessageToDict is a generic converter design... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | abhijeet-dhumal |
| hostname | github.com |
| expected-hostname | github.com |
| None | 41b6ab3ba6d20a71766ac245b5a4a94c6fc672a9cd4da7d44c1b33ab8bf6a21c |
| turbo-cache-control | no-preview |
| 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 |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | e6a744804e8e70f97b4d5a18a94dcc63db22f97a |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width