PrefectHQ
prefect
BlogDocsChangelog

Add memory safeguards to event persister service

#19651Merged
Comparing
event-persister-memory-mitigations
(
3eddb09
) with
main
(
d57bddf
)
CodSpeed Performance Gauge
0%
Untouched
2
Ignored
6

Benchmarks

Passed

bench_import_prefect_flow
benches/bench_import.py
CodSpeed Performance Gauge
0%
1.4 s1.4 s
bench_task_decorator
benches/bench_tasks.py
CodSpeed Performance Gauge
0%
462.9 µs464.6 µs

Ignored

bench_flow_call[options0]
benches/bench_flows.py
Ignored
CodSpeed Performance Gauge
-6%
159.3 ms168.9 ms
bench_flow_call[options1]
benches/bench_flows.py
Ignored
CodSpeed Performance Gauge
0%
107.7 ms107.4 ms
bench_flow_decorator
benches/bench_flows.py
Ignored
CodSpeed Performance Gauge
+4%
5.6 ms5.4 ms
bench_import_prefect
benches/bench_import.py
Ignored
CodSpeed Performance Gauge
0%
1.1 s1.1 s
bench_task_call
benches/bench_tasks.py
Ignored
CodSpeed Performance Gauge
-7%
31 ms33.2 ms
bench_task_submit
benches/bench_tasks.py
Ignored
CodSpeed Performance Gauge
+16%
9 ms7.8 ms

Commits

Click on a commit to change the comparison range
Base
main
d57bddf
-0.14%
Add memory safeguards to event persister service This PR adds safeguards to prevent unbounded memory growth in the event persister under failure conditions: - Add bounded queue (default 50,000 max) with backpressure - new events are dropped with a warning when queue is full - Add retry limit (default 5) - events are dropped after consecutive flush failures instead of infinite retry - Add flush lock to prevent concurrent flushes from message handler and periodic flush task - Add queue capacity monitoring - logs warning at 80% capacity New settings: - `PREFECT_SERVER_SERVICES_EVENT_PERSISTER_QUEUE_MAX_SIZE` - `PREFECT_SERVER_SERVICES_EVENT_PERSISTER_MAX_FLUSH_RETRIES` 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
99ca1cd
17 hours ago
by desertaxle
+0.09%
Add new event persister settings to SUPPORTED_SETTINGS 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
2fe768d
17 hours ago
by desertaxle
-0.24%
Remove validation_alias from new settings and add AGENTS.md - Remove unnecessary validation_alias from queue_max_size and max_flush_retries (only needed for backward compatibility) - Add src/prefect/settings/AGENTS.md documenting settings patterns - Use settings object instead of legacy PREFECT_* constants in trim() - Use logger format string instead of f-string 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
3eddb09
16 hours ago
by desertaxle
© 2025 CodSpeed Technology
Home Terms Privacy Docs