-
Notifications
You must be signed in to change notification settings - Fork 0
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
base: develop
Are you sure you want to change the base?
Conversation
The KE object abspath has a MAX_PATH_LENGTH of 1024. Therefore, nginx conf updated to support URI length up to 1024 characters
4adfdc8
to
125019b
Compare
@@ -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; |
There was a problem hiding this comment.
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
uwsgi_buffer_size 24k; | ||
# for response body | ||
uwsgi_buffers 3 24k; | ||
uwsgi_busy_buffers_size 24k; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
メモ:
uwsgi_busy_buffers_size
must be less than the size of alluwsgi_buffers
minus one bufferuwsgi_busy_buffers_size
must be equal to or greater than the maximum of the value ofuwsgi_buffer_size
and one of theuwsgi_buffers
doc: https://nginx.org/en/docs/http/ngx_http_uwsgi_module.html
# 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; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
メモ:
response headerの1件 は最小 24K必要でした。
@@ -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 |
There was a problem hiding this comment.
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としておきました。
の部分がよくわかりませんでした。以下のレベルで説明できますか?
URI エンコード方式なども関係するのかな?とも予想していますが、どうでしょうか? あと、他にももっとヘッダが長くなる可能性はありませんか? |
The maximum size for a path is calculated as MAX_PATH_LENGTH * 9 (to account for Unicode characters when URL-encoded), which equals 9 KB. If the query string uses the same path length (e.g., focus=path), the size will double to 2 * 9 KB = 18 KB. To accommodate the maximum path length with a query string and allow for additional parameters, we add 6 KB for safety, resulting in a total of 18 KB + 6 KB = 24 KB for the path and query. Considering other factors like cookies, redirects, and Location headers, the total required size is approximately 2 * 24 KB = 48 KB. |
検索テキストは「パス」だけでなく、文字列型フィールドの検索にも使うと思います。
この 48KB は1つのヘッダの最大長を示していますか?それともヘッダ全体の長さでしょうか? |
maximum length of one header 24KB. total length of headers 48KB |
search string can be any, it is difficult to decide , I considered 9KB for actual path and 15KB for search query, in total 24KB. if you think that is not enough we can consider 32KB for one header, what do you think? for rest of the headers 32KB in total 2 * 32KB |
Increasing header size limits unnecessarily can expose the application to risks such as b̶u̶f̶f̶e̶r̶ o̶v̶e̶r̶f̶l̶o̶w̶ a̶t̶t̶a̶c̶k̶s̶ or performance issues. |
when default buffer size
default_buffer_size.mov
After buffer size increase
bufer_size_increase.mov
結合テスト:
https://github.com/fixpoint/kompira-v2-integration-test/pull/41
テスト結果:
https://fixpoint.github.io/kompira-v2-integration-test/147/index.html#suites/7ae9a7d01062ff0e0832aa27c1dd6c1a/fb1861b67e958a94/