issue100: uWSGI 並列度・タイムアウトと PostgreSQL チューニングを環境変数で調整可能にする#102
Open
tichi73 wants to merge 2 commits into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
高負荷時の Web ワーカ枯渇を緩和するため、標準シングル構成における uWSGI 並列度・タイムアウト、PostgreSQL の主要チューニング、nginx→uWSGI タイムアウトを環境変数で調整可能にする変更です(未指定時は従来挙動を維持する想定)。
Changes:
- uWSGI の並列度/タイムアウト系パラメータを
ke2/services/kompira.ymlで環境変数化 - nginx の uwsgi read/send timeout を
ke2/services/nginx.yml+configs/nginx.confで環境変数化 - PostgreSQL の主要チューニング値を
ke2/services/postgres.ymlで環境変数化し、README/ChangeLog に追記
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| ke2/single/basic/README.md | 追加された調整用環境変数と注意点・例を追記 |
| ke2/services/postgres.yml | PostgreSQL チューニング項目を環境変数化し、起動コマンドへ反映 |
| ke2/services/nginx.yml | nginx テンプレート置換用に uwsgi timeout の既定値付き env を追加 |
| ke2/services/kompira.yml | uWSGI 並列度/タイムアウト系 env を多段フォールバックで追加 |
| configs/nginx.conf | uwsgi timeout を envsubst 変数参照に変更 |
| ChangeLog | #100 の変更点を追記 |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
tichi73
added a commit
that referenced
this pull request
Jul 2, 2026
PR #102 の Copilot 再レビュー指摘への対応。 - nginx.conf のコメントのファイルパスに ke2/ prefix を補い実パスに合わせた - README の UWSGI_THREADS 説明で .wait/.recv をインラインコード表記にし可読性を改善 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
tichi73
added a commit
that referenced
this pull request
Jul 2, 2026
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
高負荷時の Web ワーカ枯渇を緩和するため、標準シングル構成の uWSGI ワーカ並列度・ タイムアウト (UWSGI_*、他 env 同様 KOMPIRA_ 上書き対応)、nginx→uWSGI の read/send タイムアウト (KOMPIRA_NGINX_UWSGI_READ/SEND_TIMEOUT)、PostgreSQL チューニング (POSTGRES_*) を環境変数で調整可能にした。既定値は従来挙動を維持。configs/nginx.conf を 参照する ACI デプロイにも既定 300 を渡す。並列度を上げる場合は POSTGRES_MAX_CONNECTIONS も連動が必要。 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
f1acff0 to
a5bee00
Compare
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.
概要
高負荷時に Web ワーカ (uWSGI) が長時間占有され、画面や API 全体の応答が枯渇する事象を緩和するため、標準シングル構成の uWSGI ワーカ並列度・タイムアウト、PostgreSQL チューニング、nginx タイムアウトを環境変数で調整可能にします。いずれも既定値は従来挙動を維持するため、未指定なら現行と同じ動作です。
Fixes #100
変更内容
KOMPIRA_UWSGI_* → UWSGI_* → 既定の多段フォールバックで解決する(コンテナへ渡すキー名UWSGI_*は本体イメージの起動スクリプトが読む名前なので維持)。UWSGI_PROCESSES(既定 5) /UWSGI_THREADS(1) /UWSGI_LISTEN(100) /UWSGI_HARAKIRI(0=無効) /UWSGI_THUNDER_LOCK(false)UWSGI_PROCESSES×UWSGI_THREADS。KOMPIRA_NGINX_UWSGI_READ_TIMEOUT/KOMPIRA_NGINX_UWSGI_SEND_TIMEOUT(各既定 300 秒)configs/nginx.conf) を使う ACI デプロイの nginx コンテナにも read/send タイムアウト env を既定 300 で設定(envsubst で未設定だと空/未展開となり nginx 起動に失敗するため)。POSTGRES_MAX_CONNECTIONS(100) /POSTGRES_SHARED_BUFFERS(128MB) /POSTGRES_EFFECTIVE_CACHE_SIZE(4GB) /POSTGRES_WORK_MEM(4MB) /POSTGRES_MAINTENANCE_WORK_MEM(64MB)注意
POSTGRES_MAX_CONNECTIONSも連動して引き上げてください。 不足すると "FATAL: sorry, too many clients already" で接続が拒否され、画面/API が 500 になります(目安: processes × threads + 余裕 ≦ max_connections)。UWSGI_*は kompira 本体イメージの起動スクリプトが解釈する前提です。対応イメージと組み合わせて有効になります(既定値では従来と同一のため、未対応イメージでも動作は変わりません)。