Example: Using resource usage thresholds to protect overloaded resources
Scenario: You see that one of your resources is overloaded and you want to protect it from having more work placed on it.
About this task
streamtool
commands.Procedure
-
View the current metrics for the resource by running the
streamtool capturestate
command. Look for the values of these metrics under the<host>
element:cpuUtilization
memoryUtilization
networkUtilization
Example command:
streamtool capturestate --select hosts=metrics
On one of the resources, you see that the CPU usage and memory usage are high:
… <metric name="cpuUtilization" lastChangeObserved="1504302827" userDefined="false"> <metricValue xsi:type="streams:longType" value="90"/> </metric> … <metric name="memoryUtilization" lastChangeObserved="1504302827" userDefined="false"> <metricValue xsi:type="streams:longType" value="90"/> </metric> … <metric name="networkUtilization" lastChangeObserved="1504302827" userDefined="false"> <metricValue xsi:type="streams:longType" value="15"/> </metric> …
-
Set the resourceLoadProtectionEnabled instance property:
streamtool setproperty instance.resourceLoadProtectionEnabled=true
- Modify the upper thresholds for CPU usage and memory usage:
streamtool setproperty resourceCpuUsageUpperThreshold=75 resourceMemoryUsageUpperThreshold=50
Now, no PEs should be placed on the overloaded resource. You can preview the job to confirm the changes.
- Optional: Preview the job:
streamtool submitjob --preview myapp.sab
Examine the output and confirm that the overloaded resources are not chosen for PE placements.