Separate read and write the application layer strategy

1. Sharding-JDBC Driver of com.mysql.jdbc.replicationDriver
2.mybatis plugin (sqlType: SELECT, Update, INSERT)
3.spring MyBatis plugin + + Aop annotation
4.spring dynamic data sources MyBatis plugin +
AbstractRoutingDataSource + MyBatis interceptor plugin
The middleware mysql-proxy, mycat
advantages:
@ 1, and the program does not require any changes to be implemented separate read and write
@ 2, dynamically add a data source without restarting the program
disadvantages:
. @ 1 is dependent on the middleware program, cause switching database becomes difficult
@ 2. middleware made by the transit agency, performance degradation

Guess you like

Origin blog.csdn.net/weixin_39507514/article/details/88896696