scala - Time to live on host-level akka-http client connection -
i have service running on production, calls dependency service using :
http().newhostconnectionpoolhttps[promise[httpresponse]]
each time new stack of dependency service deployed, service dns cache updated setting :
java.security.security.setproperty("networkaddress.cache.ttl" , "60")
problem connections inside pool lives on forever , resolves dns once @ initiation time. keeps calling old dependency stack.
i searching away set max connection's time live.
akka-http has functionality build in, can settings in reference config
in short have put following key config (application.conf likely):
akka { io { dns { inet-address { # set time cache name resolutions # possible values: # default: sun.net.inetaddresscachepolicy.get() , getnegative() # forever: cache forever # never: no caching # n [time unit]: positive timeout unit, example "30 s" positive-ttl = 20s negative-ttl = 10s } } } }
and have do. connection pool ttls set sensible values default can find them here.
Comments
Post a Comment