Merged
Conversation
init_postgresql()にuse_poolパラメータを追加し、ECSタスクでコネクション プーリングを使用可能にする。Lambda関数はデフォルトのNullPoolを維持し 後方互換性を保つ。 Co-Authored-By: Claude Opus 4.6 <[email protected]>
- モジュールレベルSQSクライアントのシングルトン化で再生成コスト排除 - send_message_batch API(最大10件/コール)によるバッチ送信ヘルパー追加 - Notes処理: 1行ごとのDBクエリ → IN句バッチ取得+差分更新に変更 - notes_missing_language の毎バッチ再enqueue(~2.2M件)を廃止 - _flush_notes_batch ヘルパーでバッチ処理を集約 Co-Authored-By: Claude Opus 4.6 <[email protected]>
- 1行ごとの個別DELETE → IN句によるバッチDELETEに変更 - enqueue_note_status_batch追加でステータス更新SQSもバッチ送信化 - 旧enqueue_note_status_update関数を削除 - ステータス処理フェーズのタイミングログ追加 Co-Authored-By: Claude Opus 4.6 <[email protected]>
- Ratingsバッチサイズを1000→5000に拡大しDB往復回数を1/5に削減 - Backfillのbatch_limitを10000→50000に拡大 - Backfillの個別SQS送信をenqueue_notes_batchに置き換え - 旧enqueue_notes関数を削除 - Ratings/Backfillフェーズのタイミングログ追加 Co-Authored-By: Claude Opus 4.6 <[email protected]>
DELETE→INSERT パターンで発生する dead tuples を排除し、 ステータスが実際に変更されたノートのみ SQS enqueue することで 下流 Lambda の無駄な起動を大幅に削減する。 Co-Authored-By: Claude Opus 4.6 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Extract ECSタスクが 26.7時間(2/19 00:15 → 2/20 02:55 JST)かかっていた処理を、以下の最適化により 2-3時間 に短縮します。
主な変更点
send_message→send_message_batch(最大10件/コール)でAPIコール数を1/10に削減想定効果
変更ファイル
etl/src/birdxplorer_etl/extract_ecs.py— SQSバッチ送信、N+1解消、バッチDELETE、フェーズタイミングログetl/src/birdxplorer_etl/lib/sqlite/init.py—init_postgresql(use_pool)パラメータ追加etl/src/birdxplorer_etl/run_extract.py— ECS用use_pool=True呼び出しTest plan
[PHASE_COMPLETE]タイミングを確認🤖 Generated with Claude Code