Created
May 1, 2012 09:40
-
-
Save tamirko/2566833 to your computer and use it in GitHub Desktop.
tomcat auto scaling service file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
service { | |
name "tomcat" | |
... | |
/* A global flag that enables changing the number of | |
instances for this service */ | |
elastic true | |
// the initial number of instances | |
numInstances 1 | |
/* The minimum number of service instances. | |
Used together with scaling rules */ | |
minAllowedInstances 1 | |
/* The maximum number of service instances. | |
Used together with scaling rules */ | |
maxAllowedInstances 2 | |
/* The time (in seconds) that scaling rules are disabled after | |
scale in (instances removed) or scale out (instances added). | |
This has the same effect as setting scaleInCooldownInSeconds | |
and scaleOutCooldownInSeconds separately. | |
Used together with scaling rules. | |
This attribute should be greater than or equal | |
to the movingTimeRangeInSeconds attribute | |
in the serviceStatistics section. | |
*/ | |
scaleCooldownInSeconds 20 | |
/* The time (in seconds) between two consecutive metric samples. | |
Used together with scaling rules */ | |
samplingPeriodInSeconds 1 | |
// Defines an automatic scaling rule based on "counter" metric value | |
scalingRules ([ | |
scalingRule { | |
serviceStatistics { | |
/* The name of the metric that is the basis | |
for the scale rule decision | |
In the current example, the metric we use is "Total Requests Count". | |
*/ | |
metric "Total Requests Count" | |
/* (Optional) | |
The sliding time range (in seconds) for | |
aggregating per-instance metric samples. | |
The number of samples in the time windows equals | |
the time window divided by the sampling period. | |
Default value: 300 */ | |
movingTimeRangeInSeconds 20 | |
/* (Optional) | |
The algorithms for aggregating metric samples by instances | |
and by time. Metric samples are aggregated separately | |
per instance in the specified time range,and then aggregated | |
again for all instances. | |
Default value: Statistics.averageOfAverages | |
Possible values: | |
Statistics.maximumOfAverages, | |
Statistics.minimumOfAverages, | |
Statistics.averageOfAverages, | |
Statistics.percentileOfAverages(90), | |
Statistics.maximumOfMaximums, | |
Statistics.minimumOfMinimums, | |
Statistics.maximumThroughput. | |
The following has the same effect as setting instancesStatistics | |
and timeStatistics separately. | |
For example: | |
statistics Statistics.maximumOfAverages | |
is the same as: | |
timeStatistics Statistics.average | |
instancesStatistics Statistics.maximum */ | |
statistics Statistics.maximumThroughput | |
} | |
highThreshold { | |
/* The value above which the number of instances is increased */ | |
value 1 | |
/* The number of instances to increase when above threshold */ | |
instancesIncrease 1 | |
} | |
lowThreshold { | |
/* The value below which the number of instances is decreased */ | |
value 0.2 | |
/* The number of instances to decrease when below threshold */ | |
instancesDecrease 1 | |
} | |
} | |
]) | |
plugins([ | |
plugin { | |
name "jmx" | |
className "org.cloudifysource.usm.jmx.JmxMonitor" | |
config([ | |
"Total Requests Count": [ | |
"Catalina:type=GlobalRequestProcessor,name=\"http-bio-8080\"", | |
"requestCount" | |
], | |
port: "11099" | |
]) | |
} | |
]) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment