Skip to content

Instantly share code, notes, and snippets.

View itaifrenkel's full-sized avatar

Itai Friendinger itaifrenkel

  • Forter
  • Tel Aviv
View GitHub Profile
@itaifrenkel
itaifrenkel / tomcat-location-aware-service.groovy
Created November 2, 2012 12:45
Recipe - Location Aware Scaling Rules
service {
extend "../../../services/tomcat"
numInstances 4
minAllowedInstances 4
maxAllowedInstances 10
locationAware true
minAllowedInstancesPerLocation 2
maxAllowedInstancesPerLocation 10
@itaifrenkel
itaifrenkel / location_aware_scaling_rules_recovery
Created November 2, 2012 12:27
Network Failure Recovery - Location Aware Scaling Rules
+-------------------+
| Load Balancer |
+--------+----------+
|
|
+----------------+---------+------+---------------+---------------+
| | | | |
+------+-----+ +------+-----+ +------+-----+ +------+-----+ +------+-----+
| Web Server | | Web Server | | Web Server | | Web Server | | Web Server |
| Location 1 | | Location 1 | | Location 2 | | Location 2 | | Location 2 |
@itaifrenkel
itaifrenkel / location_aware_compensation
Created November 2, 2012 12:09
Location Network Failure Compensation - Location Aware Scaling Rules
+-------------------+
| Load Balancer |
+--------+----------+
|
|
+ + +------+---------------+---------------+
| | | | |
+------+-----+ +------+-----+ +------+-----+ +------+-----+ +------+-----+
| Web Server | | Web Server | | Web Server | | Web Server | | Web Server |
| Location 1 | | Location 1 | | Location 2 | | Location 2 | | Location 2 |
@itaifrenkel
itaifrenkel / location_aware_scaling_rules_failure
Created November 2, 2012 12:01
Location Network Failure - Location Aware Scaling Rules
+-------------------+
| Load Balancer |
+--------+----------+
|
|
+ + +------+---------------+
| | | |
+------+-----+ +------+-----+ +------+-----+ +------+-----+
| Web Server | | Web Server | | Web Server | | Web Server |
| Location 1 | | Location 1 | | Location 2 | | Location 2 |
@itaifrenkel
itaifrenkel / location_aware_scaling_rules_steadystate
Created November 2, 2012 11:59
Steady State - Location Aware Scaling Rules
+-------------------+
| Load Balancer |
+--------+----------+
|
|
+----------------+---------+------+---------------+
| | | |
+------+-----+ +------+-----+ +------+-----+ +------+-----+
| Web Server | | Web Server | | Web Server | | Web Server |
| Location 1 | | Location 1 | | Location 2 | | Location 2 |
scalingRule {
serviceStatistics {
metric "counter"
movingTimeRangeInSeconds 5
statistics Statistics.averageOfAverages
}
AtomicLong counter = new AtomicLong(0);
// expose counter as a monitor
monitors ([
"counter" : {
return counter.get();
}])
// inject counter value
customCommands ([
@itaifrenkel
itaifrenkel / tomcat-service.groovy
Created May 25, 2012 15:39
Tomcat scaling rule
scalingRule {
serviceStatistics {
metric "Total Requests Count"
movingTimeRangeInSeconds 20
statistics Statistics.maximumThroughput
}
highThreshold {
value 1 // request per second
plugin {
name "jmx"
className "org.cloudifysource.usm.jmx.JmxMonitor"
config([
"Total Requests Count": [
"Catalina:type=GlobalRequestProcessor,name=\"http-bio-${httpPort}\"",
"requestCount"
],
@itaifrenkel
itaifrenkel / tomcat-service.groovy
Created May 14, 2012 16:28
Cloudify Tomcat recipe DSL file
// Create a new Service object and initialize it with this closure
service {
//calls setName(), setType(), etc...
name "tomcat"
type "WEB_SERVER"
numInstances 1
// context is injected automatically
def portIncrement =