abnormal memory usage by the grpc packet
- Dominant language
- Go
- Stars
- 40.5k
- Forks
- 6.2k
- PR merge metrics
- PR metrics pending
Description
## Enhancement
Analyzing the memory usage of this case
```shell
mysql -h 127.0.0.1 -u root -P 4000 -e 'select * from (select * from ens_rb001.rb_acct_balance union all select * from ens_rb002.rb_acct_balance union all select * from ens_rb003.rb_acct_balance union all select * from ens_rb004.rb_acct_balance)' > /dev/null
```

Union all on 4 tables, and the default distsql scan concurrency is 15, it means that in in theory, there should be at most 4*15 = 60 inflight packet.
530.16M/3.51M > 150, there are more than 150 packet inuse grpc packet, which is counterintuitive.
It's caused by that we use buffered channel, so even the distsql scan concurrency is 15,
there will be much more packets than the worker count.
Contributor guide
Assessment
This issue has not been assessed yet.