-
Notifications
You must be signed in to change notification settings - Fork 34
Highlights and load #126
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Highlights and load #126
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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 |
|---|---|---|
|
|
@@ -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(); | ||
|
|
@@ -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); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not needed as this policy extends
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this method overrides that method and doesn't call
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Meh, you're right, I didn't see the missing |
||
| ((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")); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 ?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. more a note to developer (it caught me out) - due to the
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That make sense now, as |
||
| ((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")); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above |
||
| ((MongoDBRouterClusterImpl)super.entity).setAnyRouter(); | ||
| } | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -180,6 +180,7 @@ protected void endTracker() { | |
| public static class MemberTrackingPolicy extends AbstractMembershipTrackingPolicy { | ||
| @Override | ||
| protected void onEntityEvent(EventType type, Entity entity) { | ||
| defaultHighlightAction(type, entity); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not needed as this policy extends |
||
| ((AbstractGeoDnsServiceImpl)super.entity).refreshGroupMembership(); | ||
| } | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -154,6 +154,7 @@ protected void removeServerPoolMemberTrackingPolicy() { | |
| public static class ServerPoolMemberTrackerPolicy extends AbstractMembershipTrackingPolicy { | ||
| @Override | ||
| protected void onEntityEvent(EventType type, Entity entity) { | ||
| defaultHighlightAction(type, entity); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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); | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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); | ||
|
|
@@ -66,6 +67,7 @@ public AbstractNonProvisionedControllerImpl() { | |
|
|
||
| public static class MemberTrackingPolicy extends AbstractMembershipTrackingPolicy { | ||
| @Override protected void onEntityEvent(EventType type, Entity member) { | ||
| defaultHighlightAction(type, entity); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above |
||
| ((AbstractNonProvisionedControllerImpl)super.entity).onServerPoolMemberChanged(member); | ||
| } | ||
| } | ||
|
|
@@ -216,6 +218,7 @@ protected void removeServerPoolMemberTrackingPolicy() { | |
| public static class ServerPoolMemberTrackerPolicy extends AbstractMembershipTrackingPolicy { | ||
| @Override | ||
| protected void onEntityEvent(EventType type, Entity entity) { | ||
| defaultHighlightAction(type, entity); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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); | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -178,6 +178,7 @@ protected void removeUrlMappingsMemberTrackerPolicy() { | |
| public static class UrlMappingsMemberTrackerPolicy extends AbstractMembershipTrackingPolicy { | ||
| @Override | ||
| protected void onEntityEvent(EventType type, Entity entity) { | ||
| defaultHighlightAction(type, entity); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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(); | ||
| } | ||
|
|
||
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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