You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2019/06/08 05:54:59 UTC

[GitHub] [incubator-shardingsphere] evenardo opened a new pull request #2523: try commit a startup boosted mode and default set to false

evenardo opened a new pull request #2523: try commit a startup boosted mode and default set to false
URL: https://github.com/apache/incubator-shardingsphere/pull/2523
 
 
   When we used sharding-jdbc for a development environment , if we have many actual tables, like more than 200 total , it's cost more time to start up the sharding-jdbc .  This may cost several times for developers , especially non-elite programmers for debug process.
   
   I try to found out why this happend , then I try to fix or improve some function especially for dev environment.
   
   I used multi threads to get ready for some map data , really, it's cost more connection database , when sharding-jdbc start up . As @terrymanu  said , it may cause database resources exhausted.
   
   Then I make threads in number of [ sqrt(total actual tables) ], assemby a arraylist to split the slice, into parts of alltableNames, to reduce the threads number , in hope to reduce connection to database.
   
   I collected SQLExceptions , re throw them like origin code to upper logic, but can not throw new exceptions like InterruptedException to upper , because it will change the upper function's "throws" . so I droped them.
   
   why I try to commit a unstable function (or it stable but we don't Long-term tested) , and make a switcher to close this function ?
   
   Because , in our small business, or others like us . Our coder are not elited at all , they cost many many time to restart the local environment to debug ,to change propertitys. So sad , in the waiting time, they are very depressed and complaining complaining ... In our case, it's cost more than 4 minutes :(  in one time. And now it's reduce to 40 seconds , that's within temptation and boost morale !
   
   So I hope is , may officer can make a global switcher in a suitable location to let us set this like a dev frendly mode , to let us boosted the startup process , especially  in a develop environment.
   
   Fixes #ISSUSE_ID.
   
   Changes proposed in this pull request:
   
   in class TableMetaDataInitializer
   
       //Here's a switch to open boosted startup mode;
       //before function integrated into base project,
       //you can rebuild org.apache.shardingsphere.core.execute module,
       //change this to true ,then "mvn clean install" to use this function in your local environment.
       private boolean startUpBoostedMode = false;
   
   in function Map<String, TableMetaData> load(final ShardingRule shardingRule):
   
        if (startUpBoostedMode) {
               System.out.println("org.apache.shardingsphere.core.execute.TableMetaDataInitializer:\n" +
                       "    Beta function warn: Startup boosted mode is friendly for dev mode, " +
                       "but it may cause database resources exhausted. \n" +
                       "    Number of sqrt(number of all actual tables) threads created and finished in process. " +
                       "if error occurs, change to stable mode. \n"+
                       "    Or just use this in your local dev environment. ");
           }

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services