Package org.apache.storm.loadgen
Class LoadCompConf
java.lang.Object
org.apache.storm.loadgen.LoadCompConf
Configuration for a simulated spout.
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionfinal double
final String
final double
final int
final SlowExecutorPattern
final List<OutputStream>
-
Constructor Summary
ConstructorDescriptionLoadCompConf
(String id, int parallelism, List<OutputStream> streams, double cpuLoad, double memoryLoad, SlowExecutorPattern slp) Create a new LoadCompConf with the given values. -
Method Summary
Modifier and TypeMethodDescriptionstatic LoadCompConf
Parse the LoadCompConf from a config Map.double
Compute the total amount of all messages emitted in all streams per second.Override the SlowExecutorPattern with a new one.remap
(Map<String, String> remappedComponents, Map<GlobalStreamId, GlobalStreamId> remappedStreams) Chenge the name of components and streams according to the parameters passed in.scaleParallel
(double v) Scale the parallelism of this component by v.scaleThroughput
(double v) Scale the throughput of this component.setParallel
(int newParallelism) Set the parallelism of this component, and adjust the throughput so in aggregate it stays the same.toConf()
Build a config map for this object.
-
Field Details
-
id
-
parallelism
public final int parallelism -
streams
-
cpuLoad
public final double cpuLoad -
memoryLoad
public final double memoryLoad -
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
Parse the LoadCompConf from a config Map.- Parameters:
conf
- the map holding the config for a LoadCompConf.- Returns:
- the parsed 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
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
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
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
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.
-