DynScaleディレクティブを1にセットしておくと、動的に優先度を変えてくれるらしい。
svc.c 1034行目あたり
/* * Rescale back-end priorities if needed * runs every 5 minutes */ static void do_rescale(void) { ... sq_average /= n; average /= n; sq_average = sqrt(sq_average - average * average); /* this is now the standard deviation */ sq_average *= 3; /* we only want things outside of 3 standard deviations */ if(ret_val = pthread_mutex_lock(&svc->mut)) { logmsg(LOG_WARNING, "thr_rescale() lock: %s", strerror(ret_val)); continue; } for(be = svc->backends; be; be = be->next) { if(be->be_type != BACK_END || !be->alive || be->disabled || be->n_requests < RESCALE_MIN) continue; if(be->t_average < (average - sq_average)) { be->priority++; if(ret_val = pthread_mutex_lock(&be->mut)) logmsg(LOG_WARNING, "do_rescale() lock: %s", strerror(ret_val)); while(be->n_requests > RESCALE_BOT) { be->n_requests /= 2; be->t_requests /= 2; } if(ret_val = pthread_mutex_unlock(&be->mut)) logmsg(LOG_WARNING, "do_rescale() unlock: %s", strerror(ret_val)); svc->tot_pri++; } if(be->t_average > (average + sq_average) && be->priority > 1) { be->priority--; if(ret_val = pthread_mutex_lock(&be->mut)) logmsg(LOG_WARNING, "do_rescale() lock: %s", strerror(ret_val)); while(be->n_requests > RESCALE_BOT) { be->n_requests /= 2; be->t_requests /= 2; } if(ret_val = pthread_mutex_unlock(&be->mut)) logmsg(LOG_WARNING, "do_rescale() unlock: %s", strerror(ret_val)); svc->tot_pri--; } }
えーっと。。。t_averageがバックエンドの平均応答時間。averageがバックエンド全体のt_averageの平均で、sq_averageがt_averageの標準偏差(×3)。
average±sq_averageの範囲外のバックエンドについて、優先度を上げたり下げたりしていると。
。。。つまり最小応答時間で重み付けを行って、振り分けてるのかな。