xiamenmin opened a new issue, #21964:
URL: https://github.com/apache/shardingsphere/issues/21964

   ## Question
   When I use the cCONNECTION_STRICTLY mode, I have the problem of getting 
database connections and waiting for each other in a concurrent scenario.
   
   ###  Business scene
   - The current data is divided into 10 tables, and when I configure 
maxConnectionSizePerQuery = 5, and the instantaneous concurrency is > 8, the 
following problems will occur
   
   ### Configuration
   - MaxActive = 15
   - MaxWait = 60_000
   - max.connections.size.per.query = 5
   - DruidDataSource
   - Version: apache-shardingsphere-jdbc-4.1.1
   
   I add comments to the source code
   ``` java
   package org.apache.shardingsphere.shardingjdbc.jdbc.adapter;
   
   public abstract class AbstractConnectionAdapter extends 
AbstractUnsupportedOperationConnection {
    private List<Connection> createConnections(final String dataSourceName, 
final DataSource dataSource, final int connectionSize) throws SQLException {
           List<Connection> result = new ArrayList<>(connectionSize);
           for (int i = 0; i < connectionSize; i++) {
               try {
                   System.out.println("Connections name:" + 
Thread.currentThread().getName() + "dataSourceName:" + dataSourceName + " 
progress:" + result.size() + "/" + connectionSize);
                  ....
           }
           return result;
       }
   }
   ```
   
   ### Running result log
   Connections name:ForkJoinPool.commonPool-worker-9 dataSourceName:cmc 
progress:1/5
   Connections name:ForkJoinPool.commonPool-worker-6 dataSourceName:cmc 
progress:1/5
   Connections name:ForkJoinPool.commonPool-worker-8 dataSourceName:cmc 
progress:1/5
   Connections name:ForkJoinPool.commonPool-worker-1 dataSourceName:cmc 
progress:1/5
   Connections name:ForkJoinPool.commonPool-worker-11 dataSourceName:cmc 
progress:1/5
   Connections name:ForkJoinPool.commonPool-worker-10 dataSourceName:cmc 
progress:1/5
   Connections name:ForkJoinPool.commonPool-worker-4 dataSourceName:cmc 
progress:1/5
   Connections name:ForkJoinPool.commonPool-worker-2 dataSourceName:cmc 
progress:2/5
   Connections name:ForkJoinPool.commonPool-worker-15 dataSourceName:cmc 
progress:2/5
   Connections name:ForkJoinPool.commonPool-worker-13 dataSourceName:cmc 
progress:1/5
   
   ### Problems
   - Wait for each other to get the thread pool
   - maxWait timeout
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: 
[email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to