diff options
author | Harald Musum <musum@verizonmedia.com> | 2020-03-29 12:40:00 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-29 12:40:00 +0200 |
commit | 49bbb07870e221e6c38b2b7955985c5f3f5518ed (patch) | |
tree | f1cfc1b00447e4dd512d8ecf39082133ccf02791 | |
parent | 44e2be1ea393b7556ab59e7f77a757d8d25be546 (diff) | |
parent | 9109a39de0048098fc45ecf3910ac9eaaa87459b (diff) |
Merge pull request #12752 from vespa-engine/hmusum/set-warmup-duration-based-on-zone
Set warmup duration based on zone
-rw-r--r-- | node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentImpl.java | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentImpl.java b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentImpl.java index c4966b69acb..9c8b0ec2b86 100644 --- a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentImpl.java +++ b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentImpl.java @@ -53,7 +53,7 @@ public class NodeAgentImpl implements NodeAgent { // Container is started with uncapped CPU and is kept that way until the first successful health check + this duration // Subtract 1 second to avoid warmup coming in lockstep with tick time and always end up using an extra tick when there are just a few ms left - private static final Duration DEFAULT_WARM_UP_DURATION = Duration.ofMinutes(1).minus(Duration.ofSeconds(1)); + private static final Duration DEFAULT_WARM_UP_DURATION = Duration.ofSeconds(90).minus(Duration.ofSeconds(1)); private static final Logger logger = Logger.getLogger(NodeAgentImpl.class.getName()); @@ -104,7 +104,7 @@ public class NodeAgentImpl implements NodeAgent { FlagSource flagSource, Optional<CredentialsMaintainer> credentialsMaintainer, Optional<AclMaintainer> aclMaintainer, Optional<HealthChecker> healthChecker, Clock clock) { this(contextSupplier, nodeRepository, orchestrator, dockerOperations, storageMaintainer, flagSource, credentialsMaintainer, - aclMaintainer, healthChecker, clock, DEFAULT_WARM_UP_DURATION); + aclMaintainer, healthChecker, clock, DEFAULT_WARM_UP_DURATION); } public NodeAgentImpl(NodeAgentContextSupplier contextSupplier, NodeRepository nodeRepository, @@ -212,7 +212,7 @@ public class NodeAgentImpl implements NodeAgent { private Container startContainer(NodeAgentContext context) { ContainerData containerData = createContainerData(context); - ContainerResources wantedResources = context.nodeType() != NodeType.tenant || warmUpDuration.isNegative() ? + ContainerResources wantedResources = context.nodeType() != NodeType.tenant || warmUpDuration(context.zone()).isNegative() ? getContainerResources(context) : getContainerResources(context).withUnlimitedCpus(); dockerOperations.createContainer(context, containerData, wantedResources); dockerOperations.startContainer(context); @@ -358,7 +358,7 @@ public class NodeAgentImpl implements NodeAgent { ContainerResources wantedContainerResources = getContainerResources(context); if (healthChecker.isPresent() && firstSuccessfulHealthCheckInstant - .map(clock.instant().minus(warmUpDuration)::isBefore) + .map(clock.instant().minus(warmUpDuration(context.zone()))::isBefore) .orElse(true)) return existingContainer; @@ -474,7 +474,7 @@ public class NodeAgentImpl implements NodeAgent { if (firstSuccessfulHealthCheckInstant.isEmpty()) firstSuccessfulHealthCheckInstant = Optional.of(clock.instant()); - Duration timeLeft = Duration.between(clock.instant(), firstSuccessfulHealthCheckInstant.get().plus(warmUpDuration)); + Duration timeLeft = Duration.between(clock.instant(), firstSuccessfulHealthCheckInstant.get().plus(warmUpDuration(context.zone()))); if (!container.get().resources.equalsCpu(getContainerResources(context))) throw new ConvergenceException("Refusing to resume until warm up period ends (" + (timeLeft.isNegative() ? "next tick" : "in " + timeLeft) + ")"); @@ -605,4 +605,10 @@ public class NodeAgentImpl implements NodeAgent { protected Optional<CredentialsMaintainer> credentialsMaintainer() { return credentialsMaintainer; } + + private Duration warmUpDuration(ZoneApi zone) { + return zone.getSystemName().isCd() || zone.getEnvironment().isTest() + ? Duration.ofSeconds(-1) + : warmUpDuration; + } } |