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

[Enhancement] Support to configure the number of http worker threads on FE #37530

Merged
merged 3 commits into from
Dec 25, 2023

Conversation

banmoy
Copy link
Contributor

@banmoy banmoy commented Dec 21, 2023

Why I'm doing:
Http worker threads on FE are used to deal with http requests. Some requests may do heavy operations which will block threads, such as transaction stream load commit, and other operations that need to get lock. As a result, http server can't deal with other requests. Before optimizing these heavy operations, we first make the number of http worker threads to be configurable, and increase it as a candidate solution if the problem happens.

What I'm doing:
Add a configuration to adjust the number of http worker threads on FE

Fixes #issue

What type of PR is this:

  • BugFix
  • Feature
  • Enhancement
  • Refactor
  • UT
  • Doc
  • Tool

Does this PR entail a change in behavior?

  • Yes, this PR will result in a change in behavior.
  • No, this PR will not result in a change in behavior.

If yes, please specify the type of change:

  • Interface/UI changes: syntax, type conversion, expression evaluation, display information
  • Parameter changes: default values, similar parameters but with different default values
  • Policy changes: use new policy to replace old one, functionality automatically enabled
  • Feature removed
  • Miscellaneous: upgrade & downgrade compatibility, etc.

Checklist:

  • I have added test cases for my bug fix or my new feature
  • This pr needs user documentation (for new or modified features or behaviors)
    • I have added documentation for my new feature or new function
  • This is a backport pr

Bugfix cherry-pick branch check:

  • I have checked the version labels which the pr will be auto-backported to the target branch
    • 3.2
    • 3.1
    • 3.0
    • 2.5

@mergify mergify bot assigned banmoy Dec 21, 2023
*/
@ConfField
public static int http_worker_threads_num = 0;

