2. Auto-Scaling and Cloud Bursting : 2.6 Autoscaling and Bursting a vApp : 2.6.1 Pull Implementation Example
   
2.6.1 Pull Implementation Example
This example shows how to upscale a vApp when the number of current connections on a web server goes above a threshold and then downscale a vApp when that number falls below another threshold.
To retrieve the members above and below a current connections threshold, use the F5 iControl plug-in by creating a workflow that contains the following script to query the load balance pool statistics:
var localLBPoolMemberStatistics = pool.getMemberStatistics();
var membersAboveMaxConnectionThreshold = new Array();
var membersBelowMinConnectionThreshold = new Array();
for each (var localLBPoolMemberStatistic in localLBPoolMemberStatistics) {
var localLBPoolMemberStatisticEntries = localLBPoolMemberStatistic.getStatistics();
for each (var localLBPoolMemberStatisticEntry in localLBPoolMemberStatisticEntries) {
var ipPort = localLBPoolMemberStatisticEntry.getMember();
var commonStatistics = localLBPoolMemberStatisticEntry.getStatistics();
for each (var commonStatistic in commonStatistics) {
System.log(ipPort.getAddress() + "\t" + commonStatistic.getType() + "\t" + commonStatistic.getValue().getLow() + "\t" + commonStatistic.getValue().getHigh());
if (commonStatistic.getType() =="STATISTIC_SERVER_SIDE_CURRENT_CONNECTIONS") {
var currentConnections = commonStatistic.getValue().getLow();
if (currentConnections >= connectionMaxThreshold) membersAboveMaxConnectionThreshold.push(ipPort.getAddress());
if (currentConnections <= connectionMinThreshold) membersBelowMinConnectionThreshold.push(ipPort.getAddress());
}
}
}
}
 
The Autoscale a vApp workflow in the PSO/vCloud Director Auto scaling and bursting/Policy/F5 folder uses the preceding technical workflow to trigger the vApp upscaling and downscaling.
Figure 8. Workflow Schema: Autoscale a vApp