测试环境:
服务器A:webServer
nginx:8个worker子进程
php5-cgi:50个
sqlrelay:50个
cpu: 4core*2, memory: 6G, X64
服务器B:dbServer
mysql:最大可能连接数500
cpu: 4core*2, memory: 12G, X64
并发客户端*2:
每个4096并发,使用apache2的ab工具来做压力
[codesyntax lang="c"]

ab -c 4096 -n 409600 http://ip/sqlrelay.php

[/codesyntax]

-----------------------------------------------------

MYSQL测试:
[codesyntax lang="c"]

最慢的10个连接:
55.4280281067
55.4549694061
57.0089817047
62.9239082336
67.5110816956
67.9988861084
79.0688991547
83.5778713226
92.5869941711
95.8170890808

[/codesyntax]
[codesyntax lang="c"]

最快的10个连接:
0.319004058838
0.319004058838
0.319957733154
0.324964523315
0.324964523315
0.326156616211
0.326871871948
0.327110290527
0.327825546265
0.327825546265

[/codesyntax]
[codesyntax lang="c"]

平均值:
0.8870716434127
执行次数:
1488846
连接成功:
100%

[/codesyntax]

-----------------------------------------------------

MYSQL测试:
[codesyntax lang="c"]

最慢的10个连接:
1.99890136719
2.24089622498
2.29692459106
2.34198570251
2.74896621704
2.79712677002
2.87103652954
3.14688682556
3.1681060791
3.72791290283

[/codesyntax]
[codesyntax lang="c"]

最快的10个连接:
0.0278949737549
0.0278949737549
0.0278949737549
0.0288486480713
0.0288486480713
0.0288486480713
0.0288486480713
0.0288486480713
0.0288486480713
0.0288486480713

[/codesyntax]
[codesyntax lang="c"]

平均值:
0.0368741791852217
执行次数:
1783051
连接成功:
100%

[/codesyntax]

-----------------------------------------------------

Appendix:
测试脚本:
SQLRELAY脚本:
[codesyntax lang="php"]

<?php
//echo '<pre>';
try {
    $startTime = getMicroTime();

    $con = sqlrcon_alloc("10.20.0.68",9191,"","sladmin","123",0,1);
    $cur = sqlrcur_alloc($con);

    $endTime = getMicroTime();
    $timeConsumed = ($endTime - $startTime) * 1000;

    $queryResult = sqlrcur_sendQuery($cur, "select * from users001");

    if ($queryResult) {
        syslog(LOG_ERR, 'SQLRELAY: ' . $timeConsumed); // ERROR LEVEL
    } else {
        syslog(LOG_ERR, 'SQLRELAY_CONNECTION_FAILED!');
    }

    /*
    if (!$queryResult) {
            echo sqlrcur_errorMessage($cur);
            echo "<br>";
    } else {
        for ($row = 0; $row < sqlrcur_rowCount($cur); $row++) {
            for ($col = 0; $col < sqlrcur_colCount($cur); $col++) {
                echo sqlrcur_getField($cur, $row, $col);
                echo ",";
            }
            echo "<br>";
        }
    }
    */

    sqlrcon_endSession($con);

    sqlrcur_free($cur);
    sqlrcon_free($con);
} catch (Exception $e) {
    //print_r($e);
}
//echo '</pre>';

function getMicroTime() {
    list($usec, $sec) = explode(" ", microtime());
    return ((float)$usec + (float)$sec);
}

[/codesyntax]
MYSQL脚本:
[codesyntax lang="php"]

<?php
//echo '<pre>';
try {
    $startTime = getMicroTime();

    $handle = mysql_connect('10.20.0.68', 'root', '123');
    $connected = mysql_select_db('pvzs', $handle);

    $endTime = getMicroTime();
    $timeConsumed = ($endTime - $startTime) * 1000;

    if ($connected) {
        syslog(LOG_ERR, 'MYSQL: ' . $timeConsumed); // ERROR LEVEL
    } else {
        syslog(LOG_ERR, 'MYSQL_CONNECTION_FAILED!');die;
    }

    $result = mysql_query('select * from users001', $handle);
    mysql_fetch_assoc($result);

} catch (Exception $e) {
    //print_r($e);
}
//echo '</pre>';

function getMicroTime() {
    list($usec, $sec) = explode(" ", microtime());
    return ((float)$usec + (float)$sec);
}

[/codesyntax]
SQLRELAY配置:
[codesyntax lang="xml"]

<?xml version="1.0"?>
<!DOCTYPE instances SYSTEM "sqlrelay.dtd">
<instances>
    <instance id="pvzs" port="9191" socket="/tmp/pvzs.socket" dbase="mysql" connections="100" maxconnections="100" maxqueuelength="0" growby="10" ttl="60" endofsession="commit" sessiontimeout="60" cursors="0" authtier="listener" handoff="pass">
        <users>
            <user user="sladmin" password="123"/>
        </users>
        <connections>
            <connection connectionid="pvzscon" string="host=127.0.0.1;port=3306;user=root;password=123;db=pvzs" metric="1"/>
        </connections>
    </instance>
</instances>

[/codesyntax]