diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2020-05-29 10:20:45 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2020-05-29 10:24:22 +0000 |
commit | 213b56568ea0c0997b64d74915e43c56fd19789a (patch) | |
tree | e60085e8ff9bd8623678a555f6c816adddd09793 /vespaclient-container-plugin | |
parent | 8dfa395f0c959987bd000507bf6940238f571b50 (diff) |
Remove softStart from code too.
Diffstat (limited to 'vespaclient-container-plugin')
-rw-r--r-- | vespaclient-container-plugin/src/main/java/com/yahoo/vespa/http/server/FeedHandlerV3.java | 21 | ||||
-rw-r--r-- | vespaclient-container-plugin/src/test/java/com/yahoo/feedhandler/v3/FeedTesterV3.java | 14 |
2 files changed, 1 insertions, 34 deletions
diff --git a/vespaclient-container-plugin/src/main/java/com/yahoo/vespa/http/server/FeedHandlerV3.java b/vespaclient-container-plugin/src/main/java/com/yahoo/vespa/http/server/FeedHandlerV3.java index 05a64d633a4..03916949cae 100644 --- a/vespaclient-container-plugin/src/main/java/com/yahoo/vespa/http/server/FeedHandlerV3.java +++ b/vespaclient-container-plugin/src/main/java/com/yahoo/vespa/http/server/FeedHandlerV3.java @@ -45,9 +45,6 @@ public class FeedHandlerV3 extends LoggingRequestHandler { protected final ReplyHandler feedReplyHandler; private final Metric metric; private final Object monitor = new Object(); - private int remainingThreadsForFeedingAllowance; - private final Duration timeBetweenBumpingMaxThreads; - private Instant nextTimeToAllocateAnotherThread = Instant.now(); private final AtomicInteger threadsAvailableForFeeding; private static final Logger log = Logger.getLogger(FeedHandlerV3.class.getName()); @@ -65,20 +62,10 @@ public class FeedHandlerV3 extends LoggingRequestHandler { this.metric = parentCtx.getMetric(); // 40% of the threads can be blocking on feeding before we deny requests. if (threadpoolConfig != null) { - remainingThreadsForFeedingAllowance = Math.max((int) (0.4 * threadpoolConfig.maxthreads()), 1); - if (threadpoolConfig.softStartSeconds() > 0.0) { - threadsAvailableForFeeding = new AtomicInteger(0); - timeBetweenBumpingMaxThreads = Duration.ofMillis((long)(threadpoolConfig.softStartSeconds() * 1000) / remainingThreadsForFeedingAllowance); - } else { - threadsAvailableForFeeding = new AtomicInteger(remainingThreadsForFeedingAllowance); - remainingThreadsForFeedingAllowance = 0; - timeBetweenBumpingMaxThreads = null; - } + threadsAvailableForFeeding = new AtomicInteger(Math.max((int) (0.4 * threadpoolConfig.maxthreads()), 1)); } else { log.warning("No config for threadpool, using 200 for max blocking threads for feeding."); threadsAvailableForFeeding = new AtomicInteger(200); - remainingThreadsForFeedingAllowance = 0; - timeBetweenBumpingMaxThreads = null; } } @@ -93,12 +80,6 @@ public class FeedHandlerV3 extends LoggingRequestHandler { String clientId = clientId(request); ClientFeederV3 clientFeederV3; synchronized (monitor) { - Instant now = Instant.now(); - if ((remainingThreadsForFeedingAllowance > 0) && (now.isAfter(nextTimeToAllocateAnotherThread))) { - threadsAvailableForFeeding.incrementAndGet(); - remainingThreadsForFeedingAllowance --; - nextTimeToAllocateAnotherThread = now.plus(timeBetweenBumpingMaxThreads); - } if (! clientFeederByClientId.containsKey(clientId)) { SourceSessionParams sourceSessionParams = sourceSessionParams(request); clientFeederByClientId.put(clientId, diff --git a/vespaclient-container-plugin/src/test/java/com/yahoo/feedhandler/v3/FeedTesterV3.java b/vespaclient-container-plugin/src/test/java/com/yahoo/feedhandler/v3/FeedTesterV3.java index 0bb42851347..1efa8129cdb 100644 --- a/vespaclient-container-plugin/src/test/java/com/yahoo/feedhandler/v3/FeedTesterV3.java +++ b/vespaclient-container-plugin/src/test/java/com/yahoo/feedhandler/v3/FeedTesterV3.java @@ -77,20 +77,6 @@ public class FeedTesterV3 { assertThat(Splitter.on("\n").splitToList(result).size(), is(101)); } - @Test - public void softRestart() throws Exception { - ThreadpoolConfig.Builder builder = new ThreadpoolConfig.Builder().softStartSeconds(5); - final FeedHandlerV3 feedHandlerV3 = setupFeederHandler(builder.build()); - for (int i= 0; i < 100; i++) { - HttpResponse httpResponse = feedHandlerV3.handle(createRequest(100)); - ByteArrayOutputStream outStream = new ByteArrayOutputStream(); - httpResponse.render(outStream); - assertThat(httpResponse.getContentType(), is("text/plain")); - String result = Utf8.toString(outStream.toByteArray()); - assertThat(Splitter.on("\n").splitToList(result).size(), is(101)); - } - } - private static DocumentTypeManager createDoctypeManager() { DocumentTypeManager docTypeManager = new DocumentTypeManager(); DocumentType documentType = new DocumentType("testdocument"); |