From 6ba749f7fd3da8e6a4794d04a2dabe5dc8b49437 Mon Sep 17 00:00:00 2001 From: zkofiro Date: Wed, 15 Nov 2023 18:42:02 -0800 Subject: [PATCH 1/6] introducing <1 user/ramp rate + user sets ramp rate per agent, not job --- .../intuit/tank/harness/APITestHarness.java | 53 +++++++------------ .../com/intuit/tank/harness/AgentRunData.java | 6 +-- .../intuit/tank/harness/TestPlanStarter.java | 16 +++--- .../tank/harness/APITestHarnessTest.java | 2 +- .../intuit/tank/harness/AgentRunDataTest.java | 2 +- .../vm/agent/messages/AgentTestStartData.java | 6 +-- .../agent/messages/WatsAgentStartRequest.java | 4 +- .../intuit/tank/vm/vmManager/JobRequest.java | 4 +- .../tank/vm/vmManager/JobRequestImpl.java | 14 ++--- .../messages/AgentTestStartDataCpTest.java | 4 +- .../messages/WatsAgentStartRequestCpTest.java | 4 +- .../vm/vmManager/JobRequestImplCpTest.java | 2 +- .../java/com/intuit/tank/project/BaseJob.java | 6 +-- .../com/intuit/tank/project/BaseJobTest.java | 2 +- .../mvc/rest/models/projects/ProjectTO.java | 6 +-- .../mvc/rest/util/JobDetailFormatter.java | 5 +- .../java/com/intuit/tank/ProjectBean.java | 4 +- .../tank/project/JobDetailFormatter.java | 11 ++-- .../com/intuit/tank/project/JobMaker.java | 3 -- .../intuit/tank/project/UsersAndTimes.java | 4 +- .../main/webapp/projects/projectview.xhtml | 11 ++-- 21 files changed, 77 insertions(+), 92 deletions(-) diff --git a/agent/apiharness/src/main/java/com/intuit/tank/harness/APITestHarness.java b/agent/apiharness/src/main/java/com/intuit/tank/harness/APITestHarness.java index 35edb17a3..b7b3d6cba 100644 --- a/agent/apiharness/src/main/java/com/intuit/tank/harness/APITestHarness.java +++ b/agent/apiharness/src/main/java/com/intuit/tank/harness/APITestHarness.java @@ -24,7 +24,6 @@ import java.util.concurrent.Semaphore; import com.google.common.collect.ImmutableMap; -import com.intuit.tank.harness.logging.LogEvent; import com.intuit.tank.http.TankHttpClient; import com.intuit.tank.vm.api.enumerated.*; import org.apache.commons.io.FileUtils; @@ -714,8 +713,8 @@ public void checkAgentThreads() { } if (hasMetSimulationTime()) { // && doneSignal.getCount() != 0) { if(agentRunData.getIncrementStrategy().equals(IncrementStrategy.increasing)) { - LOG.info(LogUtil.getLogMessage("Max simulation time has been met and there are " - + doneSignal.getCount() + " threads not reporting done.")); + LOG.info(LogUtil.getLogMessage("Linear - Max simulation time has been met and there are " + + doneSignal.getCount() + " threads not reporting done, interrupting remaining threads.")); for (Thread t : sessionThreads) { if (t.isAlive()) { LOG.warn(LogUtil.getLogMessage("thread " + t.getName() + '-' + t.getId() @@ -724,16 +723,6 @@ public void checkAgentThreads() { doneSignal.countDown(); } } - } else { - LOG.info(LogUtil.getLogMessage("Max simulation time has been met and there are " - + semaphore.availablePermits() + " threads not reporting done.")); - for (Thread t : sessionThreads) { - if (t.isAlive()) { - LOG.warn(LogUtil.getLogMessage("thread " + t.getName() + '-' + t.getId() - + " is still running with a State of " + t.getState().name(), LogEventType.System)); - t.interrupt(); - } - } } } // Clean up TestPlanRunner Threads that are Thread.State.TERMINATED @@ -741,28 +730,26 @@ public void checkAgentThreads() { } private void configureNonlinearAgentRunData(){ - double baseDelay = (((double) agentRunData.getRampTimeMillis() / 1000) / (endRampRate)); - int order = agentRunData.getAgentInstanceNum(); - int numAgents = agentRunData.getTotalAgents(); - - // Calculate the target ramp rate and remaining ramp time for each agent - int baseRampRate = (int) (endRampRate / numAgents); - int remainingRampRate = (int) (endRampRate % numAgents); + agentRunData.setTargetRampRate(endRampRate); // same ramp rate set for each agent - total ramp rate determined by number of agents - int targetRampRate = baseRampRate; - if(order <= remainingRampRate){ - targetRampRate += 1; + if(endRampRate < 1){ // if ramp rate < 1, ramp from 0 to ramp rate over ramp time + double rampTime = (double) agentRunData.getRampTimeMillis() / 1000; + agentRunData.setInitialDelay(rampTime); + agentRunData.setRampRateDelay(rampTime); + agentRunData.setBaseDelay(rampTime); + } else { + double baseDelay = (((double) agentRunData.getRampTimeMillis() / 1000) / (endRampRate * agentRunData.getTotalAgents())); + int order = agentRunData.getAgentInstanceNum(); + + agentRunData.setInitialDelay(order * baseDelay); // order: order # * baseDelay + agentRunData.setRampRateDelay((((double) agentRunData.getRampTimeMillis() / 1000) / (endRampRate))); // rampRateDelay: total ramp time / targetRampRate + agentRunData.setBaseDelay(baseDelay); // baseDelay: total ramp time / endRampRate - used to ramp agents from 0 to 1 user/sec + LOG.info(new ObjectMessage(ImmutableMap.of("Message", "Non-Linear Multi-agent Orchestration: \n" + + "agentOrder=" + order + "; \n" + + "initialDelay=" + agentRunData.getInitialDelay() + "; \n" + + "rampRateDelay=" + agentRunData.getRampRateDelay() + "; \n" + + "agentTargetRampRate=" + agentRunData.getTargetRampRate()))); } - - agentRunData.setInitialDelay(order * baseDelay); // order: order # * baseDelay - agentRunData.setRampRateDelay((((double) agentRunData.getRampTimeMillis() / 1000) / (targetRampRate))); // rampRateDelay: total ramp time / targetRampRate - agentRunData.setTargetRampRate(targetRampRate); // targetRampRate: endRampRate / # of agents while accounting for uneven division - agentRunData.setBaseDelay(baseDelay); // baseDelay: total ramp time / endRampRate - used to ramp agents from 0 to 1 user/sec - LOG.info(new ObjectMessage(ImmutableMap.of("Message", "Non-Linear Multi-agent Orchestration: \n" + - "agentOrder=" + order + "; \n" + - "initialDelay=" + agentRunData.getInitialDelay() + "; \n" + - "rampRateDelay=" + agentRunData.getRampRateDelay() + "; \n" + - "agentTargetRampRate=" + agentRunData.getTargetRampRate()))); } /** diff --git a/agent/apiharness/src/main/java/com/intuit/tank/harness/AgentRunData.java b/agent/apiharness/src/main/java/com/intuit/tank/harness/AgentRunData.java index 60ae50fbf..cb8ccf085 100644 --- a/agent/apiharness/src/main/java/com/intuit/tank/harness/AgentRunData.java +++ b/agent/apiharness/src/main/java/com/intuit/tank/harness/AgentRunData.java @@ -29,7 +29,7 @@ public class AgentRunData { private long rampTime = 0; private IncrementStrategy incrementStrategy = IncrementStrategy.increasing; private int numStartUsers = 1; - private int userInterval = 1; + private double userInterval = 1.0; private double baseDelay = 0; private double initialDelay = 0; private double rampRateDelay = 0; @@ -123,7 +123,7 @@ public void setTankhttpClientClass(String tankhttpClientClass) { /** * @return the userInterval */ - public int getUserInterval() { + public double getUserInterval() { return userInterval; } @@ -131,7 +131,7 @@ public int getUserInterval() { * @param userInterval * the userInterval to set */ - public void setUserInterval(int userInterval) { + public void setUserInterval(double userInterval) { if (userInterval > 0) { this.userInterval = userInterval; } diff --git a/agent/apiharness/src/main/java/com/intuit/tank/harness/TestPlanStarter.java b/agent/apiharness/src/main/java/com/intuit/tank/harness/TestPlanStarter.java index 48a9f7e39..4417ff340 100644 --- a/agent/apiharness/src/main/java/com/intuit/tank/harness/TestPlanStarter.java +++ b/agent/apiharness/src/main/java/com/intuit/tank/harness/TestPlanStarter.java @@ -60,7 +60,7 @@ public class TestPlanStarter implements Runnable { private int sessionStarts = 0; private int totalTps = 0; private final long rampDelay; - private int currentRampRate; + private double currentRampRate; private boolean done = false; public TestPlanStarter(Object httpClient, HDTestPlan plan, int numThreads, String tankHttpClientClass, ThreadGroup threadGroup, AgentRunData agentRunData) { @@ -176,7 +176,11 @@ public void run() { } intialDelay(); // initial delay - currentRampRate++; // after delay, start ramp rate at 1 user/sec + if(agentRunData.getTargetRampRate() < 1.0){ + currentRampRate = agentRunData.getTargetRampRate(); // after delay, start and keep ramp rate at < 1 user/sec value + } else { + currentRampRate++; // after delay, start ramp rate at 1 user/sec + } long lastRampRateAddition = (long) (System.currentTimeMillis() - (agentRunData.getBaseDelay() * 1000)); double agentTimer = ((System.currentTimeMillis() - lastRampRateAddition)) / 1000.0; // start agent timer at base delay @@ -262,7 +266,7 @@ public void run() { sendCloudWatchMetrics(activeCount); // send metrics every 30 seconds try { - Thread.sleep(1000 / currentRampRate); // sleep between adding users proportional to current ramp rate + Thread.sleep((long) (1000 / currentRampRate)); // sleep between adding users proportional to current ramp rate } catch (InterruptedException e) { LOG.error(LogUtil.getLogMessage("Error trying to wait for ramp", LogEventType.System), e); } @@ -360,9 +364,9 @@ private void intialDelay() { private long calcRampTime() { int ramp = (numThreads - agentRunData.getNumStartUsers()); if (ramp > 0) { - return (agentRunData.getRampTimeMillis() * - agentRunData.getUserInterval()) - / ramp; + return (long) ((agentRunData.getRampTimeMillis() * + agentRunData.getUserInterval()) + / ramp); } else if (agentRunData.getRampTimeMillis() > 0) { LOG.info(LogUtil.getLogMessage("Linear - No Ramp - " + rampDelay, LogEventType.System)); } diff --git a/agent/apiharness/src/test/java/com/intuit/tank/harness/APITestHarnessTest.java b/agent/apiharness/src/test/java/com/intuit/tank/harness/APITestHarnessTest.java index 090ea3ed8..f1a85f974 100644 --- a/agent/apiharness/src/test/java/com/intuit/tank/harness/APITestHarnessTest.java +++ b/agent/apiharness/src/test/java/com/intuit/tank/harness/APITestHarnessTest.java @@ -176,7 +176,7 @@ public void testConfigureNonlinearAgentRunData() { MockFlowController controller = new MockFlowController(); instance.setFlowControllerTemplate(controller); - instance.setEndRampRate(10); + instance.setEndRampRate(1); instance.getAgentRunData().setAgentInstanceNum(1); instance.getAgentRunData().setTotalAgents(10); instance.getAgentRunData().setRampTimeMillis(500); diff --git a/agent/apiharness/src/test/java/com/intuit/tank/harness/AgentRunDataTest.java b/agent/apiharness/src/test/java/com/intuit/tank/harness/AgentRunDataTest.java index 813af7e79..81d889953 100644 --- a/agent/apiharness/src/test/java/com/intuit/tank/harness/AgentRunDataTest.java +++ b/agent/apiharness/src/test/java/com/intuit/tank/harness/AgentRunDataTest.java @@ -528,7 +528,7 @@ public void testGetUserInterval_1() fixture.setInstanceId(""); fixture.setTestPlans(""); - int result = fixture.getUserInterval(); + double result = fixture.getUserInterval(); // An unexpected exception was thrown in user code while executing this test: // java.lang.NoClassDefFoundError: Could not initialize class com.intuit.tank.harness.AgentRunData diff --git a/api/src/main/java/com/intuit/tank/vm/agent/messages/AgentTestStartData.java b/api/src/main/java/com/intuit/tank/vm/agent/messages/AgentTestStartData.java index 59fc72ee3..64795eaf3 100644 --- a/api/src/main/java/com/intuit/tank/vm/agent/messages/AgentTestStartData.java +++ b/api/src/main/java/com/intuit/tank/vm/agent/messages/AgentTestStartData.java @@ -65,7 +65,7 @@ public class AgentTestStartData implements Serializable { private IncrementStrategy incrementStrategy = IncrementStrategy.increasing; @XmlElement(name = "userIntervalIncrement", namespace = Namespace.NAMESPACE_V1, required = true, nillable = false) - private int userIntervalIncrement; + private double userIntervalIncrement; @XmlElement(name = "agentInstanceNum", namespace = Namespace.NAMESPACE_V1, required = true, nillable = false) private int agentInstanceNum; @@ -184,11 +184,11 @@ public IncrementStrategy getIncrementStrategy() { return incrementStrategy; } - public void setUserIntervalIncrement(int userIntervalIncrement) { + public void setUserIntervalIncrement(double userIntervalIncrement) { this.userIntervalIncrement = userIntervalIncrement; } - public int getUserIntervalIncrement() { + public double getUserIntervalIncrement() { return userIntervalIncrement > 0 ? userIntervalIncrement : 1; } diff --git a/api/src/main/java/com/intuit/tank/vm/agent/messages/WatsAgentStartRequest.java b/api/src/main/java/com/intuit/tank/vm/agent/messages/WatsAgentStartRequest.java index 9bf06ef8f..623624944 100644 --- a/api/src/main/java/com/intuit/tank/vm/agent/messages/WatsAgentStartRequest.java +++ b/api/src/main/java/com/intuit/tank/vm/agent/messages/WatsAgentStartRequest.java @@ -59,7 +59,7 @@ public class WatsAgentStartRequest implements Serializable { private int startUsers; @XmlElement(name = "userIntervalIncrement", namespace = Namespace.NAMESPACE_V1, required = true, nillable = false) - private int userIntervalIncrement; + private double userIntervalIncrement; @XmlElement(name = "agentInstanceNum", namespace = Namespace.NAMESPACE_V1, required = true, nillable = false) private int agentInstanceNum; @@ -154,7 +154,7 @@ public void setUserIntervalIncrement(int userIntervalIncrement) { this.userIntervalIncrement = userIntervalIncrement; } - public int getUserIntervalIncrement() { + public double getUserIntervalIncrement() { return userIntervalIncrement > 0 ? userIntervalIncrement : 1; } diff --git a/api/src/main/java/com/intuit/tank/vm/vmManager/JobRequest.java b/api/src/main/java/com/intuit/tank/vm/vmManager/JobRequest.java index 4f08db016..33d61b41a 100644 --- a/api/src/main/java/com/intuit/tank/vm/vmManager/JobRequest.java +++ b/api/src/main/java/com/intuit/tank/vm/vmManager/JobRequest.java @@ -55,7 +55,7 @@ public interface JobRequest extends Serializable { /** * @return the endRate */ - public abstract int getEndRate(); + public abstract double getEndRate(); /** * @return the numAgents @@ -96,7 +96,7 @@ public interface JobRequest extends Serializable { /** * @return the userIntervalIncrement */ - public abstract int getUserIntervalIncrement(); + public abstract double getUserIntervalIncrement(); /** * @return the reportingMode diff --git a/api/src/main/java/com/intuit/tank/vm/vmManager/JobRequestImpl.java b/api/src/main/java/com/intuit/tank/vm/vmManager/JobRequestImpl.java index 82e1d4b03..e77d447c9 100644 --- a/api/src/main/java/com/intuit/tank/vm/vmManager/JobRequestImpl.java +++ b/api/src/main/java/com/intuit/tank/vm/vmManager/JobRequestImpl.java @@ -50,7 +50,7 @@ public final class JobRequestImpl implements Serializable, JobRequest { private int baselineVirtualUsers; private long simulationTime; private boolean useEips; - private int userIntervalIncrement; + private double userIntervalIncrement; private String reportingMode = TankConstants.RESULTS_NONE; private String loggingProfile = LoggingProfile.STANDARD.name(); private String stopBehavior = StopBehavior.END_OF_SCRIPT_GROUP.name(); @@ -62,7 +62,7 @@ public final class JobRequestImpl implements Serializable, JobRequest { private int numUsersPerAgent; private int numAgents; private int startRate; - private int endRate; + private double endRate; private String scriptsXmlUrl; public static Builder builder() { @@ -154,7 +154,7 @@ public long getSimulationTime() { * {@inheritDoc} */ @Override - public int getUserIntervalIncrement() { + public double getUserIntervalIncrement() { return userIntervalIncrement > 0 ? userIntervalIncrement : 1; } @@ -236,7 +236,7 @@ public void setStartRate(int startRate) { /** * @return the endRate */ - public int getEndRate() { + public double getEndRate() { return endRate; } @@ -244,7 +244,7 @@ public int getEndRate() { * @param endRate * the endRate to set */ - public void setEndRate(int endRate) { + public void setEndRate(double endRate) { this.endRate = endRate; } @@ -410,7 +410,7 @@ public GeneratorT withStartRate(int aValue) { return (GeneratorT) this; } - public GeneratorT withEndRate(int aValue) { + public GeneratorT withEndRate(double aValue) { instance.endRate= aValue; return (GeneratorT) this; } @@ -464,7 +464,7 @@ public GeneratorT withSimulationTime(long aValue) { } @SuppressWarnings("unchecked") - public GeneratorT withUserIntervalIncrement(int aValue) { + public GeneratorT withUserIntervalIncrement(double aValue) { instance.userIntervalIncrement = aValue; return (GeneratorT) this; } diff --git a/api/src/test/java/com/intuit/tank/vm/agent/messages/AgentTestStartDataCpTest.java b/api/src/test/java/com/intuit/tank/vm/agent/messages/AgentTestStartDataCpTest.java index a62bb337f..33a62d6db 100644 --- a/api/src/test/java/com/intuit/tank/vm/agent/messages/AgentTestStartDataCpTest.java +++ b/api/src/test/java/com/intuit/tank/vm/agent/messages/AgentTestStartDataCpTest.java @@ -349,7 +349,7 @@ public void testGetUserIntervalIncrement_1() fixture.setStartUsers(1); fixture.setSimulationTime(1L); - int result = fixture.getUserIntervalIncrement(); + double result = fixture.getUserIntervalIncrement(); assertEquals(1, result); } @@ -373,7 +373,7 @@ public void testGetUserIntervalIncrement_2() fixture.setStartUsers(1); fixture.setSimulationTime(1L); - int result = fixture.getUserIntervalIncrement(); + double result = fixture.getUserIntervalIncrement(); assertEquals(1, result); } diff --git a/api/src/test/java/com/intuit/tank/vm/agent/messages/WatsAgentStartRequestCpTest.java b/api/src/test/java/com/intuit/tank/vm/agent/messages/WatsAgentStartRequestCpTest.java index 10c9c9425..be4058960 100644 --- a/api/src/test/java/com/intuit/tank/vm/agent/messages/WatsAgentStartRequestCpTest.java +++ b/api/src/test/java/com/intuit/tank/vm/agent/messages/WatsAgentStartRequestCpTest.java @@ -313,7 +313,7 @@ public void testGetUserIntervalIncrement_1() fixture.setSimulationTime(1L); fixture.setJobId(""); - int result = fixture.getUserIntervalIncrement(); + double result = fixture.getUserIntervalIncrement(); assertEquals(1, result); } @@ -336,7 +336,7 @@ public void testGetUserIntervalIncrement_2() fixture.setSimulationTime(1L); fixture.setJobId(""); - int result = fixture.getUserIntervalIncrement(); + double result = fixture.getUserIntervalIncrement(); assertEquals(1, result); } diff --git a/api/src/test/java/com/intuit/tank/vm/vmManager/JobRequestImplCpTest.java b/api/src/test/java/com/intuit/tank/vm/vmManager/JobRequestImplCpTest.java index a5a007522..44e2587e0 100644 --- a/api/src/test/java/com/intuit/tank/vm/vmManager/JobRequestImplCpTest.java +++ b/api/src/test/java/com/intuit/tank/vm/vmManager/JobRequestImplCpTest.java @@ -172,7 +172,7 @@ public void testToString() { .append("simulationTime", request.getSimulationTime()) .append("useEips", request.isUseEips()) .append("baselineVirtualUsers", request.getBaselineVirtualUsers()) - .append("userIntervalIncrement", "0") + .append("userIntervalIncrement", "0.0") .append("reportingMode", request.getReportingMode()) .append("regions", request.getRegions()) .toString(); diff --git a/data_model/src/main/java/com/intuit/tank/project/BaseJob.java b/data_model/src/main/java/com/intuit/tank/project/BaseJob.java index 0c26e3247..0c1c1119d 100644 --- a/data_model/src/main/java/com/intuit/tank/project/BaseJob.java +++ b/data_model/src/main/java/com/intuit/tank/project/BaseJob.java @@ -93,7 +93,7 @@ public abstract class BaseJob extends BaseEntity { private String simulationTimeExpression; @Column(name = "user_interval_increment_seconds") - private int userIntervalIncrement; + private double userIntervalIncrement; @Column(name = "reporting_mode", nullable = false) private String reportingMode = TankConstants.RESULTS_NONE; @@ -422,7 +422,7 @@ public void setExecutionTime(Long executionTime) { /** * @return the userIntervalIncrement */ - public int getUserIntervalIncrement() { + public double getUserIntervalIncrement() { return userIntervalIncrement; } @@ -430,7 +430,7 @@ public int getUserIntervalIncrement() { * @param userIntervalIncrement * the userIntervalIncrement to set */ - public void setUserIntervalIncrement(int userIntervalIncrement) { + public void setUserIntervalIncrement(double userIntervalIncrement) { this.userIntervalIncrement = userIntervalIncrement; } diff --git a/data_model/src/test/java/com/intuit/tank/project/BaseJobTest.java b/data_model/src/test/java/com/intuit/tank/project/BaseJobTest.java index 164ad6162..d0a048812 100644 --- a/data_model/src/test/java/com/intuit/tank/project/BaseJobTest.java +++ b/data_model/src/test/java/com/intuit/tank/project/BaseJobTest.java @@ -295,7 +295,7 @@ public void testGetUserIntervalIncrement_1() throws Exception { BaseJob fixture = new JobConfiguration(); - int result = fixture.getUserIntervalIncrement(); + double result = fixture.getUserIntervalIncrement(); assertEquals(0, result); } diff --git a/rest-mvc/src/main/java/com/intuit/tank/rest/mvc/rest/models/projects/ProjectTO.java b/rest-mvc/src/main/java/com/intuit/tank/rest/mvc/rest/models/projects/ProjectTO.java index 09e82d676..e3c9582ce 100644 --- a/rest-mvc/src/main/java/com/intuit/tank/rest/mvc/rest/models/projects/ProjectTO.java +++ b/rest-mvc/src/main/java/com/intuit/tank/rest/mvc/rest/models/projects/ProjectTO.java @@ -73,7 +73,7 @@ public class ProjectTO implements Serializable { private Long simulationTime; @XmlElement(name = "userIntervalIncrement", namespace = Namespace.NAMESPACE_V1, required = false, nillable = false) - private int userIntervalIncrement; + private double userIntervalIncrement; @XmlElement(name = "jobRegions", namespace = Namespace.NAMESPACE_V1, required = false, nillable = false) private Set jobRegions = new HashSet<>(); @@ -214,7 +214,7 @@ public Long getSimulationTime() { /** * @return the userIntervalIncrement */ - public int getUserIntervalIncrement() { + public double getUserIntervalIncrement() { return userIntervalIncrement; } @@ -280,7 +280,7 @@ public void setSimulationTime(Long simulationTime) { * @param userIntervalIncrement * the userIntervalIncrement to set */ - public void setUserIntervalIncrement(int userIntervalIncrement) { + public void setUserIntervalIncrement(double userIntervalIncrement) { this.userIntervalIncrement = userIntervalIncrement; } diff --git a/rest-mvc/src/main/java/com/intuit/tank/rest/mvc/rest/util/JobDetailFormatter.java b/rest-mvc/src/main/java/com/intuit/tank/rest/mvc/rest/util/JobDetailFormatter.java index a0d1c74a7..dd4908013 100644 --- a/rest-mvc/src/main/java/com/intuit/tank/rest/mvc/rest/util/JobDetailFormatter.java +++ b/rest-mvc/src/main/java/com/intuit/tank/rest/mvc/rest/util/JobDetailFormatter.java @@ -106,11 +106,12 @@ protected static String buildDetails(JobValidator validator, Workload workload, addProperty(sb, "Ramp Time", TimeUtil.toTimeString(proposedJobInstance.getRampTime())); if(proposedJobInstance.getIncrementStrategy().equals(IncrementStrategy.standard)){ // addProperty(sb, "Starting User Ramp (users/sec)", Integer.toString(proposedJobInstance.getStartRate())); - addProperty(sb, "Target User Ramp Rate (users/sec)", Integer.toString(proposedJobInstance.getUserIntervalIncrement())); + addProperty(sb, "Agent User Ramp Rate (users/sec)", Double.toString(proposedJobInstance.getUserIntervalIncrement())); + addProperty(sb, "Total User Ramp Rate (users/sec)", Double.toString(proposedJobInstance.getUserIntervalIncrement() * proposedJobInstance.getNumAgents())); } addProperty(sb, "Initial Users", Integer.toString(proposedJobInstance.getBaselineVirtualUsers())); if(proposedJobInstance.getIncrementStrategy().equals(IncrementStrategy.increasing)) { - addProperty(sb, "User Increment", Integer.toString(proposedJobInstance.getUserIntervalIncrement())); + addProperty(sb, "User Increment", Double.toString(proposedJobInstance.getUserIntervalIncrement())); } // users and regions sb.append(BREAK); diff --git a/web/web_support/src/main/java/com/intuit/tank/ProjectBean.java b/web/web_support/src/main/java/com/intuit/tank/ProjectBean.java index 00e2e0b7e..5945e8ab2 100644 --- a/web/web_support/src/main/java/com/intuit/tank/ProjectBean.java +++ b/web/web_support/src/main/java/com/intuit/tank/ProjectBean.java @@ -240,7 +240,7 @@ public void setWorkloadType(String workloadType) { /** * @return the end rate for job */ - public int getEndRate() { + public double getEndRate() { return getWorkload().getJobConfiguration().getUserIntervalIncrement(); } @@ -249,7 +249,7 @@ public int getEndRate() { * * @param endRate */ - public void setEndRate(int endRate) { + public void setEndRate(double endRate) { Workload workload = getWorkload(); workload.getJobConfiguration().setUserIntervalIncrement(endRate); } diff --git a/web/web_support/src/main/java/com/intuit/tank/project/JobDetailFormatter.java b/web/web_support/src/main/java/com/intuit/tank/project/JobDetailFormatter.java index 90784c90b..13a841129 100644 --- a/web/web_support/src/main/java/com/intuit/tank/project/JobDetailFormatter.java +++ b/web/web_support/src/main/java/com/intuit/tank/project/JobDetailFormatter.java @@ -125,11 +125,12 @@ protected static String buildDetails(JobValidator validator, Workload workload, addProperty(sb, "Ramp Time", TimeUtil.toTimeString(proposedJobInstance.getRampTime())); if(proposedJobInstance.getIncrementStrategy().equals(IncrementStrategy.standard)){ // addProperty(sb, "Starting User Ramp (users/sec)", Integer.toString(proposedJobInstance.getStartRate())); - addProperty(sb, "Target User Ramp Rate (users/sec)", Integer.toString(proposedJobInstance.getUserIntervalIncrement())); + addProperty(sb, "Agent User Ramp Rate (users/sec)", Double.toString(proposedJobInstance.getUserIntervalIncrement())); + addProperty(sb, "Total User Ramp Rate (users/sec)", Double.toString(proposedJobInstance.getUserIntervalIncrement() * proposedJobInstance.getNumAgents())); } addProperty(sb, "Initial Users", Integer.toString(proposedJobInstance.getBaselineVirtualUsers())); if(proposedJobInstance.getIncrementStrategy().equals(IncrementStrategy.increasing)) { - addProperty(sb, "User Increment", Integer.toString(proposedJobInstance.getUserIntervalIncrement())); + addProperty(sb, "User Increment", Double.toString(proposedJobInstance.getUserIntervalIncrement())); } // users and regions sb.append(BREAK); @@ -169,12 +170,6 @@ protected static String buildDetails(JobValidator validator, Workload workload, addError(errorSB, "Region Percentage does not add up to 100%"); } - if(proposedJobInstance.getNumAgents() > proposedJobInstance.getUserIntervalIncrement() - && proposedJobInstance.getIncrementStrategy().equals(IncrementStrategy.standard)) { - addError(errorSB, "Number of Agents cannot be greater than the Target User Ramp Rate" - + "- update Target User Ramp Rate or set Number of Agents equal to or less than " + proposedJobInstance.getUserIntervalIncrement() + " agents"); - } - } sb.append(BREAK); sb.append(BREAK); diff --git a/web/web_support/src/main/java/com/intuit/tank/project/JobMaker.java b/web/web_support/src/main/java/com/intuit/tank/project/JobMaker.java index 94f13405d..a912569c9 100644 --- a/web/web_support/src/main/java/com/intuit/tank/project/JobMaker.java +++ b/web/web_support/src/main/java/com/intuit/tank/project/JobMaker.java @@ -437,9 +437,6 @@ public boolean isValid() { if (regionPercentage != 100) { return false; } - if(proposedJobInstance.getNumAgents() > proposedJobInstance.getUserIntervalIncrement()) { - return false; - } } return hasScripts(); } diff --git a/web/web_support/src/main/java/com/intuit/tank/project/UsersAndTimes.java b/web/web_support/src/main/java/com/intuit/tank/project/UsersAndTimes.java index 7b3b5c218..a50f0dda5 100644 --- a/web/web_support/src/main/java/com/intuit/tank/project/UsersAndTimes.java +++ b/web/web_support/src/main/java/com/intuit/tank/project/UsersAndTimes.java @@ -399,7 +399,7 @@ public String getUserIncrement() { */ public void setUserIncrement(String startUsers) { if (NumberUtils.isCreatable(startUsers)) { - projectBean.getJobConfiguration().setUserIntervalIncrement(Integer.parseInt(startUsers)); + projectBean.getJobConfiguration().setUserIntervalIncrement(Double.parseDouble(startUsers)); } this.userIncrement = startUsers; } @@ -441,7 +441,7 @@ public String getEndRate() { */ public void setEndRate(String endRate) { if(this.getIncrementStrategy().equals(IncrementStrategy.standard)) { - projectBean.getJobConfiguration().setUserIntervalIncrement(Integer.parseInt(endRate)); + projectBean.getJobConfiguration().setUserIntervalIncrement(Double.parseDouble(endRate)); } this.targetRampRate = endRate; } diff --git a/web/web_ui/src/main/webapp/projects/projectview.xhtml b/web/web_ui/src/main/webapp/projects/projectview.xhtml index d855eba41..d28dd4cb1 100644 --- a/web/web_ui/src/main/webapp/projects/projectview.xhtml +++ b/web/web_ui/src/main/webapp/projects/projectview.xhtml @@ -123,7 +123,7 @@
- +
@@ -131,14 +131,15 @@ - + requiredMessage="Agent User Ramp Rate cannot be empty." rendered="#{usersAndTimes.incrementStrategy == 'standard'}"> + + text="Agent User Ramp Rate dictates the ending ramp rate in users/sec set for each agent for the nonlinear user ramp. This + will inject users at regular intervals from the starting rate of 0 users/sec to the target rate for the provided ramp duration. + The Total User Ramp Rate of the job is determined by the Agent User Ramp Rate times the Number of Agents i.e 1 user/sec * 10 agents = 10 users/sec" rendered="#{usersAndTimes.incrementStrategy == 'standard'}" />
From 8db40bb780580cddd2044dce0e9579b9ae1335f9 Mon Sep 17 00:00:00 2001 From: zkofiro Date: Thu, 16 Nov 2023 11:19:14 -0800 Subject: [PATCH 2/6] add target ramp rate to db to stop using user interval field --- .../intuit/tank/harness/APITestHarness.java | 11 ++++---- .../com/intuit/tank/harness/AgentRunData.java | 6 ++--- .../intuit/tank/harness/TestPlanStarter.java | 8 +++--- .../intuit/tank/harness/AgentRunDataTest.java | 2 +- .../vm/agent/messages/AgentTestStartData.java | 6 ++--- .../agent/messages/WatsAgentStartRequest.java | 4 +-- .../intuit/tank/vm/vmManager/JobRequest.java | 4 +-- .../tank/vm/vmManager/JobRequestImpl.java | 14 +++++----- .../messages/AgentTestStartDataCpTest.java | 4 +-- .../messages/WatsAgentStartRequestCpTest.java | 4 +-- .../vm/vmManager/JobRequestImplCpTest.java | 2 +- .../java/com/intuit/tank/project/BaseJob.java | 26 ++++++++++++++++--- .../com/intuit/tank/project/BaseJobTest.java | 2 +- .../java/com/intuit/tank/ProjectBean.java | 4 +-- .../com/intuit/tank/job/ActJobNodeBean.java | 2 +- .../intuit/tank/project/UsersAndTimes.java | 4 +-- .../main/webapp/projects/projectview.xhtml | 4 +-- 17 files changed, 64 insertions(+), 43 deletions(-) diff --git a/agent/apiharness/src/main/java/com/intuit/tank/harness/APITestHarness.java b/agent/apiharness/src/main/java/com/intuit/tank/harness/APITestHarness.java index b7b3d6cba..da9576ef7 100644 --- a/agent/apiharness/src/main/java/com/intuit/tank/harness/APITestHarness.java +++ b/agent/apiharness/src/main/java/com/intuit/tank/harness/APITestHarness.java @@ -744,12 +744,13 @@ private void configureNonlinearAgentRunData(){ agentRunData.setInitialDelay(order * baseDelay); // order: order # * baseDelay agentRunData.setRampRateDelay((((double) agentRunData.getRampTimeMillis() / 1000) / (endRampRate))); // rampRateDelay: total ramp time / targetRampRate agentRunData.setBaseDelay(baseDelay); // baseDelay: total ramp time / endRampRate - used to ramp agents from 0 to 1 user/sec - LOG.info(new ObjectMessage(ImmutableMap.of("Message", "Non-Linear Multi-agent Orchestration: \n" + - "agentOrder=" + order + "; \n" + - "initialDelay=" + agentRunData.getInitialDelay() + "; \n" + - "rampRateDelay=" + agentRunData.getRampRateDelay() + "; \n" + - "agentTargetRampRate=" + agentRunData.getTargetRampRate()))); } + + LOG.info(new ObjectMessage(ImmutableMap.of("Message", "Non-Linear Multi-agent Orchestration: \n" + + "agentOrder=" + agentRunData.getAgentInstanceNum() + "; \n" + + "initialDelay=" + agentRunData.getInitialDelay() + "; \n" + + "rampRateDelay=" + agentRunData.getRampRateDelay() + "; \n" + + "agentTargetRampRate=" + agentRunData.getTargetRampRate()))); } /** diff --git a/agent/apiharness/src/main/java/com/intuit/tank/harness/AgentRunData.java b/agent/apiharness/src/main/java/com/intuit/tank/harness/AgentRunData.java index cb8ccf085..60ae50fbf 100644 --- a/agent/apiharness/src/main/java/com/intuit/tank/harness/AgentRunData.java +++ b/agent/apiharness/src/main/java/com/intuit/tank/harness/AgentRunData.java @@ -29,7 +29,7 @@ public class AgentRunData { private long rampTime = 0; private IncrementStrategy incrementStrategy = IncrementStrategy.increasing; private int numStartUsers = 1; - private double userInterval = 1.0; + private int userInterval = 1; private double baseDelay = 0; private double initialDelay = 0; private double rampRateDelay = 0; @@ -123,7 +123,7 @@ public void setTankhttpClientClass(String tankhttpClientClass) { /** * @return the userInterval */ - public double getUserInterval() { + public int getUserInterval() { return userInterval; } @@ -131,7 +131,7 @@ public double getUserInterval() { * @param userInterval * the userInterval to set */ - public void setUserInterval(double userInterval) { + public void setUserInterval(int userInterval) { if (userInterval > 0) { this.userInterval = userInterval; } diff --git a/agent/apiharness/src/main/java/com/intuit/tank/harness/TestPlanStarter.java b/agent/apiharness/src/main/java/com/intuit/tank/harness/TestPlanStarter.java index 4417ff340..96b2e0a54 100644 --- a/agent/apiharness/src/main/java/com/intuit/tank/harness/TestPlanStarter.java +++ b/agent/apiharness/src/main/java/com/intuit/tank/harness/TestPlanStarter.java @@ -364,9 +364,9 @@ private void intialDelay() { private long calcRampTime() { int ramp = (numThreads - agentRunData.getNumStartUsers()); if (ramp > 0) { - return (long) ((agentRunData.getRampTimeMillis() * - agentRunData.getUserInterval()) - / ramp); + return (agentRunData.getRampTimeMillis() * + agentRunData.getUserInterval()) + / ramp; } else if (agentRunData.getRampTimeMillis() > 0) { LOG.info(LogUtil.getLogMessage("Linear - No Ramp - " + rampDelay, LogEventType.System)); } @@ -422,7 +422,7 @@ private void sendCloudWatchMetrics(long activeCount) { datumList.add(MetricDatum.builder() .metricName("userRampRate") .unit(StandardUnit.COUNT) - .value((double) this.currentRampRate) + .value(this.currentRampRate) .timestamp(timestamp) .dimensions(testPlan, instanceId, jobId) .build()); diff --git a/agent/apiharness/src/test/java/com/intuit/tank/harness/AgentRunDataTest.java b/agent/apiharness/src/test/java/com/intuit/tank/harness/AgentRunDataTest.java index 81d889953..813af7e79 100644 --- a/agent/apiharness/src/test/java/com/intuit/tank/harness/AgentRunDataTest.java +++ b/agent/apiharness/src/test/java/com/intuit/tank/harness/AgentRunDataTest.java @@ -528,7 +528,7 @@ public void testGetUserInterval_1() fixture.setInstanceId(""); fixture.setTestPlans(""); - double result = fixture.getUserInterval(); + int result = fixture.getUserInterval(); // An unexpected exception was thrown in user code while executing this test: // java.lang.NoClassDefFoundError: Could not initialize class com.intuit.tank.harness.AgentRunData diff --git a/api/src/main/java/com/intuit/tank/vm/agent/messages/AgentTestStartData.java b/api/src/main/java/com/intuit/tank/vm/agent/messages/AgentTestStartData.java index 64795eaf3..59fc72ee3 100644 --- a/api/src/main/java/com/intuit/tank/vm/agent/messages/AgentTestStartData.java +++ b/api/src/main/java/com/intuit/tank/vm/agent/messages/AgentTestStartData.java @@ -65,7 +65,7 @@ public class AgentTestStartData implements Serializable { private IncrementStrategy incrementStrategy = IncrementStrategy.increasing; @XmlElement(name = "userIntervalIncrement", namespace = Namespace.NAMESPACE_V1, required = true, nillable = false) - private double userIntervalIncrement; + private int userIntervalIncrement; @XmlElement(name = "agentInstanceNum", namespace = Namespace.NAMESPACE_V1, required = true, nillable = false) private int agentInstanceNum; @@ -184,11 +184,11 @@ public IncrementStrategy getIncrementStrategy() { return incrementStrategy; } - public void setUserIntervalIncrement(double userIntervalIncrement) { + public void setUserIntervalIncrement(int userIntervalIncrement) { this.userIntervalIncrement = userIntervalIncrement; } - public double getUserIntervalIncrement() { + public int getUserIntervalIncrement() { return userIntervalIncrement > 0 ? userIntervalIncrement : 1; } diff --git a/api/src/main/java/com/intuit/tank/vm/agent/messages/WatsAgentStartRequest.java b/api/src/main/java/com/intuit/tank/vm/agent/messages/WatsAgentStartRequest.java index 623624944..9bf06ef8f 100644 --- a/api/src/main/java/com/intuit/tank/vm/agent/messages/WatsAgentStartRequest.java +++ b/api/src/main/java/com/intuit/tank/vm/agent/messages/WatsAgentStartRequest.java @@ -59,7 +59,7 @@ public class WatsAgentStartRequest implements Serializable { private int startUsers; @XmlElement(name = "userIntervalIncrement", namespace = Namespace.NAMESPACE_V1, required = true, nillable = false) - private double userIntervalIncrement; + private int userIntervalIncrement; @XmlElement(name = "agentInstanceNum", namespace = Namespace.NAMESPACE_V1, required = true, nillable = false) private int agentInstanceNum; @@ -154,7 +154,7 @@ public void setUserIntervalIncrement(int userIntervalIncrement) { this.userIntervalIncrement = userIntervalIncrement; } - public double getUserIntervalIncrement() { + public int getUserIntervalIncrement() { return userIntervalIncrement > 0 ? userIntervalIncrement : 1; } diff --git a/api/src/main/java/com/intuit/tank/vm/vmManager/JobRequest.java b/api/src/main/java/com/intuit/tank/vm/vmManager/JobRequest.java index 33d61b41a..4f08db016 100644 --- a/api/src/main/java/com/intuit/tank/vm/vmManager/JobRequest.java +++ b/api/src/main/java/com/intuit/tank/vm/vmManager/JobRequest.java @@ -55,7 +55,7 @@ public interface JobRequest extends Serializable { /** * @return the endRate */ - public abstract double getEndRate(); + public abstract int getEndRate(); /** * @return the numAgents @@ -96,7 +96,7 @@ public interface JobRequest extends Serializable { /** * @return the userIntervalIncrement */ - public abstract double getUserIntervalIncrement(); + public abstract int getUserIntervalIncrement(); /** * @return the reportingMode diff --git a/api/src/main/java/com/intuit/tank/vm/vmManager/JobRequestImpl.java b/api/src/main/java/com/intuit/tank/vm/vmManager/JobRequestImpl.java index e77d447c9..82e1d4b03 100644 --- a/api/src/main/java/com/intuit/tank/vm/vmManager/JobRequestImpl.java +++ b/api/src/main/java/com/intuit/tank/vm/vmManager/JobRequestImpl.java @@ -50,7 +50,7 @@ public final class JobRequestImpl implements Serializable, JobRequest { private int baselineVirtualUsers; private long simulationTime; private boolean useEips; - private double userIntervalIncrement; + private int userIntervalIncrement; private String reportingMode = TankConstants.RESULTS_NONE; private String loggingProfile = LoggingProfile.STANDARD.name(); private String stopBehavior = StopBehavior.END_OF_SCRIPT_GROUP.name(); @@ -62,7 +62,7 @@ public final class JobRequestImpl implements Serializable, JobRequest { private int numUsersPerAgent; private int numAgents; private int startRate; - private double endRate; + private int endRate; private String scriptsXmlUrl; public static Builder builder() { @@ -154,7 +154,7 @@ public long getSimulationTime() { * {@inheritDoc} */ @Override - public double getUserIntervalIncrement() { + public int getUserIntervalIncrement() { return userIntervalIncrement > 0 ? userIntervalIncrement : 1; } @@ -236,7 +236,7 @@ public void setStartRate(int startRate) { /** * @return the endRate */ - public double getEndRate() { + public int getEndRate() { return endRate; } @@ -244,7 +244,7 @@ public double getEndRate() { * @param endRate * the endRate to set */ - public void setEndRate(double endRate) { + public void setEndRate(int endRate) { this.endRate = endRate; } @@ -410,7 +410,7 @@ public GeneratorT withStartRate(int aValue) { return (GeneratorT) this; } - public GeneratorT withEndRate(double aValue) { + public GeneratorT withEndRate(int aValue) { instance.endRate= aValue; return (GeneratorT) this; } @@ -464,7 +464,7 @@ public GeneratorT withSimulationTime(long aValue) { } @SuppressWarnings("unchecked") - public GeneratorT withUserIntervalIncrement(double aValue) { + public GeneratorT withUserIntervalIncrement(int aValue) { instance.userIntervalIncrement = aValue; return (GeneratorT) this; } diff --git a/api/src/test/java/com/intuit/tank/vm/agent/messages/AgentTestStartDataCpTest.java b/api/src/test/java/com/intuit/tank/vm/agent/messages/AgentTestStartDataCpTest.java index 33a62d6db..a62bb337f 100644 --- a/api/src/test/java/com/intuit/tank/vm/agent/messages/AgentTestStartDataCpTest.java +++ b/api/src/test/java/com/intuit/tank/vm/agent/messages/AgentTestStartDataCpTest.java @@ -349,7 +349,7 @@ public void testGetUserIntervalIncrement_1() fixture.setStartUsers(1); fixture.setSimulationTime(1L); - double result = fixture.getUserIntervalIncrement(); + int result = fixture.getUserIntervalIncrement(); assertEquals(1, result); } @@ -373,7 +373,7 @@ public void testGetUserIntervalIncrement_2() fixture.setStartUsers(1); fixture.setSimulationTime(1L); - double result = fixture.getUserIntervalIncrement(); + int result = fixture.getUserIntervalIncrement(); assertEquals(1, result); } diff --git a/api/src/test/java/com/intuit/tank/vm/agent/messages/WatsAgentStartRequestCpTest.java b/api/src/test/java/com/intuit/tank/vm/agent/messages/WatsAgentStartRequestCpTest.java index be4058960..10c9c9425 100644 --- a/api/src/test/java/com/intuit/tank/vm/agent/messages/WatsAgentStartRequestCpTest.java +++ b/api/src/test/java/com/intuit/tank/vm/agent/messages/WatsAgentStartRequestCpTest.java @@ -313,7 +313,7 @@ public void testGetUserIntervalIncrement_1() fixture.setSimulationTime(1L); fixture.setJobId(""); - double result = fixture.getUserIntervalIncrement(); + int result = fixture.getUserIntervalIncrement(); assertEquals(1, result); } @@ -336,7 +336,7 @@ public void testGetUserIntervalIncrement_2() fixture.setSimulationTime(1L); fixture.setJobId(""); - double result = fixture.getUserIntervalIncrement(); + int result = fixture.getUserIntervalIncrement(); assertEquals(1, result); } diff --git a/api/src/test/java/com/intuit/tank/vm/vmManager/JobRequestImplCpTest.java b/api/src/test/java/com/intuit/tank/vm/vmManager/JobRequestImplCpTest.java index 44e2587e0..a5a007522 100644 --- a/api/src/test/java/com/intuit/tank/vm/vmManager/JobRequestImplCpTest.java +++ b/api/src/test/java/com/intuit/tank/vm/vmManager/JobRequestImplCpTest.java @@ -172,7 +172,7 @@ public void testToString() { .append("simulationTime", request.getSimulationTime()) .append("useEips", request.isUseEips()) .append("baselineVirtualUsers", request.getBaselineVirtualUsers()) - .append("userIntervalIncrement", "0.0") + .append("userIntervalIncrement", "0") .append("reportingMode", request.getReportingMode()) .append("regions", request.getRegions()) .toString(); diff --git a/data_model/src/main/java/com/intuit/tank/project/BaseJob.java b/data_model/src/main/java/com/intuit/tank/project/BaseJob.java index 0c1c1119d..489e7d194 100644 --- a/data_model/src/main/java/com/intuit/tank/project/BaseJob.java +++ b/data_model/src/main/java/com/intuit/tank/project/BaseJob.java @@ -13,6 +13,7 @@ * #L% */ +import java.math.BigDecimal; import java.util.Map; import java.util.Set; @@ -93,7 +94,10 @@ public abstract class BaseJob extends BaseEntity { private String simulationTimeExpression; @Column(name = "user_interval_increment_seconds") - private double userIntervalIncrement; + private int userIntervalIncrement; + + @Column(name = "target_rate", precision = 4, scale = 3) // 0.001 to 1.000 + private BigDecimal targetRampRate; @Column(name = "reporting_mode", nullable = false) private String reportingMode = TankConstants.RESULTS_NONE; @@ -121,6 +125,7 @@ public BaseJob(BaseJob copy) { this.simulationTime = copy.simulationTime; this.terminationPolicy = copy.terminationPolicy; this.userIntervalIncrement = copy.userIntervalIncrement; + this.targetRampRate = copy.targetRampRate; this.location = copy.location; this.reportingMode = copy.reportingMode; this.allowOverride = copy.allowOverride; @@ -422,7 +427,7 @@ public void setExecutionTime(Long executionTime) { /** * @return the userIntervalIncrement */ - public double getUserIntervalIncrement() { + public int getUserIntervalIncrement() { return userIntervalIncrement; } @@ -430,8 +435,23 @@ public double getUserIntervalIncrement() { * @param userIntervalIncrement * the userIntervalIncrement to set */ - public void setUserIntervalIncrement(double userIntervalIncrement) { + public void setUserIntervalIncrement(int userIntervalIncrement) { this.userIntervalIncrement = userIntervalIncrement; } + /** + * @return the targetRampRate + */ + public BigDecimal getTargetRampRate() { + return targetRampRate; + } + + /** + * @param targetRampRate + * the targetRampRate to set + */ + public void setTargetRampRate(BigDecimal targetRampRate) { + this.targetRampRate = targetRampRate; + } + } \ No newline at end of file diff --git a/data_model/src/test/java/com/intuit/tank/project/BaseJobTest.java b/data_model/src/test/java/com/intuit/tank/project/BaseJobTest.java index d0a048812..164ad6162 100644 --- a/data_model/src/test/java/com/intuit/tank/project/BaseJobTest.java +++ b/data_model/src/test/java/com/intuit/tank/project/BaseJobTest.java @@ -295,7 +295,7 @@ public void testGetUserIntervalIncrement_1() throws Exception { BaseJob fixture = new JobConfiguration(); - double result = fixture.getUserIntervalIncrement(); + int result = fixture.getUserIntervalIncrement(); assertEquals(0, result); } diff --git a/web/web_support/src/main/java/com/intuit/tank/ProjectBean.java b/web/web_support/src/main/java/com/intuit/tank/ProjectBean.java index 5945e8ab2..00e2e0b7e 100644 --- a/web/web_support/src/main/java/com/intuit/tank/ProjectBean.java +++ b/web/web_support/src/main/java/com/intuit/tank/ProjectBean.java @@ -240,7 +240,7 @@ public void setWorkloadType(String workloadType) { /** * @return the end rate for job */ - public double getEndRate() { + public int getEndRate() { return getWorkload().getJobConfiguration().getUserIntervalIncrement(); } @@ -249,7 +249,7 @@ public double getEndRate() { * * @param endRate */ - public void setEndRate(double endRate) { + public void setEndRate(int endRate) { Workload workload = getWorkload(); workload.getJobConfiguration().setUserIntervalIncrement(endRate); } diff --git a/web/web_support/src/main/java/com/intuit/tank/job/ActJobNodeBean.java b/web/web_support/src/main/java/com/intuit/tank/job/ActJobNodeBean.java index acb4c7843..52e6aff87 100644 --- a/web/web_support/src/main/java/com/intuit/tank/job/ActJobNodeBean.java +++ b/web/web_support/src/main/java/com/intuit/tank/job/ActJobNodeBean.java @@ -40,7 +40,7 @@ public ActJobNodeBean(JobInstance job, boolean hasRights, FastDateFormat fmt) { this.setRegion(""); this.setActiveUsers(String.valueOf(job.getBaselineVirtualUsers())); this.setTotalUsers(String.valueOf(job.getTotalVirtualUsers())); - this.setTargetRampRate(String.valueOf(job.getUserIntervalIncrement())); + this.setTargetRampRate(String.valueOf(job.getUserIntervalIncrement() * job.getNumAgents())); this.jobDetails = job.getJobDetails(); this.setStartTime(job.getStartTime()); this.setEndTime(job.getEndTime()); diff --git a/web/web_support/src/main/java/com/intuit/tank/project/UsersAndTimes.java b/web/web_support/src/main/java/com/intuit/tank/project/UsersAndTimes.java index a50f0dda5..7b3b5c218 100644 --- a/web/web_support/src/main/java/com/intuit/tank/project/UsersAndTimes.java +++ b/web/web_support/src/main/java/com/intuit/tank/project/UsersAndTimes.java @@ -399,7 +399,7 @@ public String getUserIncrement() { */ public void setUserIncrement(String startUsers) { if (NumberUtils.isCreatable(startUsers)) { - projectBean.getJobConfiguration().setUserIntervalIncrement(Double.parseDouble(startUsers)); + projectBean.getJobConfiguration().setUserIntervalIncrement(Integer.parseInt(startUsers)); } this.userIncrement = startUsers; } @@ -441,7 +441,7 @@ public String getEndRate() { */ public void setEndRate(String endRate) { if(this.getIncrementStrategy().equals(IncrementStrategy.standard)) { - projectBean.getJobConfiguration().setUserIntervalIncrement(Double.parseDouble(endRate)); + projectBean.getJobConfiguration().setUserIntervalIncrement(Integer.parseInt(endRate)); } this.targetRampRate = endRate; } diff --git a/web/web_ui/src/main/webapp/projects/projectview.xhtml b/web/web_ui/src/main/webapp/projects/projectview.xhtml index d28dd4cb1..a30737c03 100644 --- a/web/web_ui/src/main/webapp/projects/projectview.xhtml +++ b/web/web_ui/src/main/webapp/projects/projectview.xhtml @@ -132,13 +132,13 @@ value="#{usersAndTimes.endRate}" styleClass="formInput inputWidthSmall" required="true" requiredMessage="Agent User Ramp Rate cannot be empty." rendered="#{usersAndTimes.incrementStrategy == 'standard'}"> - + From ab2eff6b77c42dcbe6a4985b2e8e42f2560adf6b Mon Sep 17 00:00:00 2001 From: zkofiro Date: Thu, 16 Nov 2023 11:23:51 -0800 Subject: [PATCH 3/6] formatting + reverting projectTO --- .../src/main/java/com/intuit/tank/project/BaseJob.java | 2 +- .../tank/rest/mvc/rest/models/projects/ProjectTO.java | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/data_model/src/main/java/com/intuit/tank/project/BaseJob.java b/data_model/src/main/java/com/intuit/tank/project/BaseJob.java index 489e7d194..530b8b13c 100644 --- a/data_model/src/main/java/com/intuit/tank/project/BaseJob.java +++ b/data_model/src/main/java/com/intuit/tank/project/BaseJob.java @@ -454,4 +454,4 @@ public void setTargetRampRate(BigDecimal targetRampRate) { this.targetRampRate = targetRampRate; } -} \ No newline at end of file +} diff --git a/rest-mvc/src/main/java/com/intuit/tank/rest/mvc/rest/models/projects/ProjectTO.java b/rest-mvc/src/main/java/com/intuit/tank/rest/mvc/rest/models/projects/ProjectTO.java index e3c9582ce..09e82d676 100644 --- a/rest-mvc/src/main/java/com/intuit/tank/rest/mvc/rest/models/projects/ProjectTO.java +++ b/rest-mvc/src/main/java/com/intuit/tank/rest/mvc/rest/models/projects/ProjectTO.java @@ -73,7 +73,7 @@ public class ProjectTO implements Serializable { private Long simulationTime; @XmlElement(name = "userIntervalIncrement", namespace = Namespace.NAMESPACE_V1, required = false, nillable = false) - private double userIntervalIncrement; + private int userIntervalIncrement; @XmlElement(name = "jobRegions", namespace = Namespace.NAMESPACE_V1, required = false, nillable = false) private Set jobRegions = new HashSet<>(); @@ -214,7 +214,7 @@ public Long getSimulationTime() { /** * @return the userIntervalIncrement */ - public double getUserIntervalIncrement() { + public int getUserIntervalIncrement() { return userIntervalIncrement; } @@ -280,7 +280,7 @@ public void setSimulationTime(Long simulationTime) { * @param userIntervalIncrement * the userIntervalIncrement to set */ - public void setUserIntervalIncrement(double userIntervalIncrement) { + public void setUserIntervalIncrement(int userIntervalIncrement) { this.userIntervalIncrement = userIntervalIncrement; } From 55211e66ed82a37f2e3c5e80846cd8f0794ab808 Mon Sep 17 00:00:00 2001 From: zkofiro Date: Thu, 16 Nov 2023 15:01:39 -0800 Subject: [PATCH 4/6] updated to use new target ramp rate field --- .../intuit/tank/harness/APITestHarness.java | 8 ++------ .../com/intuit/tank/harness/AgentRunData.java | 2 +- .../vm/agent/messages/AgentTestStartData.java | 20 +++++++++++++++++++ .../intuit/tank/vm/vmManager/JobRequest.java | 2 +- .../tank/vm/vmManager/JobRequestImpl.java | 9 +++++---- .../vm/vmManager/JobRequestImplCpTest.java | 1 + .../java/com/intuit/tank/project/BaseJob.java | 11 +++++----- .../mvc/rest/util/JobDetailFormatter.java | 15 ++++---------- .../perfManager/workLoads/JobManager.java | 3 ++- .../workLoads/WorkLoadFactory.java | 2 +- .../java/com/intuit/tank/ProjectBean.java | 8 ++++---- .../com/intuit/tank/job/ActJobNodeBean.java | 2 +- .../tank/project/JobDetailFormatter.java | 19 +++++++----------- .../intuit/tank/project/UsersAndTimes.java | 14 +++++-------- 14 files changed, 59 insertions(+), 57 deletions(-) diff --git a/agent/apiharness/src/main/java/com/intuit/tank/harness/APITestHarness.java b/agent/apiharness/src/main/java/com/intuit/tank/harness/APITestHarness.java index da9576ef7..af32a0a1b 100644 --- a/agent/apiharness/src/main/java/com/intuit/tank/harness/APITestHarness.java +++ b/agent/apiharness/src/main/java/com/intuit/tank/harness/APITestHarness.java @@ -310,13 +310,10 @@ private void startHttp(String baseUrl) { agentRunData.setSimulationTimeMillis(startData.getSimulationTime()); agentRunData.setAgentInstanceNum(startData.getAgentInstanceNum()); agentRunData.setTotalAgents(startData.getTotalAgents()); + agentRunData.setTargetRampRate(startData.getTargetRampRate()); // non-linear: same ramp rate set for each agent - total ramp rate determined by number of agents ThreadContext.put("workloadType", agentRunData.getIncrementStrategy().getDisplay()); - if(startData.getIncrementStrategy().equals(IncrementStrategy.standard)){ - endRampRate = agentRunData.getUserInterval(); - LOG.info(new ObjectMessage(ImmutableMap.of("Message", "Nonlinear - targetRampRate = " + endRampRate + " users/sec for job " + agentRunData.getJobId()))); - } if (startData.getDataFiles() != null) { for (DataFileRequest dfRequest : startData.getDataFiles()) { @@ -730,8 +727,7 @@ public void checkAgentThreads() { } private void configureNonlinearAgentRunData(){ - agentRunData.setTargetRampRate(endRampRate); // same ramp rate set for each agent - total ramp rate determined by number of agents - + // non-linear: configure agentRunData for non-linear ramping if(endRampRate < 1){ // if ramp rate < 1, ramp from 0 to ramp rate over ramp time double rampTime = (double) agentRunData.getRampTimeMillis() / 1000; agentRunData.setInitialDelay(rampTime); diff --git a/agent/apiharness/src/main/java/com/intuit/tank/harness/AgentRunData.java b/agent/apiharness/src/main/java/com/intuit/tank/harness/AgentRunData.java index 60ae50fbf..a4e0c0815 100644 --- a/agent/apiharness/src/main/java/com/intuit/tank/harness/AgentRunData.java +++ b/agent/apiharness/src/main/java/com/intuit/tank/harness/AgentRunData.java @@ -33,7 +33,7 @@ public class AgentRunData { private double baseDelay = 0; private double initialDelay = 0; private double rampRateDelay = 0; - private double targetRampRate = 1; + private double targetRampRate = 1.0; private String testPlans = ""; private String instanceId; private String jobId = "0"; diff --git a/api/src/main/java/com/intuit/tank/vm/agent/messages/AgentTestStartData.java b/api/src/main/java/com/intuit/tank/vm/agent/messages/AgentTestStartData.java index 59fc72ee3..c271b3470 100644 --- a/api/src/main/java/com/intuit/tank/vm/agent/messages/AgentTestStartData.java +++ b/api/src/main/java/com/intuit/tank/vm/agent/messages/AgentTestStartData.java @@ -36,6 +36,7 @@ "userIntervalIncrement", "agentInstanceNum", "totalAgents", + "targetRampRate", "scriptUrl", "dataFile" }) @@ -73,6 +74,9 @@ public class AgentTestStartData implements Serializable { @XmlElement(name = "totalAgents", namespace = Namespace.NAMESPACE_V1, required = true, nillable = false) private int totalAgents; + @XmlElement(name = "targetRampRate", namespace = Namespace.NAMESPACE_V1, required = true, nillable = false) + private double targetRampRate; + @XmlElement(name = "dataFile", namespace = Namespace.NAMESPACE_V1, required = true, nillable = false) private DataFileRequest[] dataFile; @@ -96,6 +100,7 @@ public AgentTestStartData(AgentTestStartData copy) { this.userIntervalIncrement = copy.userIntervalIncrement; this.agentInstanceNum = copy.agentInstanceNum; this.totalAgents = copy.totalAgents; + this.targetRampRate = copy.targetRampRate; } /** @@ -207,6 +212,21 @@ public void setTotalAgents(int totalAgents) { this.totalAgents = totalAgents; } + /** + * @return + */ + public double getTargetRampRate() { + return targetRampRate; + } + + /** + * @param targetRampRate + * the targetRampRate to set + */ + public void setTargetRampRate(double targetRampRate) { + this.targetRampRate = targetRampRate; + } + /** * {@inheritDoc} */ diff --git a/api/src/main/java/com/intuit/tank/vm/vmManager/JobRequest.java b/api/src/main/java/com/intuit/tank/vm/vmManager/JobRequest.java index 4f08db016..2b58fa5ed 100644 --- a/api/src/main/java/com/intuit/tank/vm/vmManager/JobRequest.java +++ b/api/src/main/java/com/intuit/tank/vm/vmManager/JobRequest.java @@ -55,7 +55,7 @@ public interface JobRequest extends Serializable { /** * @return the endRate */ - public abstract int getEndRate(); + public abstract double getEndRate(); /** * @return the numAgents diff --git a/api/src/main/java/com/intuit/tank/vm/vmManager/JobRequestImpl.java b/api/src/main/java/com/intuit/tank/vm/vmManager/JobRequestImpl.java index 82e1d4b03..9f99982ba 100644 --- a/api/src/main/java/com/intuit/tank/vm/vmManager/JobRequestImpl.java +++ b/api/src/main/java/com/intuit/tank/vm/vmManager/JobRequestImpl.java @@ -62,7 +62,7 @@ public final class JobRequestImpl implements Serializable, JobRequest { private int numUsersPerAgent; private int numAgents; private int startRate; - private int endRate; + private double endRate; private String scriptsXmlUrl; public static Builder builder() { @@ -236,7 +236,7 @@ public void setStartRate(int startRate) { /** * @return the endRate */ - public int getEndRate() { + public double getEndRate() { return endRate; } @@ -244,7 +244,7 @@ public int getEndRate() { * @param endRate * the endRate to set */ - public void setEndRate(int endRate) { + public void setEndRate(double endRate) { this.endRate = endRate; } @@ -312,6 +312,7 @@ public String toString() { .append("useEips", useEips) .append("baselineVirtualUsers", baselineVirtualUsers) .append("userIntervalIncrement", userIntervalIncrement) + .append("endRate", endRate) .append("reportingMode", reportingMode) .append("regions", regions) .toString(); @@ -410,7 +411,7 @@ public GeneratorT withStartRate(int aValue) { return (GeneratorT) this; } - public GeneratorT withEndRate(int aValue) { + public GeneratorT withEndRate(double aValue) { instance.endRate= aValue; return (GeneratorT) this; } diff --git a/api/src/test/java/com/intuit/tank/vm/vmManager/JobRequestImplCpTest.java b/api/src/test/java/com/intuit/tank/vm/vmManager/JobRequestImplCpTest.java index a5a007522..2273d04d9 100644 --- a/api/src/test/java/com/intuit/tank/vm/vmManager/JobRequestImplCpTest.java +++ b/api/src/test/java/com/intuit/tank/vm/vmManager/JobRequestImplCpTest.java @@ -173,6 +173,7 @@ public void testToString() { .append("useEips", request.isUseEips()) .append("baselineVirtualUsers", request.getBaselineVirtualUsers()) .append("userIntervalIncrement", "0") + .append("endRate", "0.0") .append("reportingMode", request.getReportingMode()) .append("regions", request.getRegions()) .toString(); diff --git a/data_model/src/main/java/com/intuit/tank/project/BaseJob.java b/data_model/src/main/java/com/intuit/tank/project/BaseJob.java index 530b8b13c..43196ee28 100644 --- a/data_model/src/main/java/com/intuit/tank/project/BaseJob.java +++ b/data_model/src/main/java/com/intuit/tank/project/BaseJob.java @@ -13,7 +13,6 @@ * #L% */ -import java.math.BigDecimal; import java.util.Map; import java.util.Set; @@ -96,8 +95,8 @@ public abstract class BaseJob extends BaseEntity { @Column(name = "user_interval_increment_seconds") private int userIntervalIncrement; - @Column(name = "target_rate", precision = 4, scale = 3) // 0.001 to 1.000 - private BigDecimal targetRampRate; + @Column(name = "target_rate") + private Double targetRampRate = 1.00; @Column(name = "reporting_mode", nullable = false) private String reportingMode = TankConstants.RESULTS_NONE; @@ -442,15 +441,15 @@ public void setUserIntervalIncrement(int userIntervalIncrement) { /** * @return the targetRampRate */ - public BigDecimal getTargetRampRate() { - return targetRampRate; + public double getTargetRampRate() { + return targetRampRate != null ? targetRampRate : 1.0; } /** * @param targetRampRate * the targetRampRate to set */ - public void setTargetRampRate(BigDecimal targetRampRate) { + public void setTargetRampRate(double targetRampRate) { this.targetRampRate = targetRampRate; } diff --git a/rest-mvc/src/main/java/com/intuit/tank/rest/mvc/rest/util/JobDetailFormatter.java b/rest-mvc/src/main/java/com/intuit/tank/rest/mvc/rest/util/JobDetailFormatter.java index dd4908013..e220cfb29 100644 --- a/rest-mvc/src/main/java/com/intuit/tank/rest/mvc/rest/util/JobDetailFormatter.java +++ b/rest-mvc/src/main/java/com/intuit/tank/rest/mvc/rest/util/JobDetailFormatter.java @@ -106,12 +106,12 @@ protected static String buildDetails(JobValidator validator, Workload workload, addProperty(sb, "Ramp Time", TimeUtil.toTimeString(proposedJobInstance.getRampTime())); if(proposedJobInstance.getIncrementStrategy().equals(IncrementStrategy.standard)){ // addProperty(sb, "Starting User Ramp (users/sec)", Integer.toString(proposedJobInstance.getStartRate())); - addProperty(sb, "Agent User Ramp Rate (users/sec)", Double.toString(proposedJobInstance.getUserIntervalIncrement())); - addProperty(sb, "Total User Ramp Rate (users/sec)", Double.toString(proposedJobInstance.getUserIntervalIncrement() * proposedJobInstance.getNumAgents())); + addProperty(sb, "Agent User Ramp Rate (users/sec)", Double.toString(proposedJobInstance.getTargetRampRate())); + addProperty(sb, "Total User Ramp Rate (users/sec)", Double.toString(proposedJobInstance.getTargetRampRate() * proposedJobInstance.getNumAgents())); } addProperty(sb, "Initial Users", Integer.toString(proposedJobInstance.getBaselineVirtualUsers())); if(proposedJobInstance.getIncrementStrategy().equals(IncrementStrategy.increasing)) { - addProperty(sb, "User Increment", Double.toString(proposedJobInstance.getUserIntervalIncrement())); + addProperty(sb, "User Increment", Integer.toString(proposedJobInstance.getUserIntervalIncrement())); } // users and regions sb.append(BREAK); @@ -150,13 +150,6 @@ protected static String buildDetails(JobValidator validator, Workload workload, if (regionPercentage != 100) { addError(errorSB, "Region Percentage does not add up to 100%"); } - - if(proposedJobInstance.getNumAgents() > proposedJobInstance.getUserIntervalIncrement() - && proposedJobInstance.getIncrementStrategy().equals(IncrementStrategy.standard)) { - addError(errorSB, "Number of Agents cannot be greater than the Target User Ramp Rate" - + "- update Target User Ramp Rate or set Number of Agents equal to or less than " + proposedJobInstance.getUserIntervalIncrement() + " agents"); - } - } sb.append(BREAK); sb.append(BREAK); @@ -222,7 +215,7 @@ protected static String buildDetails(JobValidator validator, Workload workload, if(proposedJobInstance.getIncrementStrategy().equals(IncrementStrategy.increasing)) { target = "(" + numUsers + " users)"; } else { - target = "(" + proposedJobInstance.getUserIntervalIncrement() + " users/sec)"; + target = "(" + proposedJobInstance.getTargetRampRate() * proposedJobInstance.getNumAgents() + " users/sec)"; } addProperty( sb, diff --git a/tank_vmManager/src/main/java/com/intuit/tank/perfManager/workLoads/JobManager.java b/tank_vmManager/src/main/java/com/intuit/tank/perfManager/workLoads/JobManager.java index 10d93e4a9..9494ca047 100644 --- a/tank_vmManager/src/main/java/com/intuit/tank/perfManager/workLoads/JobManager.java +++ b/tank_vmManager/src/main/java/com/intuit/tank/perfManager/workLoads/JobManager.java @@ -173,7 +173,8 @@ public AgentTestStartData registerAgentForJob(AgentData agentData) { ret.setStartUsers(jobInfo.jobRequest.getBaselineVirtualUsers()); ret.setTotalAgents(jobInfo.numberOfMachines); ret.setIncrementStrategy(jobInfo.jobRequest.getIncrementStrategy()); - ret.setUserIntervalIncrement(jobInfo.jobRequest.getUserIntervalIncrement()); // non-linear: target ramp rate + ret.setUserIntervalIncrement(jobInfo.jobRequest.getUserIntervalIncrement()); + ret.setTargetRampRate(jobInfo.jobRequest.getEndRate()); jobInfo.agentData.add(agentData); CloudVmStatus status = vmTracker.getStatus(agentData.getInstanceId()); if(status != null) { diff --git a/tank_vmManager/src/main/java/com/intuit/tank/perfManager/workLoads/WorkLoadFactory.java b/tank_vmManager/src/main/java/com/intuit/tank/perfManager/workLoads/WorkLoadFactory.java index 0f3b9ed7d..3cccdfa5e 100644 --- a/tank_vmManager/src/main/java/com/intuit/tank/perfManager/workLoads/WorkLoadFactory.java +++ b/tank_vmManager/src/main/java/com/intuit/tank/perfManager/workLoads/WorkLoadFactory.java @@ -142,7 +142,7 @@ private JobRequest jobToJobRequest(JobInstance job) { .withSimulationTime(job.getSimulationTime()).withStatus(job.getStatus()) .withTerminationPolicy(job.getTerminationPolicy()) .withUserIntervalIncrement(job.getUserIntervalIncrement()) - .withEndRate(job.getUserIntervalIncrement()) + .withEndRate(job.getTargetRampRate()) .withRegions(getRegions(job)) .withNofitications(getNotifications(job)) .withDataFileIds(getDataFileIds(job)); diff --git a/web/web_support/src/main/java/com/intuit/tank/ProjectBean.java b/web/web_support/src/main/java/com/intuit/tank/ProjectBean.java index 00e2e0b7e..aa78401f9 100644 --- a/web/web_support/src/main/java/com/intuit/tank/ProjectBean.java +++ b/web/web_support/src/main/java/com/intuit/tank/ProjectBean.java @@ -240,8 +240,8 @@ public void setWorkloadType(String workloadType) { /** * @return the end rate for job */ - public int getEndRate() { - return getWorkload().getJobConfiguration().getUserIntervalIncrement(); + public double getEndRate() { + return getWorkload().getJobConfiguration().getTargetRampRate(); } /** @@ -249,9 +249,9 @@ public int getEndRate() { * * @param endRate */ - public void setEndRate(int endRate) { + public void setEndRate(double endRate) { Workload workload = getWorkload(); - workload.getJobConfiguration().setUserIntervalIncrement(endRate); + workload.getJobConfiguration().setTargetRampRate(endRate); } /** diff --git a/web/web_support/src/main/java/com/intuit/tank/job/ActJobNodeBean.java b/web/web_support/src/main/java/com/intuit/tank/job/ActJobNodeBean.java index 52e6aff87..d72ad5d29 100644 --- a/web/web_support/src/main/java/com/intuit/tank/job/ActJobNodeBean.java +++ b/web/web_support/src/main/java/com/intuit/tank/job/ActJobNodeBean.java @@ -40,7 +40,7 @@ public ActJobNodeBean(JobInstance job, boolean hasRights, FastDateFormat fmt) { this.setRegion(""); this.setActiveUsers(String.valueOf(job.getBaselineVirtualUsers())); this.setTotalUsers(String.valueOf(job.getTotalVirtualUsers())); - this.setTargetRampRate(String.valueOf(job.getUserIntervalIncrement() * job.getNumAgents())); + this.setTargetRampRate(String.valueOf(job.getTargetRampRate() * job.getNumAgents())); this.jobDetails = job.getJobDetails(); this.setStartTime(job.getStartTime()); this.setEndTime(job.getEndTime()); diff --git a/web/web_support/src/main/java/com/intuit/tank/project/JobDetailFormatter.java b/web/web_support/src/main/java/com/intuit/tank/project/JobDetailFormatter.java index 13a841129..021e4a2ff 100644 --- a/web/web_support/src/main/java/com/intuit/tank/project/JobDetailFormatter.java +++ b/web/web_support/src/main/java/com/intuit/tank/project/JobDetailFormatter.java @@ -106,13 +106,9 @@ protected static String buildDetails(JobValidator validator, Workload workload, .getDisplayName()); addProperty(sb, "Stop Behavior", StopBehavior.fromString(proposedJobInstance.getStopBehavior()) .getDisplay()); - if(proposedJobInstance.getIncrementStrategy().equals(IncrementStrategy.increasing)) { - addProperty(sb, "Run Scripts Until", proposedJobInstance.getTerminationPolicy().getDisplay(), - proposedJobInstance.getTerminationPolicy() == TerminationPolicy.time - && proposedJobInstance.getSimulationTime() == 0 ? "error" : null); - } else { - addProperty(sb, "Run Scripts Until", TerminationPolicy.time.getDisplay()); - } + addProperty(sb, "Run Scripts Until", proposedJobInstance.getTerminationPolicy().getDisplay(), + proposedJobInstance.getTerminationPolicy() == TerminationPolicy.time + && proposedJobInstance.getSimulationTime() == 0 ? "error" : null); sb.append(BREAK); addProperty( sb, @@ -125,12 +121,12 @@ protected static String buildDetails(JobValidator validator, Workload workload, addProperty(sb, "Ramp Time", TimeUtil.toTimeString(proposedJobInstance.getRampTime())); if(proposedJobInstance.getIncrementStrategy().equals(IncrementStrategy.standard)){ // addProperty(sb, "Starting User Ramp (users/sec)", Integer.toString(proposedJobInstance.getStartRate())); - addProperty(sb, "Agent User Ramp Rate (users/sec)", Double.toString(proposedJobInstance.getUserIntervalIncrement())); - addProperty(sb, "Total User Ramp Rate (users/sec)", Double.toString(proposedJobInstance.getUserIntervalIncrement() * proposedJobInstance.getNumAgents())); + addProperty(sb, "Agent User Ramp Rate (users/sec)", Double.toString(proposedJobInstance.getTargetRampRate())); + addProperty(sb, "Total User Ramp Rate (users/sec)", Double.toString(proposedJobInstance.getTargetRampRate() * proposedJobInstance.getNumAgents())); } addProperty(sb, "Initial Users", Integer.toString(proposedJobInstance.getBaselineVirtualUsers())); if(proposedJobInstance.getIncrementStrategy().equals(IncrementStrategy.increasing)) { - addProperty(sb, "User Increment", Double.toString(proposedJobInstance.getUserIntervalIncrement())); + addProperty(sb, "User Increment", Integer.toString(proposedJobInstance.getUserIntervalIncrement())); } // users and regions sb.append(BREAK); @@ -169,7 +165,6 @@ protected static String buildDetails(JobValidator validator, Workload workload, if (regionPercentage != 100) { addError(errorSB, "Region Percentage does not add up to 100%"); } - } sb.append(BREAK); sb.append(BREAK); @@ -235,7 +230,7 @@ protected static String buildDetails(JobValidator validator, Workload workload, if(proposedJobInstance.getIncrementStrategy().equals(IncrementStrategy.increasing)) { target = "(" + numUsers + " users)"; } else { - target = "(" + proposedJobInstance.getUserIntervalIncrement() + " users/sec)"; + target = "(" + proposedJobInstance.getTargetRampRate() * proposedJobInstance.getNumAgents() + " users/sec)"; } addProperty( sb, diff --git a/web/web_support/src/main/java/com/intuit/tank/project/UsersAndTimes.java b/web/web_support/src/main/java/com/intuit/tank/project/UsersAndTimes.java index 7b3b5c218..c1cab58e3 100644 --- a/web/web_support/src/main/java/com/intuit/tank/project/UsersAndTimes.java +++ b/web/web_support/src/main/java/com/intuit/tank/project/UsersAndTimes.java @@ -61,10 +61,6 @@ public class UsersAndTimes implements Serializable { private TankConfig tankConfig = new TankConfig(); - private String targetRampRate; - - private String userIncrement; - @Inject private Messages messages; @@ -385,6 +381,7 @@ public void setStartUsers(String startUsers) { * @return the number of users increment for the job */ public String getUserIncrement() { + String userIncrement = String.valueOf(projectBean.getJobConfiguration().getUserIntervalIncrement()); if(StringUtils.isEmpty(userIncrement)) { return "1"; } @@ -401,9 +398,8 @@ public void setUserIncrement(String startUsers) { if (NumberUtils.isCreatable(startUsers)) { projectBean.getJobConfiguration().setUserIntervalIncrement(Integer.parseInt(startUsers)); } - this.userIncrement = startUsers; } - // TODO: need to update BaseJob to support both start and end rate + // TODO: need to update BaseJob to support start rate // /** // * @return get nonlinear start rate for the job // */ @@ -426,8 +422,9 @@ public void setUserIncrement(String startUsers) { * @return get nonlinear end rate for the job */ public String getEndRate() { + String targetRampRate = String.valueOf(projectBean.getJobConfiguration().getTargetRampRate()); if(StringUtils.isEmpty(targetRampRate)) { - return "1"; + return "1.0"; } return targetRampRate; } @@ -441,9 +438,8 @@ public String getEndRate() { */ public void setEndRate(String endRate) { if(this.getIncrementStrategy().equals(IncrementStrategy.standard)) { - projectBean.getJobConfiguration().setUserIntervalIncrement(Integer.parseInt(endRate)); + projectBean.getJobConfiguration().setTargetRampRate(Double.parseDouble(endRate)); } - this.targetRampRate = endRate; } /** From 624201271845fc4bcb727b05e2e35f9f3b6bc6e7 Mon Sep 17 00:00:00 2001 From: zkofiro Date: Thu, 16 Nov 2023 18:09:36 -0800 Subject: [PATCH 5/6] set user interval to 1 by default --- .../main/java/com/intuit/tank/project/UsersAndTimes.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/web/web_support/src/main/java/com/intuit/tank/project/UsersAndTimes.java b/web/web_support/src/main/java/com/intuit/tank/project/UsersAndTimes.java index c1cab58e3..59f41c867 100644 --- a/web/web_support/src/main/java/com/intuit/tank/project/UsersAndTimes.java +++ b/web/web_support/src/main/java/com/intuit/tank/project/UsersAndTimes.java @@ -381,11 +381,10 @@ public void setStartUsers(String startUsers) { * @return the number of users increment for the job */ public String getUserIncrement() { - String userIncrement = String.valueOf(projectBean.getJobConfiguration().getUserIntervalIncrement()); - if(StringUtils.isEmpty(userIncrement)) { - return "1"; + if (projectBean.getJobConfiguration().getUserIntervalIncrement() > 0) { + return String.valueOf(projectBean.getJobConfiguration().getUserIntervalIncrement()); } - return userIncrement; + return "1"; } /** From af48a20558063695d81375b31680d7ddd4576cdd Mon Sep 17 00:00:00 2001 From: zkofiro Date: Thu, 16 Nov 2023 23:01:05 -0800 Subject: [PATCH 6/6] add estimated steady state users to job details --- .../rest/mvc/rest/util/JobDetailFormatter.java | 5 ++++- .../intuit/tank/project/JobDetailFormatter.java | 14 ++++---------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/rest-mvc/src/main/java/com/intuit/tank/rest/mvc/rest/util/JobDetailFormatter.java b/rest-mvc/src/main/java/com/intuit/tank/rest/mvc/rest/util/JobDetailFormatter.java index e220cfb29..37e22f981 100644 --- a/rest-mvc/src/main/java/com/intuit/tank/rest/mvc/rest/util/JobDetailFormatter.java +++ b/rest-mvc/src/main/java/com/intuit/tank/rest/mvc/rest/util/JobDetailFormatter.java @@ -105,9 +105,12 @@ protected static String buildDetails(JobValidator validator, Workload workload, } addProperty(sb, "Ramp Time", TimeUtil.toTimeString(proposedJobInstance.getRampTime())); if(proposedJobInstance.getIncrementStrategy().equals(IncrementStrategy.standard)){ -// addProperty(sb, "Starting User Ramp (users/sec)", Integer.toString(proposedJobInstance.getStartRate())); addProperty(sb, "Agent User Ramp Rate (users/sec)", Double.toString(proposedJobInstance.getTargetRampRate())); addProperty(sb, "Total User Ramp Rate (users/sec)", Double.toString(proposedJobInstance.getTargetRampRate() * proposedJobInstance.getNumAgents())); + addProperty(sb, "Estimated Steady State Concurrent Users", + Double.toString(proposedJobInstance.getTargetRampRate() * + ((double) proposedJobInstance.getRampTime() / 1000) * + proposedJobInstance.getNumAgents())); } addProperty(sb, "Initial Users", Integer.toString(proposedJobInstance.getBaselineVirtualUsers())); if(proposedJobInstance.getIncrementStrategy().equals(IncrementStrategy.increasing)) { diff --git a/web/web_support/src/main/java/com/intuit/tank/project/JobDetailFormatter.java b/web/web_support/src/main/java/com/intuit/tank/project/JobDetailFormatter.java index 021e4a2ff..d0cd91a87 100644 --- a/web/web_support/src/main/java/com/intuit/tank/project/JobDetailFormatter.java +++ b/web/web_support/src/main/java/com/intuit/tank/project/JobDetailFormatter.java @@ -28,15 +28,6 @@ import com.intuit.tank.dao.JobRegionDao; import com.intuit.tank.harness.StopBehavior; import com.intuit.tank.logging.LoggingProfile; -import com.intuit.tank.project.DataFile; -import com.intuit.tank.project.EntityVersion; -import com.intuit.tank.project.JobInstance; -import com.intuit.tank.project.JobNotification; -import com.intuit.tank.project.JobRegion; -import com.intuit.tank.project.ScriptGroup; -import com.intuit.tank.project.ScriptGroupStep; -import com.intuit.tank.project.TestPlan; -import com.intuit.tank.project.Workload; import com.intuit.tank.util.TestParamUtil; import com.intuit.tank.vm.api.enumerated.TerminationPolicy; import com.intuit.tank.vm.settings.TimeUtil; @@ -120,9 +111,12 @@ protected static String buildDetails(JobValidator validator, Workload workload, } addProperty(sb, "Ramp Time", TimeUtil.toTimeString(proposedJobInstance.getRampTime())); if(proposedJobInstance.getIncrementStrategy().equals(IncrementStrategy.standard)){ -// addProperty(sb, "Starting User Ramp (users/sec)", Integer.toString(proposedJobInstance.getStartRate())); addProperty(sb, "Agent User Ramp Rate (users/sec)", Double.toString(proposedJobInstance.getTargetRampRate())); addProperty(sb, "Total User Ramp Rate (users/sec)", Double.toString(proposedJobInstance.getTargetRampRate() * proposedJobInstance.getNumAgents())); + addProperty(sb, "Estimated Steady State Concurrent Users", + Double.toString(proposedJobInstance.getTargetRampRate() * + ((double) proposedJobInstance.getRampTime() / 1000) * + proposedJobInstance.getNumAgents())); } addProperty(sb, "Initial Users", Integer.toString(proposedJobInstance.getBaselineVirtualUsers())); if(proposedJobInstance.getIncrementStrategy().equals(IncrementStrategy.increasing)) {