Recently, we installed mysql-proxy as our database proxy which backend servers are running as master-slave.

And also we using the lua script to make mysql-proxy working as failover of backends.

{code}
function connect_server()
local s = proxy.global.backends[1]
-- local s = proxy.global.backends[2]

if s.state ~= proxy.BACKEND_STATE_DOWN then
proxy.connection.backend_ndx = 1
-- proxy.connection.backend_ndx = 2
else
-- os.execute("/bin/mail hao.1.ma.ext@nsn.com -s 't66 mysqld is dow' <<<'mysqld is down'")
proxy.connection.backend_ndx = 2
-- proxy.connection.backend_ndx = 1
end
end
{code}


But we met a significant problem of mysql-proxy performance is bad.

So my problem is how to analyze mysql-proxy performance and how to tune it?

BR
Ma Hao