Skip to content

feat: Add --gc-freeze option to feast serve - #7089

Open
aborgatin wants to merge 1 commit into
feast-dev:masterfrom
aborgatin:feat/serve-gc-freeze
Open

aborgatin wants to merge 1 commit into
feast-dev:masterfrom
aborgatin:feat/serve-gc-freeze

Conversation

@aborgatin

@aborgatin aborgatin commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

What this PR does / why we need it:

Adds an opt-in feast serve --gc-freeze flag, also available as feature_server.gc_freeze in feature_store.yaml.

Full GC collections in a feature server worker walk the registry, feature definitions and protobuf classes that live for the whole process. Each one blocks the event loop for 50–75 ms, and the requests waiting at that moment look like slow online store reads. With the flag, the server runs gc.collect() and gc.freeze() in the gunicorn master after the app is built and before the workers fork. Workers inherit the frozen state, including the ones restarted by --max-requests. On Windows, where the server runs on uvicorn without gunicorn, it freezes after get_app. Off by default, so nothing changes for current users.

Also adds a short "Garbage collection pauses" section to the performance tuning guide and the flag to the Python feature server reference.

Which issue(s) this PR fixes:

Fixes #7088

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

Unit tests check the call order (collect, freeze, then the gunicorn run) for the flag and the config, and that nothing is frozen by default.

Manual test: one worker, 15 req/s for 10 min. Requests over 50 ms went from 16 of 8,991 to 0 of 8,933, p99.9 from 61 to 29 ms. Also tested on a Kubernetes deployment with 0.65.0 and --max-requests, with the same result. Details in #7088.

Full garbage collections walk the registry, feature definitions and
protobuf classes that the feature server keeps for its whole life. In a
worker this blocks the event loop for tens of milliseconds and shows up
as slow online store reads. The new option runs gc.collect() and
gc.freeze() after the app is built and before gunicorn forks the
workers. Off by default; also available as feature_server.gc_freeze.

Signed-off-by: Alexander Borgatin <[email protected]>
@aborgatin
aborgatin requested a review from a team as a code owner October 29, 2026 09:47
@codecov-commenter

codecov-commenter commented Oct 29, 2026 •

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 86.66667% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 51.01%. Comparing base (1e5e90c) to head (8ce78b0).

Files with missing lines Patch % Lines
sdk/python/feast/feature_server.py 83.33% 2 Missing ⚠️
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #7089      +/-   ##
==========================================
+ Coverage   50.97%   51.01%   +0.03%     
==========================================
  Files         455      455              
  Lines       56994    57008      +14     
  Branches     8321     8323       +2     
==========================================
+ Hits        29055    29082      +27     
+ Misses      25954    25939      -15     
- Partials     1985     1987       +2     
Flag Coverage Δ
go-feature-server 30.58% <ø> (+0.20%) ⬆️
python-unit 52.47% <86.66%> (+0.02%) ⬆️
Files with missing lines Coverage Δ
sdk/python/feast/cli/serve.py 69.38% <100.00%> (+0.31%) ⬆️
sdk/python/feast/feature_store.py 46.88% <ø> (ø)
.../python/feast/infra/feature_servers/base_config.py 100.00% <100.00%> (ø)
sdk/python/feast/feature_server.py 65.63% <83.33%> (+1.19%) ⬆️

... and 1 file with indirect coverage changes


Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1e5e90c...8ce78b0. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature server: long GC pauses cause latency spikes on online reads

2 participants