Search in sources :

Example 1 with WaitStrategyPark

use of org.apache.storm.policy.WaitStrategyPark in project storm by apache.

the class JCQueuePerfTest method producerFwdConsumer.

private static void producerFwdConsumer(int prodBatchSz) {
    WaitStrategyPark ws = new WaitStrategyPark(100);
    StormMetricRegistry registry = new StormMetricRegistry();
    JCQueue q1 = new JCQueue("q1", "q1", 1024, 0, prodBatchSz, ws, "test", "test", Collections.singletonList(1000), 1000, registry);
    JCQueue q2 = new JCQueue("q2", "q2", 1024, 0, prodBatchSz, ws, "test", "test", Collections.singletonList(1000), 1000, registry);
    final Producer prod = new Producer(q1);
    final Forwarder fwd = new Forwarder(q1, q2);
    final Consumer cons = new Consumer(q2);
    runAllThds(prod, fwd, cons);
}
Also used : JCQueue(org.apache.storm.utils.JCQueue) WaitStrategyPark(org.apache.storm.policy.WaitStrategyPark) StormMetricRegistry(org.apache.storm.metrics2.StormMetricRegistry)

Example 2 with WaitStrategyPark

use of org.apache.storm.policy.WaitStrategyPark in project storm by apache.

the class JCQueuePerfTest method oneProducer1Consumer.

private static void oneProducer1Consumer(int prodBatchSz) {
    JCQueue q1 = new JCQueue("q1", "q1", 50_000, 0, prodBatchSz, new WaitStrategyPark(100), "test", "test", Collections.singletonList(1000), 1000, new StormMetricRegistry());
    final Producer prod1 = new Producer(q1);
    final Consumer cons1 = new Consumer(q1);
    runAllThds(prod1, cons1);
}
Also used : JCQueue(org.apache.storm.utils.JCQueue) WaitStrategyPark(org.apache.storm.policy.WaitStrategyPark) StormMetricRegistry(org.apache.storm.metrics2.StormMetricRegistry)

Example 3 with WaitStrategyPark

use of org.apache.storm.policy.WaitStrategyPark in project storm by apache.

the class JCQueuePerfTest method twoProducer1Consumer.

private static void twoProducer1Consumer(int prodBatchSz) {
    JCQueue q1 = new JCQueue("q1", "q1", 50_000, 0, prodBatchSz, new WaitStrategyPark(100), "test", "test", Collections.singletonList(1000), 1000, new StormMetricRegistry());
    final Producer prod1 = new Producer(q1);
    final Producer prod2 = new Producer(q1);
    final Consumer cons1 = new Consumer(q1);
    runAllThds(prod1, prod2, cons1);
}
Also used : JCQueue(org.apache.storm.utils.JCQueue) WaitStrategyPark(org.apache.storm.policy.WaitStrategyPark) StormMetricRegistry(org.apache.storm.metrics2.StormMetricRegistry)

Example 4 with WaitStrategyPark

use of org.apache.storm.policy.WaitStrategyPark in project storm by apache.

the class JCQueuePerfTest method ackingProducerSimulation.

private static void ackingProducerSimulation() {
    WaitStrategyPark ws = new WaitStrategyPark(100);
    StormMetricRegistry registry = new StormMetricRegistry();
    JCQueue spoutQ = new JCQueue("spoutQ", "spoutQ", 1024, 0, 100, ws, "test", "test", Collections.singletonList(1000), 1000, registry);
    JCQueue ackQ = new JCQueue("ackQ", "ackQ", 1024, 0, 100, ws, "test", "test", Collections.singletonList(1000), 1000, registry);
    final AckingProducer ackingProducer = new AckingProducer(spoutQ, ackQ);
    final Acker acker = new Acker(ackQ, spoutQ);
    runAllThds(ackingProducer, acker);
}
Also used : JCQueue(org.apache.storm.utils.JCQueue) WaitStrategyPark(org.apache.storm.policy.WaitStrategyPark) StormMetricRegistry(org.apache.storm.metrics2.StormMetricRegistry)

Example 5 with WaitStrategyPark

use of org.apache.storm.policy.WaitStrategyPark in project storm by apache.

the class JCQueuePerfTest method threeProducer1Consumer.

private static void threeProducer1Consumer(int prodBatchSz) {
    JCQueue q1 = new JCQueue("q1", "q1", 50_000, 0, prodBatchSz, new WaitStrategyPark(100), "test", "test", Collections.singletonList(1000), 1000, new StormMetricRegistry());
    final Producer prod1 = new Producer(q1);
    final Producer prod2 = new Producer(q1);
    final Producer prod3 = new Producer(q1);
    final Consumer cons1 = new Consumer(q1);
    runAllThds(prod1, prod2, prod3, cons1);
}
Also used : JCQueue(org.apache.storm.utils.JCQueue) WaitStrategyPark(org.apache.storm.policy.WaitStrategyPark) StormMetricRegistry(org.apache.storm.metrics2.StormMetricRegistry)

Aggregations

WaitStrategyPark (org.apache.storm.policy.WaitStrategyPark)8 StormMetricRegistry (org.apache.storm.metrics2.StormMetricRegistry)7 JCQueue (org.apache.storm.utils.JCQueue)7 HashMap (java.util.HashMap)2 WorkerState (org.apache.storm.daemon.worker.WorkerState)1 WorkerTransfer (org.apache.storm.daemon.worker.WorkerTransfer)1 StormTopology (org.apache.storm.generated.StormTopology)1 GeneralTopologyContext (org.apache.storm.task.GeneralTopologyContext)1 WorkerTopologyContext (org.apache.storm.task.WorkerTopologyContext)1 Before (org.junit.Before)1