Package org.apache.storm.loadgen
Class TopologyLoadConf
- java.lang.Object
-
- org.apache.storm.loadgen.TopologyLoadConf
-
public class TopologyLoadConf extends Object
Configuration for a simulated topology.
-
-
Field Summary
Fields Modifier and Type Field Description List<LoadCompConf>
bolts
String
name
List<LoadCompConf>
spouts
List<InputStream>
streams
Map<String,Object>
topoConf
-
Constructor Summary
Constructors Constructor Description TopologyLoadConf(String name, Map<String,Object> topoConf, List<LoadCompConf> spouts, List<LoadCompConf> bolts, List<InputStream> streams)
Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description TopologyLoadConf
anonymize()
Create a new version of this topology with identifiable information removed.static TopologyLoadConf
fromConf(File file)
Parse the TopologyLoadConf from a file in YAML format.static TopologyLoadConf
fromConf(Map<String,Object> conf)
Parse the TopologyLoadConf from a config map.double
getAllEmittedAggregate()
Get the messages emitted per second in aggregate across all streams in the topology.double
getSpoutEmittedAggregate()
Get the messages emitted per second in aggregate for all of the spouts in the topology.double
getTridentEstimatedEmittedAggregate()
Try and guess at the actual number of messages emitted per second by a trident topology, not the number of batches.boolean
looksLikeTrident()
Try to see if this looks like a trident topology.TopologyLoadConf
overrideSlowExecs(Map<String,SlowExecutorPattern> topoSpecific)
Override the SlowExecutorPattern for given components.TopologyLoadConf
replaceShuffleWithLocalOrShuffle()
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).TopologyLoadConf
scaleThroughput(double v, Map<String,Double> topoSpecific)
Scale the throughput of the entire topology by a percentage.Map<String,Object>
toConf()
Covert this into a Map config.String
toYamlString()
Convert this into a YAML String.TopologyLoadConf
withName(String baseName)
void
writeTo(File file)
Write this out to a file in YAML format.
-
-
-
Field Detail
-
name
public final String name
-
spouts
public final List<LoadCompConf> spouts
-
bolts
public final List<LoadCompConf> bolts
-
streams
public final List<InputStream> streams
-
-
Constructor Detail
-
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 topologyspouts
- the spouts for the topologybolts
- the bolts for the topologystreams
- the streams for the topology
-
-
Method Detail
-
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()
-
-