@Test
    void singlePolicyIncreasingWorkersWithNoParallelism() {
        for (int exponent = 0; exponent < 4; exponent++) {
            ManualTimer timer = new ManualTimer();
            DynamicThrottlePolicy policy = new DynamicThrottlePolicy(timer);
            int scaleFactor = (int) Math.pow(10, exponent);
            long operations = 2_000L * scaleFactor;
            // workPerSuccess determines the latency of the simulated server, which again determines the impact of the
            // synthetic attractors of the algorithm, around latencies which give (close to) integer log10(1 / latency).
            // With a value of 5, the impact is that the algorithm is pushed upwards slightly above 10k window size,
            // which is the optimal choice for the case with 10000 clients.
            // Change this to, e.g., 6 and the algorithm fails to climb as high, as the "ideal latency" is obtained at
            // a lower latency than what is measured at 10k window size.
            // On the other hand, changing it to 4 moves the attractor out of reach for the algorithm, which fails to
            // push window size past 2k on its own.
            int workPerSuccess = 5;
            int numberOfWorkers = scaleFactor;
            int maximumTasksPerWorker = 100000;
            int workerParallelism = 1;
            Summary summary = run(operations, workPerSuccess, numberOfWorkers, maximumTasksPerWorker, workerParallelism, timer, policy);

            double minMaxPending = numberOfWorkers * workerParallelism;
            double maxMaxPending = numberOfWorkers * maximumTasksPerWorker;
            assertInRange(minMaxPending, summary.averagePending, maxMaxPending);
            assertInRange(minMaxPending, summary.averageWindows[0], maxMaxPending);
            assertInRange(1, summary.inefficiency, 1 + 0.25 * exponent); // Even slower ramp-up.
            assertInRange(0, summary.waste, 0);
        }
    }
A more realistic test, where throughput gradually flattens with increasing window size, and with more variance in throughput.
messagebus/src/test/java/com/yahoo/messagebus/DynamicThrottlePolicyTest.java