baidu / baidu/Jprotobuf-rpc-socket

minEvictableIdleTimeMillis is useless with default timeBetweenEvictionRunsMillis

Open
#83 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
535
Forks
216
PR merge metrics
No merged PRs in 30d

Description

As for the connection pool, the idle object after `minEvictableIdleTimeMillis` is evicted in Evictor thread.
Evictor thread is started only when `timeBetweenEvictionRunsMillis > 0`, and default `timeBetweenEvictionRunsMillis` is -1.

However, RpcClientOptions doesn't provide API to set `timeBetweenEvictionRunsMillis`. Could we provide `RpcClientOptions::timeBetweenEvictionRunsMillis`?

```java
public ChannelPool(RpcClient rpcClient, String host, int port) {
this.clientConfig = rpcClient.getRpcClientOptions();
objectFactory = new ChannelPoolObjectFactory(rpcClient, host, port);

GenericObjectPoolConfig config = new GenericObjectPoolConfig();
config.setJmxEnabled(clientConfig.isJmxEnabled());
pool = new GenericObjectPool(objectFactory, config);
pool.setMaxIdle(clientConfig.getMaxIdleSize());
pool.setMaxTotal(clientConfig.getThreadPoolSize());
pool.setMaxWaitMillis(clientConfig.getMaxWait());
pool.setMinIdle(clientConfig.getMinIdleSize());
pool.setMinEvictableIdleTimeMillis(clientConfig.getMinEvictableIdleTime());
pool.setTestOnBorrow(clientConfig.isTestOnBorrow());
pool.setTestOnReturn(clientConfig.isTestOnReturn());
pool.setLifo(clientConfig.isLifo());

}
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by locating RpcClientOptions and ChannelPool, then compare the existing pool settings shown in the issue with the available client options. Trace how the pool is configured and expose the eviction-run interval through RpcClientOptions so it is applied to the pool; done means callers can configure timeBetweenEvictionRunsMillis and idle eviction can run when enabled.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend-api-design, networking
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.