其中一个或一个客户将MySQl后端作为其解决方案的一部分。
他们已将其配置为每个客户端拥有一个公共主数据库和一个特定的从属数据库(它们有10个以上的从属服务器)。他们正在使用MySQL代理。
他们正面临一些性能问题,包括排队的数据库插入/更新,并花了很长时间写入从属数据库。
您能否建议如何改进?是否有可用于帮助确定问题所在的工具?这看起来像是一种标准方法(通过MySQL代理控制客户端特定从属的普通主机)吗?
任何建议都将受到赞赏。
谢谢,
安迪
答案 0 :(得分:0)
我有同样的行为,但我的麻烦是下一个:
我的一个更新是完成错误,mysql代理(和rw-splitter.lua特定)处理这种情况,如连接可能被另一个客户端重用,并返回到池的连接。这意味着,当客户端收到错误并尝试回滚事务时,它会从池中传递给另一个连接或新连接,但它没有任何效果。同时失败的UPDATE进程在事务中出现错误,直到事务不会被超时回滚(但在我的情况下,mysql-proxy默认为28800秒)这么长。
问题已解决。
修补程序:
在rw-splitter.lua中找到下一个块:
is_in_transaction = flags.in_trans
local have_last_insert_id = (res.insert_id and (res.insert_id > 0))
if not is_in_transaction and
not is_in_select_calc_found_rows and
not have_last_insert_id then
并将其更改为
if res.query_status == proxy.MYSQLD_PACKET_ERR and is_in_transaction then
if is_debug then
print ("(read_query_result) ERROR happened while transaction staying on the same backend")
end
return
end
is_in_transaction = flags.in_trans
local have_last_insert_id = (res.insert_id and (res.insert_id > 0))
if not is_in_transaction and
not is_in_select_calc_found_rows and
not have_last_insert_id then