Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uwsgi buffer increase (48K) #66

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions configs/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,15 @@ server {
# アップロードファイルサイズのチェックを行わない
client_max_body_size 0;

### for KE: MAX_PATH_LENGTH=MAX_CHAR_LENGTH = 1024 ###
# for reading large client request header. A request line cannot exceed the size of one buffer
large_client_header_buffers 2 24k;
# for reading the first part of the response received from the uwsgi server
uwsgi_buffer_size 24k;
# for response body
uwsgi_buffers 3 24k;
uwsgi_busy_buffers_size 24k;

# djangoの静的ファイル(HTML、CSS、Javascriptなど)を管理
location /.static/ {
alias /var/opt/kompira/html/;
Expand All @@ -36,6 +45,15 @@ server {
# アップロードファイルサイズのチェックを行わない
client_max_body_size 0;

### for KE: MAX_PATH_LENGTH=MAX_CHAR_LENGTH = 1024 ###
# for reading large client request header. A request line cannot exceed the size of one buffer
large_client_header_buffers 2 24k;
Copy link
Contributor Author

@fixpoint-hasan fixpoint-hasan Dec 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

メモ:
MAX_PATH_LENGTH=1024 なら request headerの1件 は最小 1 *24K必要でした。別の valueもあるの可能性があるため、2 *24Kを設定しました。

doc: https://nginx.org/en/docs/http/ngx_http_core_module.html#large_client_header_buffers

# for reading the first part of the response received from the uwsgi server
uwsgi_buffer_size 24k;
Copy link
Contributor Author

@fixpoint-hasan fixpoint-hasan Dec 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

メモ:
response headerの1件 は最小 24K必要でした。

# for response body
uwsgi_buffers 3 24k;
uwsgi_busy_buffers_size 24k;
Copy link
Contributor Author

@fixpoint-hasan fixpoint-hasan Dec 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

メモ:

  1. uwsgi_busy_buffers_size must be less than the size of all uwsgi_buffers minus one buffer
  2. uwsgi_busy_buffers_size must be equal to or greater than the maximum of the value of uwsgi_buffer_size and one of the uwsgi_buffers

doc: https://nginx.org/en/docs/http/ngx_http_uwsgi_module.html


ssl_certificate /etc/nginx/ssl/server.crt;
ssl_certificate_key /etc/nginx/ssl/server.key;
# ssl_password_file /etc/nginx/ssl/server.password;
Expand Down
1 change: 1 addition & 0 deletions ke2/services/kompira.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ services:
AUDIT_LOGGING_BACKUP: ${KOMPIRA_AUDIT_LOGGING_BACKUP:-${AUDIT_LOGGING_BACKUP:-365}}
AUDIT_LOGGING_WHEN: ${KOMPIRA_AUDIT_LOGGING_WHEN:-${AUDIT_LOGGING_WHEN:-MIDNIGHT}}
AUDIT_LOGGING_INTERVAL: ${KOMPIRA_AUDIT_LOGGING_INTERVAL:-${AUDIT_LOGGING_INTERVAL:-1}}
UWSGI_BUFFER_SIZE: 49152
Copy link
Contributor Author

@fixpoint-hasan fixpoint-hasan Dec 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

メモ:
response headerの1件 は最小 24K必要でしたので全ての size は 2*24Kとしておきました。

hostname: ap-${HOSTNAME:?HOSTNAME must be set}
init: true
command: ["uwsgi"]
Expand Down