diff options
author | jonmv <venstad@gmail.com> | 2023-05-15 14:40:22 +0200 |
---|---|---|
committer | jonmv <venstad@gmail.com> | 2023-05-15 14:40:22 +0200 |
commit | bd1042d8132de3537b61415ac9cf9649eaa166c1 (patch) | |
tree | 2b0f209d71bb335614a603bafc8e6f52ad646eac /container-core/src/main/java/com | |
parent | 7e39f8036dbeb3722fca3a50fdc9c86129011cf0 (diff) |
Initiate connections uniform-randomly up to 10% before conn TTL expiry
Diffstat (limited to 'container-core/src/main/java/com')
-rw-r--r-- | container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/HttpRequestDispatch.java | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/HttpRequestDispatch.java b/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/HttpRequestDispatch.java index f9a2e3bc1a6..fa83593ea2b 100644 --- a/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/HttpRequestDispatch.java +++ b/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/HttpRequestDispatch.java @@ -163,7 +163,8 @@ class HttpRequestDispatch { double maxConnectionLifeInSeconds = connectorConfig.maxConnectionLife(); if (maxConnectionLifeInSeconds > 0) { long createdAt = connection.getCreatedTimeStamp(); - Instant expiredAt = Instant.ofEpochMilli((long) (createdAt + maxConnectionLifeInSeconds * 1000)); + long tenPctVariance = createdAt % 10; // should be random enough, and must be consistent for a given connection + Instant expiredAt = Instant.ofEpochMilli((long) (createdAt + maxConnectionLifeInSeconds * 10 * (100 - tenPctVariance))); boolean isExpired = Instant.now().isAfter(expiredAt); if (isExpired) { gracefulShutdown(connection); |