woaishixiaoxiao opened a new issue, #1178:
URL: https://github.com/apache/rocketmq-clients/issues/1178
### Before Creating the Enhancement Request
- [x] I have confirmed that this should be classified as an enhancement
rather than a bug/feature.
### Programming Language of the Client
Go
### Summary
Replace per-message goroutines in SendAsync with bounded async execution
using existing SimpleThreadPool
### Motivation
## Problem
Currently, `Producer.SendAsync()` create a new goroutine for every message:
```
go func() {
resp, err := p.send0(ctx, msgs, false)
f(ctx, resp, err)
}()
```
Under high load or when the RocketMQ broker is slow/unresponsive, this can
lead to:
- Unbounded goroutine growth
- Memory exhaustion (OOM)
### Describe the Solution You'd Like
reuse the existing SimpleThreadPool in SendAsync that:
- Is lazily initialized on first SendAsync call
- Limits max concurrent sends
- Uses a bounded queue to buffer pending tasks
- Rejects new tasks gracefully when queue is full
### Describe Alternatives You've Considered
- Prevents goroutine leaks and OOM under load
- Provides predictable resource usage
- Enables backpressure when broker is slow
- Configurable to fit different workload profiles
### Additional Context
_No response_
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]