cockroachdb / cockroachdb/cockroach
adaptive idle timeout to better use pooled streams
- Dominant language
- Go
- Stars
- 32.5k
- Forks
- 4.1k
- PR merge metrics
- PR metrics pending
Description
During DRPC benchmark runs with stream pools enabled, we observed that stream and DRPC connection opened and closed continuously during the run. Streams are closed due to idle timeout (10s) causing the underlying DRPC connection to be closed.

[PR #145907](https://github.com/cockroachdb/cockroach/pull/145907) implemented two changes:
1. Separate stream idle timeout from DRPC connection timeout since connections are more expensive to create.
2. Don't close DRPC connection when a stream is closed. This allows reusing the connections for the new streams.
Since we use an idle timeout of 10s, we can try to tune it to avoid frequently opening and closing the streams but this timeout greatly depends on the workload. An alternative approach is to make the idle timeout adaptable (by estimating an optimal number of stream required).
Jira issue: CRDB-50569
Contributor guide
Assessment
This issue has not been assessed yet.