diff options
author | Jon Bratseth <bratseth@yahoo-inc.com> | 2016-10-25 10:06:20 +0200 |
---|---|---|
committer | Jon Bratseth <bratseth@yahoo-inc.com> | 2016-10-25 10:06:20 +0200 |
commit | 2ee87c18e47fd10392440f64aec12a00f52b8376 (patch) | |
tree | d2cf98f36f2a583f75b6641bceb41d9e7065c604 | |
parent | d0793fd0709c6e4a726ca9c94f5048537c1847e3 (diff) |
Use a dedicated thread for VIP status
Also, various nonfunctiuonal changes.
6 files changed, 26 insertions, 16 deletions
diff --git a/bundle-plugin/src/main/java/com/yahoo/container/plugin/mojo/GenerateSourcesMojo.java b/bundle-plugin/src/main/java/com/yahoo/container/plugin/mojo/GenerateSourcesMojo.java index cb2e54024b4..e09748615a8 100644 --- a/bundle-plugin/src/main/java/com/yahoo/container/plugin/mojo/GenerateSourcesMojo.java +++ b/bundle-plugin/src/main/java/com/yahoo/container/plugin/mojo/GenerateSourcesMojo.java @@ -75,14 +75,11 @@ public class GenerateSourcesMojo extends AbstractMojo { if (configGenVersion != null && !configGenVersion.isEmpty()) { return configGenVersion; } - Dependency containerDev = getVespaDependency("container-dev"); + + Dependency containerDev = getVespaDependency("container-dev"); // TODO: change to "container" if (containerDev != null) return containerDev.getVersion(); - Dependency prelude = getVespaDependency("prelude"); - if (prelude != null) - return prelude.getVersion(); - Dependency docproc = getVespaDependency("docproc"); if (docproc != null) return docproc.getVersion(); diff --git a/container-core/src/main/java/com/yahoo/container/handler/ThreadPoolProvider.java b/container-core/src/main/java/com/yahoo/container/handler/ThreadPoolProvider.java index 474c2f1a4a2..bd8e9e1601d 100644 --- a/container-core/src/main/java/com/yahoo/container/handler/ThreadPoolProvider.java +++ b/container-core/src/main/java/com/yahoo/container/handler/ThreadPoolProvider.java @@ -22,7 +22,7 @@ import com.yahoo.jdisc.Metric; * A configurable thread pool provider. This provides the worker threads used for normal request processing. * Request an Executor injected in your component constructor if you want to use it. * - * @author <a href="mailto:steinar@yahoo-inc.com">Steinar Knutsen</a> + * @author Steinar Knutsen * @author baldersheim * @author bratseth */ diff --git a/container-core/src/main/java/com/yahoo/container/handler/VipStatusHandler.java b/container-core/src/main/java/com/yahoo/container/handler/VipStatusHandler.java index f36cd77c0b7..7a244bc94cb 100644 --- a/container-core/src/main/java/com/yahoo/container/handler/VipStatusHandler.java +++ b/container-core/src/main/java/com/yahoo/container/handler/VipStatusHandler.java @@ -7,6 +7,9 @@ import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.concurrent.Executor; +import java.util.concurrent.LinkedBlockingQueue; +import java.util.concurrent.ThreadPoolExecutor; +import java.util.concurrent.TimeUnit; import java.util.logging.Logger; import com.google.inject.Inject; @@ -23,7 +26,8 @@ import com.yahoo.vespa.defaults.Defaults; * Transmit status to VIP from file or memory. Bind this to * "http://{@literal *}/status.html" to serve VIP status requests. * - * @author <a href="mailto:steinar@yahoo-inc.com">Steinar Knutsen</a> + * @author Steinar Knutsen + * @author bratseth */ public final class VipStatusHandler extends ThreadedHttpRequestHandler { @@ -160,13 +164,23 @@ public final class VipStatusHandler extends ThreadedHttpRequestHandler { @Inject public VipStatusHandler(Executor executor, VipStatusConfig vipConfig, Metric metric, VipStatus vipStatus) { - super(executor, metric); + super(createDedicatedThreadExecutor(), metric); this.accessDisk = vipConfig.accessdisk(); this.statusFile = new File(Defaults.getDefaults().underVespaHome(vipConfig.statusfile())); this.noSearchBackendsImpliesOutOfService = vipConfig.noSearchBackendsImpliesOutOfService(); this.vipStatus = vipStatus; } + /** + * Use a dedicated thread pool to avoid returning an error to VIPs when the regular thread pool is out of capacity. + * One thread should be enough for status handling - otherwise something else is completely wrong, + * in which case this will eventually start returning a 503 (due to work rejection) as the bounded + * queue will fill up + */ + private static Executor createDedicatedThreadExecutor() { + return new ThreadPoolExecutor(1, 1, 0, TimeUnit.SECONDS, new LinkedBlockingQueue<>(100)); + } + @Override public HttpResponse handle(HttpRequest request) { if (metric != null) diff --git a/container-core/src/main/java/com/yahoo/container/jdisc/ThreadedHttpRequestHandler.java b/container-core/src/main/java/com/yahoo/container/jdisc/ThreadedHttpRequestHandler.java index 6600a36f9db..07af6d45aed 100644 --- a/container-core/src/main/java/com/yahoo/container/jdisc/ThreadedHttpRequestHandler.java +++ b/container-core/src/main/java/com/yahoo/container/jdisc/ThreadedHttpRequestHandler.java @@ -24,14 +24,14 @@ import java.util.logging.Logger; * {@link HttpResponse#render(java.io.OutputStream)} method. * * @author hmusum - * @author <a href="mailto:steinar@yahoo-inc.com">Steinar Knutsen</a> + * @author Steinar Knutsen * @author bratseth * @since 5.1 */ public abstract class ThreadedHttpRequestHandler extends ThreadedRequestHandler { public static final String CONTENT_TYPE = "Content-Type"; - public static final String DATE = "Date"; + public static final String DATE = "Date"; // TODO: Remove on Vespa 7 private static final String RENDERING_ERRORS = "rendering_errors"; /** Logger for subclasses */ diff --git a/container-search/src/main/java/com/yahoo/prelude/statistics/StatisticsSearcher.java b/container-search/src/main/java/com/yahoo/prelude/statistics/StatisticsSearcher.java index d43fed4845f..1327e69f82f 100644 --- a/container-search/src/main/java/com/yahoo/prelude/statistics/StatisticsSearcher.java +++ b/container-search/src/main/java/com/yahoo/prelude/statistics/StatisticsSearcher.java @@ -179,9 +179,8 @@ public class StatisticsSearcher extends Searcher { if (latency >= 0) { addLatency(latency, metricContext); } else { - getLogger().log( - LogLevel.WARNING, - "Apparently negative latency measure, start: " + start + getLogger().log(LogLevel.WARNING, + "Apparently negative latency measure, start: " + start + ", end: " + end + ", for query: " + query.toString()); } if (result.hits().getError() != null) { @@ -238,7 +237,7 @@ public class StatisticsSearcher extends Searcher { if (result.hits().getErrorHit().hasOnlyErrorCode(Error.NULL_QUERY.code)) { nullQueries.increment(); return; - } else if (result.hits().getErrorHit().hasOnlyErrorCode(3)) { + } else if (result.hits().getErrorHit().hasOnlyErrorCode(Error.ILLEGAL_QUERY.code)) { illegalQueries.increment(); return; } diff --git a/documentapi/src/main/java/com/yahoo/documentapi/messagebus/protocol/StoragePolicy.java b/documentapi/src/main/java/com/yahoo/documentapi/messagebus/protocol/StoragePolicy.java index ae554b8b0c3..809d10e80e9 100644 --- a/documentapi/src/main/java/com/yahoo/documentapi/messagebus/protocol/StoragePolicy.java +++ b/documentapi/src/main/java/com/yahoo/documentapi/messagebus/protocol/StoragePolicy.java @@ -32,7 +32,7 @@ import java.util.logging.Logger; * slobrokconfigid=[id] (Optional, use given config id for slobrok instead of default) * clusterconfigid=[id] (Optional, use given config id for distribution instead of default) * - * @author <a href="mailto:humbe@yahoo-inc.com">Haakon Humberset</a> + * @author Haakon Humberset */ public class StoragePolicy extends ExternalSlobrokPolicy { @@ -293,7 +293,7 @@ public class StoragePolicy extends ExternalSlobrokPolicy { } catch (Distribution.TooFewBucketBitsInUseException e) { Reply reply = new WrongDistributionReply(cachedClusterState.toString(true)); reply.addError(new Error(DocumentProtocol.ERROR_WRONG_DISTRIBUTION, - "Too few distribution bits used for given cluster state")); + "Too few distribution bits used for given cluster state")); context.setReply(reply); return null; } catch (Distribution.NoDistributorsAvailableException e) { |