Package org.apache.storm.loadgen
Class LoadCompConf
- java.lang.Object
-
- org.apache.storm.loadgen.LoadCompConf
-
public class LoadCompConf extends Object
Configuration for a simulated spout.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
LoadCompConf.Builder
-
Field Summary
Fields Modifier and Type Field Description double
cpuLoad
String
id
double
memoryLoad
int
parallelism
SlowExecutorPattern
slp
List<OutputStream>
streams
-
Constructor Summary
Constructors Constructor Description LoadCompConf(String id, int parallelism, List<OutputStream> streams, double cpuLoad, double memoryLoad, SlowExecutorPattern slp)
Create a new LoadCompConf with the given values.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static LoadCompConf
fromConf(Map<String,Object> conf)
Parse the LoadCompConf from a config Map.double
getAllEmittedAggregate()
Compute the total amount of all messages emitted in all streams per second.LoadCompConf
overrideSlowExecutorPattern(SlowExecutorPattern slp)
Override the SlowExecutorPattern with a new one.LoadCompConf
remap(Map<String,String> remappedComponents, Map<GlobalStreamId,GlobalStreamId> remappedStreams)
Chenge the name of components and streams according to the parameters passed in.LoadCompConf
scaleParallel(double v)
Scale the parallelism of this component by v.LoadCompConf
scaleThroughput(double v)
Scale the throughput of this component.LoadCompConf
setParallel(int newParallelism)
Set the parallelism of this component, and adjust the throughput so in aggregate it stays the same.Map<String,Object>
toConf()
Build a config map for this object.
-
-
-
Field Detail
-
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 Detail
-
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 Detail
-
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.
-
-