Developer Documentation Library > Interviewer - Server > Monitoring and tuning system performance > Load balancing interviewing engines > Examples of UNICOM Intelligence Interviewer load balancing algorithms > Setting PercentLoaded based on counter values
 
Setting PercentLoaded based on counter values
The following algorithm calculates PercentLoaded based on the values of the RestartsPerSec, TimeoutsPerSec, RequestsPerSec, and StartsPerSec counters. If any of these counters exceeds the permitted maximum for that counter, PercentLoaded is set to 100. Otherwise, PercentLoaded is set to the number of interviews currently running as a percentage of the number of interviews permitted to run concurrently.
Dim maxRestartsPerSec, maxTimeoutsPerSec, maxRequestsPerSec, maxStartsPerSec,
concurrentLimit, NoOfInterviews

maxRestartsPerSec = 2
maxTimeoutsPerSec = 10
maxRequestsPerSec = 10
maxStartsPerSec = 10
concurrentLimit = 160

noOfInterviews = (100 * Engine.CurrentInterviews> / concurrentLimit

If (Engine.RestartsPerSec > maxRestartsPerSec) Then
  PercentLoaded = 100
ElseIf (Engine.TimeoutsPerSec > maxTimeoutsPerSec) Then
  PercentLoaded = 100
ElseIf (Engine.RequestsPerSec > maxRequestsPerSec) Then
  PercentLoaded = 100
ElseIf (Engine.StartsPerSec > maxStartsPerSec) Then
  PercentLoaded = 100
Else
  PercentLoaded = NoOfInterviews
End If
See also
Examples of UNICOM Intelligence Interviewer load balancing algorithms