Nicholas Pini
12/11/2025, 2:48 PMMarvin
12/11/2025, 2:48 PMMarvin
12/11/2025, 2:52 PMexport PREFECT_SERVER_SERVICES_EVENT_PERSISTER_FLUSH_INTERVAL=1 # default 5
export PREFECT_SERVER_SERVICES_EVENT_PERSISTER_BATCH_SIZE=10 # default 20
export PREFECT_SERVER_SERVICES_EVENT_PERSISTER_READ_BATCH_SIZE=20 # default 1
export PREFECT_SERVER_SERVICES_EVENT_PERSISTER_QUEUE_MAX_SIZE=100000 # default 50000
- Speed up trigger consumption
export PREFECT_SERVER_SERVICES_TRIGGERS_READ_BATCH_SIZE=20 # default 1
- If using proactive/absence triggers, poll more often
export PREFECT_EVENTS_PROACTIVE_GRANULARITY=1 # default ~5
- Use PostgreSQL instead of SQLite
- SQLite is single-writer and will bottleneck quickly under frequent events. Point Prefect to Postgres for production.
- Keep the DB close and healthy
- Minimize network latency, ensure sufficient connections, and consider lowering event retention if your event tables are huge.
What to check
- Server logs for backlog clues:
- Messages about “Event queue … capacity” or repeated flush retries indicate the persister is backlogged or the DB is slow.
- Your DB backend and size:
- Are you on SQLite? How big is the events table? Any connection pool exhaustion?
- Trigger posture:
- Is your automation reactive (on event) or proactive (absence/polling)?
- Event rate:
- Roughly how many events/second at peak?
Useful docs
- Self-hosted scaling and performance: Self-hosted (Prefect 3)
- Event triggers concept: Event triggers
- Creating deployment triggers: Creating deployment triggers
If you share a bit more about your setup (DB type, approximate event rate, whether your triggers are reactive vs proactive, and any log snippets), I can suggest a concrete config that will bring your latency down from minutes to roughly 1–2s.