BufferedSessionService can't batch writes: DatabaseSessionService has no append_events
メンテナーはふだん 3 日以内に返信
評価
この issue はまだ評価されていません。
説明
Is your feature request related to a problem?
BufferedSessionService (e1deb17f5, f4fab7885) sends a session's queued events in one append_events call when the wrapped store overrides that method. No built-in store does: DatabaseSessionService, SqliteSessionService and InMemorySessionService all keep the base method. So with every store ADK ships, max_write_delay and max_batch_events have no effect, and every event still costs its own transaction. The buffer guide says so too: "ADK's built-in session services keep it, so for them each event is sent in its own append_event call."
On a SQLite file through DatabaseSessionService (Windows, Python 3.11), each append_event takes about 140 ms. Flushing 20 buffered events takes about 2.6 s.
Describe the solution you'd like
DatabaseSessionService.append_events that stores the batch in one transaction: one stale-session check, the state deltas merged in order, one row per event, and one commit. That follows the contract in the base docstring (all or none, in order, same effect as one append_event per event). append_event can become a one-event call to it, so there is one write path.
PR with the implementation and tests: #8257. Timings on that setup:
| main | with append_events |
|
|---|---|---|
10 events, append_event each vs one append_events |
1400 ms | 119 ms |
| 50 events, same | 8211 ms | 152 ms |
BufferedSessionService over it, flush 20 events |
2608 ms | 125 ms |
Stored events, session state and last_update_time are identical either way.
Describe alternatives you've considered
Keeping one transaction per event and relying on max_write_delay alone, which can't help without an append_events override.
Additional context
SqliteSessionService could get the same override in a follow-up.
- 主要言語
- Python
- スター
- 22.3k
- フォーク
- 4.4k
- 平均マージ
- 1日 2時間
- マージ済み PR(30日)
- 6
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
google/adk-python のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
google/adk-python#8360 ·
メンテナーはふだん 3 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
google/adk-python#8359 ·
メンテナーはふだん 3 日以内に返信
-
Can pin to litellm version be changed?対応中かも @llalitkumarrr が 10 日前に担当しました。 オープンmodels
難易度 1/5 1時間未満 初心者へのやさしさ 65/100
google/adk-python#8129 · コメント 2 件 · 担当者 1 名 ·
メンテナーはふだん 3 日以内に返信
-
OpenAPI tools ignore operation- and path-level server overrides対応中かも @sanketpatil06 が 14 日前に担当しました。 オープンtools
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
google/adk-python#8064 · コメント 4 件 · 担当者 1 名 ·
メンテナーはふだん 3 日以内に返信
-
Two docstrings in openapi_tool document parameters the signatures do not accept対応中かも @surajksharma07 が 17 日前に担当しました。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
google/adk-python#8024 · コメント 1 件 · 担当者 1 名 ·
メンテナーはふだん 3 日以内に返信
google/adk-python の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
vllm-project/vllm#70030 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
TigreGotico/tugaphone#408 ·
メンテナーはふだん 1 日以内に返信
-
needs-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
gke-labs/kube-agents#7308 ·
メンテナーはふだん 1 日以内に返信
-
t: bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 3 日以内に返信
-
chore
難易度 1/5 1〜3時間 初心者へのやさしさ 88/100
lugassawan/swe-workbench#841 ·