/**
* The backlog_num for netty http server
* When you enlarge this backlog_num, you should ensure its value larger than
Copy link

Choose a reason for hiding this comment

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

The most risky bug in this code is:
Using the default value of http_worker_threads_num as 0 is risky in some cases.
You can modify the code like this:

@ConfField
public static int http_worker_threads_num = 2 * Runtime.getRuntime().availableProcessors();

@github-actions github-actions bot added 3.2 3.1 3.0 2.5 documentation Improvements or additions to documentation labels Dec 21, 2023
@banmoy banmoy force-pushed the http_worker_size branch 2 times, most recently from 97bf519 to 8934980 Compare December 21, 2023 08:19
@@ -935,6 +935,12 @@ Compaction Score 代表了一个表分区是否值得进行 Compaction 的评分
- 含义:FE 节点上 HTTP 服务器的端口。
- 默认值:8030

#### http_worker_threads_num

- 含义:Http Server 用于处理 HTTP 请求的线程数。如果配置为非正数,线程数将设置为 CPU 核数的 2 倍。
Copy link
Contributor

Choose a reason for hiding this comment

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

这样感觉更容易理解一些:

... 如果配置为0,线程数将设置为 CPU 核数的 2 倍。

Copy link
Contributor Author

@banmoy banmoy Dec 22, 2023

Choose a reason for hiding this comment

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

这里也想说明一下配置为负数的行为,改成 "如果配置为负数或0"是不是好些?

@banmoy
Copy link
Contributor Author

banmoy commented Dec 22, 2023

@wyb @gengjun-git PTAL again

@wyb wyb enabled auto-merge (squash) December 22, 2023 07:58
auto-merge was automatically disabled December 22, 2023 11:31

Head branch was pushed to by a user without write access

Copy link

sonarcloud bot commented Dec 25, 2023

Quality Gate Failed Quality Gate failed

Failed conditions

C Maintainability Rating on New Code (required ≥ A)

See analysis details on SonarCloud

idea Catch issues before they fail your Quality Gate with our IDE extension SonarLint SonarLint

Copy link

[FE Incremental Coverage Report]

pass : 3 / 3 (100.00%)

file detail

path covered_line new_line coverage not_covered_line_detail
🔵 com/starrocks/common/Config.java 1 1 100.00% []
🔵 com/starrocks/http/HttpServer.java 2 2 100.00% []

Copy link

[BE Incremental Coverage Report]

pass : 0 / 0 (0%)

@gengjun-git gengjun-git merged commit d24bede into StarRocks:main Dec 25, 2023
41 of 42 checks passed
Copy link

@Mergifyio backport branch-3.2

@github-actions github-actions bot removed the 3.2 label Dec 25, 2023
Copy link

@Mergifyio backport branch-3.1

@github-actions github-actions bot removed the 3.1 label Dec 25, 2023
@github-actions github-actions bot removed the 3.0 label Dec 25, 2023
Copy link

@Mergifyio backport branch-2.5

Copy link
Contributor

mergify bot commented Dec 25, 2023

backport branch-3.1

✅ Backports have been created

@github-actions github-actions bot removed the 2.5 label Dec 25, 2023
Copy link
Contributor

mergify bot commented Dec 25, 2023

backport branch-3.0

✅ Backports have been created

Copy link
Contributor

mergify bot commented Dec 25, 2023

backport branch-2.5

✅ Backports have been created

mergify bot pushed a commit that referenced this pull request Dec 25, 2023
…on FE (#37530)

Why I'm doing:
Http worker threads on FE are used to deal with http requests.  Some requests may do heavy operations which will block threads, such as transaction stream load commit, and other operations that need to get lock. As a result, http server can't deal with other requests.  Before optimizing these heavy operations, we first make the number of http worker threads to be configurable, and increase it as a candidate solution if the problem happens.

What I'm doing:
Add a configuration to adjust the number of http worker threads on FE

Signed-off-by: PengFei Li <[email protected]>
(cherry picked from commit d24bede)
mergify bot pushed a commit that referenced this pull request Dec 25, 2023
…on FE (#37530)

Why I'm doing:
Http worker threads on FE are used to deal with http requests.  Some requests may do heavy operations which will block threads, such as transaction stream load commit, and other operations that need to get lock. As a result, http server can't deal with other requests.  Before optimizing these heavy operations, we first make the number of http worker threads to be configurable, and increase it as a candidate solution if the problem happens.

What I'm doing:
Add a configuration to adjust the number of http worker threads on FE

Signed-off-by: PengFei Li <[email protected]>
(cherry picked from commit d24bede)

# Conflicts:
#	docs/en/administration/Configuration.md
#	docs/zh/administration/Configuration.md
mergify bot pushed a commit that referenced this pull request Dec 25, 2023
…on FE (#37530)

Why I'm doing:
Http worker threads on FE are used to deal with http requests.  Some requests may do heavy operations which will block threads, such as transaction stream load commit, and other operations that need to get lock. As a result, http server can't deal with other requests.  Before optimizing these heavy operations, we first make the number of http worker threads to be configurable, and increase it as a candidate solution if the problem happens.

What I'm doing:
Add a configuration to adjust the number of http worker threads on FE

Signed-off-by: PengFei Li <[email protected]>
(cherry picked from commit d24bede)

# Conflicts:
#	docs/en/administration/FE_configuration.md
#	docs/zh/administration/FE_configuration.md
mergify bot pushed a commit that referenced this pull request Dec 25, 2023
…on FE (#37530)

Why I'm doing:
Http worker threads on FE are used to deal with http requests.  Some requests may do heavy operations which will block threads, such as transaction stream load commit, and other operations that need to get lock. As a result, http server can't deal with other requests.  Before optimizing these heavy operations, we first make the number of http worker threads to be configurable, and increase it as a candidate solution if the problem happens.

What I'm doing:
Add a configuration to adjust the number of http worker threads on FE

Signed-off-by: PengFei Li <[email protected]>
(cherry picked from commit d24bede)

# Conflicts:
#	docs/en/administration/FE_configuration.md
#	docs/zh/administration/FE_configuration.md
banmoy added a commit to banmoy/starrocks that referenced this pull request Dec 26, 2023
banmoy added a commit to banmoy/starrocks that referenced this pull request Dec 26, 2023
banmoy added a commit to banmoy/starrocks that referenced this pull request Dec 26, 2023
wanpengfei-git pushed a commit that referenced this pull request Dec 26, 2023
gengjun-git pushed a commit that referenced this pull request Dec 26, 2023
gengjun-git pushed a commit that referenced this pull request Dec 26, 2023
gengjun-git pushed a commit that referenced this pull request Dec 26, 2023
Zhangg7723 pushed a commit to Zhangg7723/starrocks that referenced this pull request Dec 26, 2023
…on FE (StarRocks#37530)

Why I'm doing:
Http worker threads on FE are used to deal with http requests.  Some requests may do heavy operations which will block threads, such as transaction stream load commit, and other operations that need to get lock. As a result, http server can't deal with other requests.  Before optimizing these heavy operations, we first make the number of http worker threads to be configurable, and increase it as a candidate solution if the problem happens.

What I'm doing:
Add a configuration to adjust the number of http worker threads on FE

Signed-off-by: PengFei Li <[email protected]>
Signed-off-by: 张敢 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants