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

The management of thread pools in sofarpc under high concurrency requests. #1327

Closed
dajitui opened this issue Apr 14, 2023 · 5 comments
Closed

Comments

@dajitui
Copy link
Contributor

dajitui commented Apr 14, 2023

Your question

sofastack/sofa-bolt#322
As shown in the above issues, the Bolt framework handles request callback response results through a thread pool. If it encounters high concurrent requests, the thread pool may run out of resources. In the code com.alipay.sofa.rpc.server.bolt.BoltServer#initThreadPool, I saw that the thread pool uses the default rejection policy, which will inevitably lead to some lost responses.

My question is whether there is a corresponding solution to this problem. I know that customizing the thread pool can solve this problem, but for beginners, the framework should be more intelligent. For example, there should be a monitoring mechanism to monitor the situation of the corresponding thread pool, so as to avoid this situation by increasing the client nodes or dynamically adjusting the thread pool parameters.

@OrezzerO
Copy link
Contributor

I think it is business lay which is responsible for the performance of task in threadpool.

Monitoring of the thread pool is important. You can find related code in sofa-boot/RpcThreadPoolMonitor.java. You can see that monitoring is not written in bolt repo, it is more suitable to do monitoring in upper lay.

Howerver , it is not enough to only have monitoring. We still need to do some things to ensure smooth and efficient operation of the system:

  1. Adjusting thread pool parameters to fully utilize machine resources.
  2. Using asynchronous solutions wisely to reduce synchronous waiting and improve concurrency.
  3. Implementing effective monitoring and alerting, and performing horizontal scaling when necessary.

@dajitui
Copy link
Contributor Author

dajitui commented Apr 18, 2023

I think it is business lay which is responsible for the performance of task in threadpool.

Monitoring of the thread pool is important. You can find related code in sofa-boot/RpcThreadPoolMonitor.java. You can see that monitoring is not written in bolt repo, it is more suitable to do monitoring in upper lay.

Howerver , it is not enough to only have monitoring. We still need to do some things to ensure smooth and efficient operation of the system:

  1. Adjusting thread pool parameters to fully utilize machine resources.
  2. Using asynchronous solutions wisely to reduce synchronous waiting and improve concurrency.
  3. Implementing effective monitoring and alerting, and performing horizontal scaling when necessary.

@OrezzerO OK, I got it wrong. The thread pool is used by the server when processing requests.

But if you don't rely on Sofa-boot, this monitoring won't automatically start, right?

@OrezzerO
Copy link
Contributor

I think it is business lay which is responsible for the performance of task in threadpool.
Monitoring of the thread pool is important. You can find related code in sofa-boot/RpcThreadPoolMonitor.java. You can see that monitoring is not written in bolt repo, it is more suitable to do monitoring in upper lay.
Howerver , it is not enough to only have monitoring. We still need to do some things to ensure smooth and efficient operation of the system:

  1. Adjusting thread pool parameters to fully utilize machine resources.
  2. Using asynchronous solutions wisely to reduce synchronous waiting and improve concurrency.
  3. Implementing effective monitoring and alerting, and performing horizontal scaling when necessary.

@OrezzerO OK, I got it wrong. The thread pool is used by the server when processing requests.

But if you don't rely on Sofa-boot, this monitoring won't automatically start, right?

Yes, if you don't relay on sofa-boot. you need to monitor thread pool yourself. You can do some easy task to monitor your thread pool from your APM.

@dajitui
Copy link
Contributor Author

dajitui commented Apr 19, 2023

@OrezzerO OrezzerO, by the way, with the maturity of cloud native, what do you think of the prospects for the development of middleware or Sofa components?

Because cloud native is essential for basic middleware, it is convenient for the popularization of middleware and a challenge for self-developed middleware.

For the secondary development of unique enterprise features or performance tuning?

@OrezzerO
Copy link
Contributor

OrezzerO commented Apr 20, 2023

In my opinion, easy to use is the most important thing. @dajitui

@OrezzerO OrezzerO closed this as completed Jun 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants