Github user HeartSaVioR commented on a diff in the pull request: https://github.com/apache/storm/pull/2389#discussion_r148674296 --- Diff: storm-core/test/jvm/org/apache/storm/nimbus/NimbusHeartbeatsPressureTest.java --- @@ -0,0 +1,208 @@ +package org.apache.storm.nimbus; + +import org.apache.storm.Config; +import org.apache.storm.generated.ExecutorInfo; +import org.apache.storm.generated.SupervisorWorkerHeartbeat; +import org.apache.storm.generated.SupervisorWorkerHeartbeats; +import org.apache.storm.utils.NimbusClient; +import org.apache.storm.utils.Utils; +import org.apache.thrift.TException; +import org.apache.thrift.transport.TTransportException; +import org.junit.Test; + +import java.util.*; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.TimeUnit; + +/** + * Test for nimbus heartbeats max throughput, This is a client to collect the statistics. + */ +public class NimbusHeartbeatsPressureTest { + /** + * the args below can be configured. + */ + private static String NIMBUS_HOST = "localhost"; + private static int NIMBUS_PORT = 6627; + + private static int THREADS_NUM = 50; + private static int THREAD_SUBMIT_NUM = 1; + private static int MOCKED_STORM_NUM = 5000; + private static volatile boolean[] readyFlags = new boolean[THREADS_NUM]; + + static { + for (int i = 0; i < THREADS_NUM; i++) { + readyFlags[i] = false; + } + } + + private static Random rand = new Random(47); + private static List<double[]> totalCostTimesBook = new ArrayList<>(); + + private static Config initializedConfig() { + Config conf = new Config(); + conf.putAll(Utils.readDefaultConfig()); + ArrayList<String> nimbusSeeds = new ArrayList<>(); + nimbusSeeds.add(NIMBUS_HOST); + + conf.put(Config.NIMBUS_SEEDS, nimbusSeeds); + conf.put(Config.NIMBUS_THRIFT_PORT, NIMBUS_PORT); + return conf; + } + + @Test + public void testMaxThroughput() { --- End diff -- This test fails consistently. We don't assume we are running Nimbus while testing, so you need to change this to be runnable with cli(having `main()` instead of adding to test) and move to `main`, not `test`. We may want to move this to `storm-perf`. If we have desired number we could move this to `integration-test` and add assertion, but not sure the number can be stable.
---