Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -216,5 +216,14 @@ public void launch() {
// no-op
}
}

@Override
public boolean isRunning() {
if (Boolean.TRUE.equals(entity.getConfig(USE_SSH_MONITORING))) {
return super.isRunning();
} else {
return true;
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,8 @@ protected ManagementContext setUpPlatform() {
// Create management node
persistenceDir = Files.createTempDir();
launcher = BrooklynLauncher.newInstance()
.persistMode(PersistMode.CLEAN)
.highAvailabilityMode(HighAvailabilityMode.MASTER)
.persistMode(doPersistence() ? PersistMode.CLEAN : PersistMode.DISABLED)
.highAvailabilityMode(doPersistence() ? HighAvailabilityMode.MASTER : HighAvailabilityMode.DISABLED)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think for a flag, a field would be cleaner than a method to override

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

due to how tests are structured and annotated methods run by the framework, methods for this sort of thing are easier to work with i find. happy if you want to spike an alternative with fields but i doubt it's better.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, didn't think of the complexity due to the framework and annotation. Your solution works so let's go with that, we can iterate on it later on

.persistenceDir(persistenceDir)
.start();

Expand All @@ -171,6 +171,10 @@ protected ManagementContext setUpPlatform() {

return launcher.getServerDetails().getManagementContext();
}

protected boolean doPersistence() {
return true;
}

@Override
protected void tearDownPlatform() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.brooklyn.qa.load;

import org.apache.brooklyn.entity.software.base.VanillaSoftwareProcess;
import org.apache.brooklyn.util.time.Duration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.testng.annotations.Test;

import com.google.common.base.Predicates;
import com.google.common.base.Stopwatch;

public class LoadWithoutPersistenceTest extends AbstractLoadTest {

private static final Logger log = LoggerFactory.getLogger(LoadWithoutPersistenceTest.class);

@Override
protected boolean doPersistence() {
return false;
}

/**
* Creates many SSH simulated external monitor apps, to ensure resource usage not extreme.
*
* Long-term target is 2500 VMs under management.
* Until we reach that point, we can partition the load across multiple (separate) brooklyn management nodes.
*/
@Test(groups="Acceptance")
public void testManyAppsExternallyMonitored() throws Exception {
// TODO Getting ssh error ("Server closed connection during identification exchange")
// with only two cycles (i.e. 20 entities).
//
// The ssh activity is from `SoftwareProcessImpl.waitForEntityStart`, which calls
// `VanillaSoftwareProcessSshDriver.isRunning`.
final int TOTAL_APPS = 500; // target is 2500 VMs; each blueprint has 2 VanillaSoftwareProcess
final int NUM_APPS_PER_BATCH = 10;
Stopwatch startTime = Stopwatch.createStarted();
super.runLocalhostManyApps(new TestConfig(this)
.execSshOnStart(false) // getting ssh errors otherwise!
.useSshMonitoring(false) // getting ssh errors otherwise!
.simulateExternalMonitor(Predicates.instanceOf(VanillaSoftwareProcess.class), 5, Duration.ONE_SECOND)
.clusterSize(5)
.totalApps(TOTAL_APPS, NUM_APPS_PER_BATCH)
.sleepBetweenBatch(Duration.seconds(0)));
log.info("Created "+TOTAL_APPS+" apps in "+Duration.of(startTime));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public class PrefixAndIdEnricher extends AbstractEnricher {
public static final ConfigKey<String> PREFIX = ConfigKeys.newStringConfigKey(
"prefixandid.prefix", "Sets SENSOR to prefix+entity id");

@SuppressWarnings("serial")
public static final ConfigKey<AttributeSensor<?>> MONITOR = ConfigKeys.newConfigKey(new TypeToken<AttributeSensor<?>>() {},
"prefixandid.attributetomonitor", "Changes on this sensor are monitored and the prefix/id republished");

Expand All @@ -52,6 +53,7 @@ public void onEvent(SensorEvent<Object> event) {
entity.sensors().set(SENSOR, getConfig(PREFIX) + entity.getId());
}
});
highlightTriggers(getConfig(MONITOR), null);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,16 @@
import org.apache.brooklyn.core.entity.trait.Startable;
import org.apache.brooklyn.entity.group.AbstractMembershipTrackingPolicy;
import org.apache.brooklyn.entity.group.DynamicClusterImpl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.google.common.collect.ImmutableList;
import com.google.common.collect.Iterables;

public class MongoDBRouterClusterImpl extends DynamicClusterImpl implements MongoDBRouterCluster {

private static final Logger log = LoggerFactory.getLogger(MongoDBRouterClusterImpl.class);

@Override
public void init() {
super.init();
Expand All @@ -56,12 +60,17 @@ public void start(Collection<? extends Location> locations) {

public static class MemberTrackingPolicy extends AbstractMembershipTrackingPolicy {
@Override protected void onEntityEvent(EventType type, Entity member) {
defaultHighlightAction(type, entity);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not needed as this policy extends AbstractMembershipTrackingPolicy and onEntityEvent already call defaultHighlightAction

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this method overrides that method and doesn't call super so it has to redo it here, doesn't it?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Meh, you're right, I didn't see the missing super call for some reason.

((MongoDBRouterClusterImpl)super.entity).setAnyRouter();
}
@Override protected void onEntityRemoved(Entity member) {
// TODO shouldn't be invoked - remove
log.warn("Removal handler should be hidden by event handler", new Throwable("Trace for unexpected mongo node handler"));
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure I understand what this is for: is this an error per se? Looks like a removal is handled correctly so why the warn message? Can you give a bit more details ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

more a note to developer (it caught me out) - due to the onEntityEvent handler being overridden this method is not used

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That make sense now, as onEntityEvent does not call super

((MongoDBRouterClusterImpl)super.entity).setAnyRouter();
}
@Override protected void onEntityChange(Entity member) {
// TODO shouldn't be invoked - remove
log.warn("Change handler should be hidden by event handler", new Throwable("Trace for unexpected mongo node handler"));
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

((MongoDBRouterClusterImpl)super.entity).setAnyRouter();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ protected void endTracker() {
public static class MemberTrackingPolicy extends AbstractMembershipTrackingPolicy {
@Override
protected void onEntityEvent(EventType type, Entity entity) {
defaultHighlightAction(type, entity);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not needed as this policy extends AbstractMembershipTrackingPolicy and onEntityEvent already call defaultHighlightAction

((AbstractGeoDnsServiceImpl)super.entity).refreshGroupMembership();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ protected void removeServerPoolMemberTrackingPolicy() {
public static class ServerPoolMemberTrackerPolicy extends AbstractMembershipTrackingPolicy {
@Override
protected void onEntityEvent(EventType type, Entity entity) {
defaultHighlightAction(type, entity);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

// relies on policy-rebind injecting the implementation rather than the dynamic-proxy
((AbstractControllerImpl)super.entity).onServerPoolMemberChanged(entity);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
import com.google.common.collect.Iterables;
import com.google.common.collect.Maps;

/** For use by downstream load-balancers. */
public abstract class AbstractNonProvisionedControllerImpl extends AbstractEntity implements AbstractNonProvisionedController {

private static final Logger LOG = LoggerFactory.getLogger(AbstractNonProvisionedControllerImpl.class);
Expand All @@ -66,6 +67,7 @@ public AbstractNonProvisionedControllerImpl() {

public static class MemberTrackingPolicy extends AbstractMembershipTrackingPolicy {
@Override protected void onEntityEvent(EventType type, Entity member) {
defaultHighlightAction(type, entity);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

((AbstractNonProvisionedControllerImpl)super.entity).onServerPoolMemberChanged(member);
}
}
Expand Down Expand Up @@ -216,6 +218,7 @@ protected void removeServerPoolMemberTrackingPolicy() {
public static class ServerPoolMemberTrackerPolicy extends AbstractMembershipTrackingPolicy {
@Override
protected void onEntityEvent(EventType type, Entity entity) {
defaultHighlightAction(type, entity);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

// relies on policy-rebind injecting the implementation rather than the dynamic-proxy
((AbstractNonProvisionedControllerImpl)super.entity).onServerPoolMemberChanged(entity);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ protected void removeUrlMappingsMemberTrackerPolicy() {
public static class UrlMappingsMemberTrackerPolicy extends AbstractMembershipTrackingPolicy {
@Override
protected void onEntityEvent(EventType type, Entity entity) {
defaultHighlightAction(type, entity);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

// relies on policy-rebind injecting the implementation rather than the dynamic-proxy
((NginxControllerImpl)super.entity).updateNeeded();
}
Expand Down