Class LoadCompConf

java.lang.Object
org.apache.storm.loadgen.LoadCompConf

public class LoadCompConf extends Object
Configuration for a simulated spout.
  • Field Details

    • id

      public final String id
    • parallelism

      public final int parallelism
    • streams

      public final List<OutputStream> streams
    • cpuLoad

      public final double cpuLoad
    • memoryLoad

      public final double memoryLoad
    • slp

      public final SlowExecutorPattern slp
  • Constructor Details

    • LoadCompConf

      public LoadCompConf(String id, int parallelism, List<OutputStream> streams, double cpuLoad, double memoryLoad, SlowExecutorPattern slp)
      Create a new LoadCompConf with the given values.
      Parameters:
      id - the id of the component.
      parallelism - tha parallelism of the component.
      streams - the output streams of the component.
  • Method Details

    • fromConf

      public static LoadCompConf fromConf(Map<String,Object> conf)
      Parse the LoadCompConf from a config Map.
      Parameters:
      conf - the map holding the config for a LoadCompConf.
      Returns:
      the parsed object.
    • toConf

      public Map<String,Object> toConf()
      Build a config map for this object.
      Returns:
      the config map.
    • remap

      public LoadCompConf remap(Map<String,String> remappedComponents, Map<GlobalStreamId,GlobalStreamId> remappedStreams)
      Chenge the name of components and streams according to the parameters passed in.
      Parameters:
      remappedComponents - original component name to new component name.
      remappedStreams - original stream id to new stream id.
      Returns:
      a copy of this with the values remapped.
    • scaleParallel

      public LoadCompConf scaleParallel(double v)
      Scale the parallelism of this component by v. The aggregate throughput will be the same. The parallelism will be rounded up to the next largest whole number. Parallelism will always be at least 1.
      Parameters:
      v - 1.0 is not change 0.5 is drop the parallelism by half.
      Returns:
      a copy of this with the parallelism adjusted.
    • setParallel

      public LoadCompConf setParallel(int newParallelism)
      Set the parallelism of this component, and adjust the throughput so in aggregate it stays the same.
      Parameters:
      newParallelism - the new parallelism to set.
      Returns:
      a copy of this with the adjustments made.
    • scaleThroughput

      public LoadCompConf scaleThroughput(double v)
      Scale the throughput of this component.
      Parameters:
      v - 1.0 is unchanged 0.5 will cut the throughput in half.
      Returns:
      a copy of this with the adjustments made.
    • overrideSlowExecutorPattern

      public LoadCompConf overrideSlowExecutorPattern(SlowExecutorPattern slp)
      Override the SlowExecutorPattern with a new one.
      Parameters:
      slp - the new pattern or null if you don't want it to change
      Returns:
      a copy of this with the adjustments made.
    • getAllEmittedAggregate

      public double getAllEmittedAggregate()
      Compute the total amount of all messages emitted in all streams per second.
      Returns:
      the sum of all messages emitted per second.