连接模式定义
org.apache.shardingsphere.core.constant.ConnectionMode
public enum ConnectionMode {
MEMORY_STRICTLY, CONNECTION_STRICTLY
}
两种模式的差别
内存限制模式:对于同一数据源,如果有4张分表分别查询,那么执行时,会获取4个连接并行,每个连接执行1个查询语句;
连接限制模式:对于同一数据源,如果有4张分表分别查询,那么执行时,最多获取max.connections.size.per.query(max.connections.size.per.query默认值1)个连接并行,此时4个查询语句串行;如果max.connections.size.per.query设置成2,则分成2组,每个连接执行2个查询语句;
连接模式选择
org.apache.shardingsphere.core.execute.sql.prepare.SQLExecutePrepareTemplate#getSQLExecuteGroups
private List<ShardingExecuteGroup<StatementExecuteUnit>> getSQLExecuteGroups(
final String dataSourceName, final List<SQLUni