Netty Http Connection Provider maxLifeTime settings

152 Views Asked by At

According to the documentation here for maxLifeTime the channel is Eligible to be closed after the defined life time. Is there any chance that a connection will be used after the maxLifeTime is elapsed but the connection is not closed yet ?

For ex., in the code below,

ConnectionProvider.builder("custom")
                                  .maxConnections(50)
                                  .maxIdleTime(Duration.ofSeconds(20))           
                                  .maxLifeTime(Duration.ofSeconds(60))           
                                  .pendingAcquireTimeout(Duration.ofSeconds(60)) 
                                  .evictInBackground(Duration.ofSeconds(120))    
                                  .build();

Is there any chance for a connection be reused after 60 seconds of maxLifeTime and chances of it getting closed in the middle of a process assuming the evictInBackground process kicks in after 120 seconds ?

I am trying to solve a connection reset issue and would like to understand how netty connection provider settings work ?

1

There are 1 best solutions below

0
Violeta Georgieva On

maxLifeTime is checked on:

  • connection release to the connection pool - which means the response has already been delivered
  • or before connection acquire from the connection pool
  • or on background eviction - background eviction is made only for the idle connections in the connection pool i.e. these are connections that do not process requests at the moment