Browse Source

AMBARI-19714. Perf: start/stop all actions works much slower after few days of testing.(vbrodetskyi)

Vitaly Brodetskyi 8 years ago
parent
commit
dd8848deb3

+ 15 - 8
ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java

@@ -18,6 +18,7 @@
 
 package org.apache.ambari.server.controller;
 
+import javax.persistence.RollbackException;
 import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.AMBARI_DB_RCA_DRIVER;
 import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.AMBARI_DB_RCA_PASSWORD;
 import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.AMBARI_DB_RCA_URL;
@@ -64,8 +65,6 @@ import java.util.Set;
 import java.util.TreeMap;
 import java.util.concurrent.TimeUnit;
 
-import javax.persistence.RollbackException;
-
 import org.apache.ambari.server.AmbariException;
 import org.apache.ambari.server.ClusterNotFoundException;
 import org.apache.ambari.server.DuplicateResourceException;
@@ -2186,7 +2185,9 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
                                 RoleCommand roleCommand,
                                 Map<String, String> commandParamsInp,
                                 ServiceComponentHostEvent event,
-                                boolean skipFailure
+                                boolean skipFailure,
+                                ClusterVersionEntity effectiveClusterVersion,
+                                boolean isUpgradeSuspended
                                 )
                                 throws AmbariException {
 
@@ -2302,7 +2303,6 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
         commandParams.put(MAX_DURATION_OF_RETRIES, Integer.toString(retryMaxTime));
         commandParams.put(COMMAND_RETRY_ENABLED, Boolean.toString(retryEnabled));
 
-        ClusterVersionEntity effectiveClusterVersion = cluster.getEffectiveClusterVersion();
         if (effectiveClusterVersion != null) {
          commandParams.put(VERSION, effectiveClusterVersion.getRepositoryVersion().getVersion());
         }
@@ -2360,7 +2360,6 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
     // in the context of an upgrade and we should send the repo ID which matches
     // the version being send down
     RepositoryVersionEntity repoVersion = null;
-    ClusterVersionEntity effectiveClusterVersion = cluster.getEffectiveClusterVersion();
     if (null != effectiveClusterVersion) {
       repoVersion = effectiveClusterVersion.getRepositoryVersion();
     } else {
@@ -2426,7 +2425,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
     // !!! consistent with where custom commands put variables
     // !!! after-INSTALL hook checks this such that the stack selection tool won't
     // select-all to a version that is not being upgraded, breaking RU
-    if (cluster.isUpgradeSuspended()) {
+    if (isUpgradeSuspended) {
       cluster.addSuspendedUpgradeParameters(commandParams, roleParams);
     }
 
@@ -2561,6 +2560,12 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
       return requestStages;
     }
 
+    // caching effective cluster version
+    ClusterVersionEntity effectiveClusterVersion = cluster.getEffectiveClusterVersion();
+
+    // caching upgrade suspended
+    boolean isUpgradeSuspended = cluster.isUpgradeSuspended();
+
     // smoke test any service that goes from installed to started
     Set<String> smokeTestServices = getServicesForSmokeTests(cluster,
       changedServices, changedScHosts, runSmokeTest);
@@ -2893,7 +2898,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
               scHost.setState(State.INSTALLED);
             } else {
               createHostAction(cluster, stage, scHost, configurations, configurationAttributes, configTags,
-                roleCommand, requestParameters, event, skipFailure);
+                roleCommand, requestParameters, event, skipFailure, effectiveClusterVersion, isUpgradeSuspended);
             }
 
           }
@@ -3029,8 +3034,10 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
         configurationAttributes =
         new TreeMap<>();
 
+    ClusterVersionEntity effectiveClusterVersion = cluster.getEffectiveClusterVersion();
+    boolean isUpgradeSuspended = cluster.isUpgradeSuspended();
     createHostAction(cluster, stage, scHost, configurations, configurationAttributes, configTags,
-                     roleCommand, null, null, false);
+                     roleCommand, null, null, false, effectiveClusterVersion, isUpgradeSuspended);
     ExecutionCommand ec = stage.getExecutionCommands().get(scHost.getHostName()).get(0).getExecutionCommand();
 
     // createHostAction does not take a hostLevelParams but creates one

+ 2 - 2
contrib/utils/perf/deploy-gce-perf-cluster.py

@@ -280,13 +280,13 @@ def create_vms(args, number_of_nodes):
   :param number_of_nodes: Number of VMs to request.
   """
   print "Creating server VM {0}-server-{1} with xxlarge nodes on centos6...".format(cluster_prefix, args.cluster_suffix)
-  execute_command(args, args.controller, "/usr/sbin/gce up {0}-server-{1} 1 --centos6 --xxlarge --ex --disk-xxlarge".format(cluster_prefix, args.cluster_suffix),
+  execute_command(args, args.controller, "/usr/sbin/gce up {0}-server-{1} 1 --centos6 --xxlarge --ex --disk-xxlarge --ssd".format(cluster_prefix, args.cluster_suffix),
                   "Failed to create server, probably not enough resources!", "-tt")
   time.sleep(10)
 
   # trying to create cluster with needed params
   print "Creating agent VMs {0}-agent-{1} with {2} xlarge nodes on centos6...".format(cluster_prefix, args.cluster_suffix, str(number_of_nodes))
-  execute_command(args, args.controller, "/usr/sbin/gce up {0}-agent-{1} {2} --centos6 --xlarge --ex --disk-large".format(cluster_prefix, args.cluster_suffix, str(number_of_nodes)),
+  execute_command(args, args.controller, "/usr/sbin/gce up {0}-agent-{1} {2} --centos6 --xlarge --ex --disk-xlarge".format(cluster_prefix, args.cluster_suffix, str(number_of_nodes)),
                   "Failed to create cluster VMs, probably not enough resources!", "-tt")
 
   # VMs are not accessible immediately