Class TopologyLoadConf

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

public class TopologyLoadConf extends Object
Configuration for a simulated topology.
  • Field Details

  • Constructor Details

    • TopologyLoadConf

      public TopologyLoadConf(String name, Map<String,Object> topoConf, List<LoadCompConf> spouts, List<LoadCompConf> bolts, List<InputStream> streams)
      Constructor.
      Parameters:
      name - the name of the topology.
      topoConf - the config for the topology
      spouts - the spouts for the topology
      bolts - the bolts for the topology
      streams - the streams for the topology
  • Method Details

    • fromConf

      public static TopologyLoadConf fromConf(File file) throws IOException
      Parse the TopologyLoadConf from a file in YAML format.
      Parameters:
      file - the file to read from
      Returns:
      the parsed conf
      Throws:
      IOException - if there is an issue reading the file.
    • fromConf

      public static TopologyLoadConf fromConf(Map<String,Object> conf)
      Parse the TopologyLoadConf from a config map.
      Parameters:
      conf - the config with the TopologyLoadConf in it
      Returns:
      the parsed instance.
    • writeTo

      public void writeTo(File file) throws IOException
      Write this out to a file in YAML format.
      Parameters:
      file - the file to write to.
      Throws:
      IOException - if there is an error writing to the file.
    • toYamlString

      public String toYamlString()
      Convert this into a YAML String.
      Returns:
      this as a YAML String.
    • toConf

      public Map<String,Object> toConf()
      Covert this into a Map config.
      Returns:
      this as a Map config.
    • withName

      public TopologyLoadConf withName(String baseName)
    • scaleParallel

      public TopologyLoadConf scaleParallel(double v, Map<String,Double> topoSpecific)
      Scale all of the components in the topology by a percentage (but keep the throughput the same).
      Parameters:
      v - the amount to scale them by. 1.0 is nothing, 0.5 cuts them in half, 2.0 doubles them.
      Returns:
      a copy of this with the needed adjustments made.
    • scaleThroughput

      public TopologyLoadConf scaleThroughput(double v, Map<String,Double> topoSpecific)
      Scale the throughput of the entire topology by a percentage.
      Parameters:
      v - the amount to scale it by 1.0 is nothing 0.5 cuts it in half and 2.0 doubles it.
      Returns:
      a copy of this with the needed adjustments made.
    • overrideSlowExecs

      public TopologyLoadConf overrideSlowExecs(Map<String,SlowExecutorPattern> topoSpecific)
      Override the SlowExecutorPattern for given components.
      Parameters:
      topoSpecific - what we are going to use to override.
      Returns:
      a copy of this with the needed adjustments made.
    • anonymize

      public TopologyLoadConf anonymize()
      Create a new version of this topology with identifiable information removed.
      Returns:
      the anonymized version of the TopologyLoadConf.
    • looksLikeTrident

      public boolean looksLikeTrident()
      Try to see if this looks like a trident topology. NOTE: this will not work for anonymized configs
      Returns:
      true if it does else false.
    • getAllEmittedAggregate

      public double getAllEmittedAggregate()
      Get the messages emitted per second in aggregate across all streams in the topology.
      Returns:
      messages per second.
    • getSpoutEmittedAggregate

      public double getSpoutEmittedAggregate()
      Get the messages emitted per second in aggregate for all of the spouts in the topology.
      Returns:
      messages per second.
    • getTridentEstimatedEmittedAggregate

      public double getTridentEstimatedEmittedAggregate()
      Try and guess at the actual number of messages emitted per second by a trident topology, not the number of batches. This does not work on an anonymized conf.
      Returns:
      messages per second or 0 if this does not look like a trident topology.
    • replaceShuffleWithLocalOrShuffle

      public TopologyLoadConf replaceShuffleWithLocalOrShuffle()