上午看到Mysql网站的Mysql Proxy在半年后终于更新了,抓来尝尝鲜,测试了一下。
另:转载的请留个我的连接,谢谢。
Mysql Proxy 0.8 Simple Test
ChangeLog
1 兼容性修复
客户端使用早于4.0的Mysql协议引起段故障的问题
由于协议一个变化,不能工作于Mysql5.1.15的问题
2 Lua脚本更新
ro-balance.lua
active-transactions.lua
rw-splitting.lua
3 其它变化
堆栈跟踪时,输出行号
选项--proxy-backend-addresses接受多个主机地址
可用proxy.PROXY_VERSION取网关版本号
选项use-log-syslog可用
4 性能改进
多线程模块允许多个网络事件并发
请求过多时,网关会无法接收包,现在加大了队列
解决创建连接时存在内存泄漏,导致内存大量消耗的问题
解决不能接收于16M的包的问题
Test
"2.sql"里面装了10条常用语句,使用mysqlslap简单测试
对比基准, rw131.lua + Mysql Proxy 0.7.2
mysqlslap --no-defaults --concurrency=10,30,50 --create-schema=game131_site_20080107 --iterations=10 --query=2.sql
Benchmark
Average number of seconds to run all queries: 0.141 seconds
Minimum number of seconds to run all queries: 0.127 seconds
Maximum number of seconds to run all queries: 0.161 seconds
Number of clients running queries: 10
Average number of queries per client: 9
Benchmark
Average number of seconds to run all queries: 4.852 seconds
Minimum number of seconds to run all queries: 3.139 seconds
Maximum number of seconds to run all queries: 9.043 seconds
Number of clients running queries: 30
Average number of queries per client: 9
Benchmark
Average number of seconds to run all queries: 7.601 seconds
Minimum number of seconds to run all queries: 7.440 seconds
Maximum number of seconds to run all queries: 7.648 seconds
Number of clients running queries: 50
Average number of queries per client: 9
测试 rw-splitting.lua + Mysql Proxy 0.8
mysqlslap --no-defaults --concurrency=10,30,50 --create-schema=game131_site_20080107 --iterations=10 --query=2.sql
Benchmark
Average number of seconds to run all queries: 0.172 seconds
Minimum number of seconds to run all queries: 0.121 seconds
Maximum number of seconds to run all queries: 0.223 seconds
Number of clients running queries: 10
Average number of queries per client: 9
Benchmark
Average number of seconds to run all queries: 0.487 seconds
Minimum number of seconds to run all queries: 0.410 seconds
Maximum number of seconds to run all queries: 0.528 seconds
Number of clients running queries: 30
Average number of queries per client: 9
Benchmark
Average number of seconds to run all queries: 0.826 seconds
Minimum number of seconds to run all queries: 0.687 seconds
Maximum number of seconds to run all queries: 0.879 seconds
Number of clients running queries: 50
Average number of queries per client: 9
线程较少时,改进不大,并发稍大,Mysql Proxy 0.8的优势就很明显了
装入自己的rw131.lua取代官方rw-splitting.lua脚本
测试 rw131.lua + Mysql Proxy 0.8
mysqlslap --no-defaults --concurrency=10,30,50 --create-schema=game131_site_20080107 --iterations=10 --query=2.sql
Benchmark
Average number of seconds to run all queries: 0.121 seconds
Minimum number of seconds to run all queries: 0.106 seconds
Maximum number of seconds to run all queries: 0.143 seconds
Number of clients running queries: 10
Average number of queries per client: 9
Benchmark
Average number of seconds to run all queries: 0.339 seconds
Minimum number of seconds to run all queries: 0.324 seconds
Maximum number of seconds to run all queries: 0.379 seconds
Number of clients running queries: 30
Average number of queries per client: 9
Benchmark
Average number of seconds to run all queries: 0.559 seconds
Minimum number of seconds to run all queries: 0.524 seconds
Maximum number of seconds to run all queries: 0.618 seconds
Number of clients running queries: 50
Average number of queries per client: 9
成绩稍微提升,但几次测试中,偶尔会出错误"Lost connection to MySQL server during query",脚本在Proxy 0.8下还需修改
Mysql Proxy 0.8 初步印象很好,改进很大,待测试稳定性引入生产环境。