title: Elatsic cache - redis - Not able to connect after writing ~30-40 K keys- connection pool issue
body: <p>I am using Elastic cache redis with 4 shards and 2 replica nodes for each shard, in total 12 nodes.
  I am using spring data redis with lettuce.
  Below is my configuration for cluster connection -</p>
  
  <p>public LettuceConnectionFactory redisConnectionFactory() {</p>
  
  <pre><code>    List&lt;String&gt;  nodes = new ArrayList&lt;&gt;();
  
      nodes.add("shard1***");
      nodes.add("shard2***");
      nodes.add("shard3***");
      nodes.add("shard4***");
      RedisClusterConfiguration clusterConfiguration = new RedisClusterConfiguration(nodes);
      return new LettuceConnectionFactory(clusterConfiguration);
  </code></pre>
  
  <p>}</p>
  
  <p>I am writing data in a pipeline, which execute 5 write commands in a pipeline. Throughput is very high for this ~300K/per sec and due to this I am getting below error. Is there any way I can optimize lettuce pool to resolve this issue. Any pointer will be helpful.</p>
  
  <p>at io.lettuce.core.LettuceFutures.awaitAll(LettuceFutures.java:88)
  Caused by: io.lettuce.core.RedisException: io.lettuce.core.RedisConnectionException: Unable to connect to 172.26.25.141:6379</p>
  
  <pre><code>at org.springframework.data.redis.connection.lettuce.LettuceConnection.closePipeline(LettuceConnection.java:542)
  ... 35 more
  </code></pre>
  
  <p>Caused by: io.lettuce.core.RedisConnectionException: Unable to connect to 172.26.25.141:6379
  Caused by: io.lettuce.core.RedisConnectionException: Unable to connect to 172.26.25.141:6379</p>
  
  <pre><code>at io.lettuce.core.RedisConnectionException.create(RedisConnectionException.java:78)
  at io.lettuce.core.RedisConnectionException.create(RedisConnectionException.java:56)
  at io.lettuce.core.cluster.PooledClusterConnectionProvider.lambda$getConnectionAsync$6(PooledClusterConnectionProvider.java:384)
  at java.base/java.util.concurrent.CompletableFuture.uniHandle(CompletableFuture.java:930)
  at java.base/java.util.concurrent.CompletableFuture$UniHandle.tryFire(CompletableFuture.java:907)
  at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:506)
  at java.base/java.util.concurrent.CompletableFuture.completeExceptionally(CompletableFuture.java:2088)
  at io.lettuce.core.AbstractRedisClient.lambda$initializeChannelAsync0$4(AbstractRedisClient.java:329)
  at io.netty.util.concurrent.DefaultPromise.notifyListener0(DefaultPromise.java:577)
  at io.netty.util.concurrent.DefaultPromise.notifyListenersNow(DefaultPromise.java:551)
  </code></pre>