private boolean leanTowardShrinking ( Integer smallerPoolSize , int largerPoolSize , double smallerPoolTput , double largerPoolTput ) { boolean shouldShrink = false ; double poolRatio = largerPoolSize / smallerPoolSize ; double tputRatio = largerPoolTput / smallerPoolTput ; double poolTputRatio = poolRatio / tputRatio ; // compare the poolSize ratio and tput ratio between current and largest poolSizes // if tput no better at larger poolSize, or not much better, lean toward shrinking if ( tputRatio < 1.0 ) { // much larger poolSize has smaller tput - lean strongly (75%) toward shrinking shouldShrink = ( flipCoin ( ) && flipCoin ( ) ) ? false : true ; } else if ( poolTputRatio > poolTputRatioHigh ) { // poolSize ratio is much larger than tput ratio - lean strongly (75%) toward shrinking shouldShrink = ( flipCoin ( ) && flipCoin ( ) ) ? false : true ; } else if ( poolTputRatio > poolTputRatioLow ) { // poolSize ratio is slightly larger than tput ratio - lean weakly (50%) toward shrinking shouldShrink = ( flipCoin ( ) ) ? false : true ; } // Format an event level trace point with the key tput ratio data if ( tc . isEventEnabled ( ) && shouldShrink ) Tr . event ( tc , "Tput ratio shrinkScore adjustment, larger poolSizes" , poolTputRatioData ( poolTputRatio , poolRatio , tputRatio , smallerPoolTput , largerPoolTput , smallerPoolSize , largerPoolSize ) ) ; return shouldShrink ; }
Evaluate current poolSize against farthest poolSize to decide whether it makes sense to shrink . The final outcome is probabilistic not deterministic .