⚡ Bolt: batch save state updates for better performance#783
⚡ Bolt: batch save state updates for better performance#783
Conversation
Adds `save_many` to Database Adapters and uses it to perform a batch `insert or update` of `RunNodeState` instances in `StateManager`, reducing database roundtrips and resolving the N+1 latency issues. Co-authored-by: georgi <19498+georgi@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
💡 What: Implement
save_manymethod in Database Adapters (SQLite,PostgreSQL,Supabase) to handle bulk list of dicts. UpdateDBModelbase class to add asave_manyclass method that exposes this interface to other classes. UpdateStateManagerto useRunNodeState.save_manyover iterating through instances callingstate.save()for each one.🎯 Why:
StateManagerhandles bulk enqueued states from executing workflow nodes but processed them with single row updates. This causes high DB roundtrips and slows down node executions with large DAGs.📊 Impact: Eliminates N+1 writes in
StateManager._process_batch. Significant reduction in DB write time/latency, leading to lower node start/stop latencies.🔬 Measurement: Can be observed with large graphs by tracking the duration of
_process_batch.PR created automatically by Jules for task 12008955676744676120 started by @georgi