获取相应的权重
array Core_Controller_RunTime::mysql_get_weight( array $status )
参数列表
参数 类型 描述 默认值 $statusarray$status 
array protected function mysql_get_weight($status)
{
    $data = array();
    // 处理weight
    foreach ($status as $s => $v)
    {
        if ( false===$v['status'] )
        {
            // 服务器出问题
            $data[$s] = false;
            continue;
        }
        // 运行数 通常在1-20之间
        if (!$v['running']>0)$v['running']=1;
        $weight = 100/$v['running'];
        // 连接数,通常在1-100之间
        if (!$v['connected']>0)$v['connected']=1;
        $weight += 50/$v['connected'];
        // 执行时间
        if ($v['time']<=0.1)
        {
            $weight += sqrt(1/$v['time'])*0.6;
        }
        elseif ($v['time']<=1)
        {
            $weight = $weight * 0.6;
        }
        elseif ($v['time']<=2)
        {
            $weight = $weight * 0.1;
        }
        else
        {
            $weight = 1;
        }
        // 从数据库延迟
        if ( $v['delay']<=3 )
        {
            $weight = $weight * 1.5;
        }
        elseif ( $v['delay']<=600 )
        {
            $weight = $weight / sqrt($v['delay']);
        }
        else
        {
            // 超过600秒的weight=0
            $weight = 1;
        }
        $data[$s] = (int)$weight;
    }
    $this->output('=====================weight=================');
    print_r($data);
    return $data;
}