shardingsphere icon indicating copy to clipboard operation
shardingsphere copied to clipboard

Start up for a long time when not in LAN

Open sogngenWang opened this issue 4 years ago • 7 comments

version: v4.1.1

total logic table : about 130+ total datasource : about 730+(about 250+ is in other rooms) total start time cost : about 12 min

We use sharding proxy whith v4.1.1, and there is about 730 datasource mysql, 480 is in the same LAN, 250 is not . The question is when we add a new datasource in config-xxx.yaml , it is nessary to restart sharding-proxy .It cost less than 5s to load 480 datasource metadata (It is no matter), but it cost more than 12min to load 250 datasource's metadata to init . We have no idea to resolve this , is there any good idea to suggest ? Beside, I don't konw can sharding-proxy read new datasource or table config in yaml without restart it ? or can I deploy two sharding-proxy in two different machine room(one in Europe,andLAN is America), and then I just connect one sharding-proxy to query ?

PS: I try to use v5.0.0 release version with sharding proxy , it also has the same question .

thanks

sogngenWang avatar Feb 15 '22 02:02 sogngenWang

Hi @wsg96321 The option to consider is: Upgrade to 5.0.0 and use DistSQL to dynamically add datasources to avoid restarts.

Ref: https://shardingsphere.apache.org/document/current/en/user-manual/shardingsphere-proxy/distsql/syntax/rdl/resource-definition/

RaigorJiang avatar Feb 15 '22 02:02 RaigorJiang

Hi @wsg96321 The option to consider is: Upgrade to 5.0.0 and use DistSQL to dynamically add datasources to avoid restarts.

Ref: https://shardingsphere.apache.org/document/current/en/user-manual/shardingsphere-proxy/distsql/syntax/rdl/resource-definition/

thanks a lot ,I have a try to do it just now. But it still has the same problem althouth it doesn't restart. It costs almost time (50 datasource cost about 5 minutes, I just have a test so it is not all database and table ).Then when I add an datasource (other machine room like Europe), the log show it will flush all datasource (about 50+) , So I also have to wait for all datasource reflush for a long time , and then I can read the data in new datasource. Fortunately, I can query other datasource when it is reflushing. Is there a better idea to resolve it ?

sogngenWang avatar Feb 15 '22 07:02 sogngenWang

The metadata loading is being continuously optimized, 5.1.0 will be released soon, you can try the new version later.

RaigorJiang avatar Feb 15 '22 10:02 RaigorJiang

The metadata loading is being continuously optimized, 5.1.0 will be released soon, you can try the new version later.

Looking forward to 5.1.0 version . But I think metadata loading is not the major problem. Although we maybe can optimized the metadata loading less than 1s, it also needs to cost many time to create TCP connection for jdbc init ? So I think the major problem is how to init jdbc connection parallel, and how to reuse the same datasource IP and Port but different database . Otherwise, it will cost many time to add a new datasource when people add datasource which in other machine room. Or the sharding proxy's position is not in this case which has many datasource across different machine root ?

sogngenWang avatar Feb 16 '22 01:02 sogngenWang

Hi @wsg96321 version 5.1.0 has been released, you can try it now.

Download Links: https://shardingsphere.apache.org/document/current/en/downloads/ Release Notes: https://github.com/apache/shardingsphere/blob/master/RELEASE-NOTES.md

RaigorJiang avatar Feb 17 '22 13:02 RaigorJiang

Hi @wsg96321 version 5.1.0 has been released, you can try it now.

Download Links: https://shardingsphere.apache.org/document/current/en/downloads/ Release Notes: https://github.com/apache/shardingsphere/blob/master/RELEASE-NOTES.md

Hi, I have try to use v5.1.0 in about 159 jdbc connection which has 4 is in the same LAN, and other in another machine room . When I use ADD RESOURCE ds_xxx(URL="",USER="",PASSWORD="",PROPERTIES="") ; to add a new datasource in another machine room, it also need to cost about 5min to init it . I think it doesn't resolve this problem . In proxy's log file , I find HikariPool start a new datasource connection with 1s and cost about 1min before it whthout any log info , but then it process refreshed XAResource about 4min whith 159 times.

below is some log :

.... [INFO ] 07:38:55.166 [Connection-1-ThreadExecutor] com.zaxxer.hikari.HikariDataSource - HikariPool-160 - Starting... [INFO ] 07:38:56.650 [Connection-1-ThreadExecutor] com.zaxxer.hikari.HikariDataSource - HikariPool-160 - Start completed. [INFO ] 07:39:20.419 [Atomikos:1] c.a.d.xa.XATransactionalResource - resource-179-ds_20191: refreshed XAResource [INFO ] 07:40:37.919 [Atomikos:1] c.a.d.xa.XATransactionalResource - resource-269-ds_20210: refreshed XAResource [INFO ] 07:40:39.568 [Atomikos:1] c.a.d.xa.XATransactionalResource - resource-309-ds_20240: refreshed XAResource [INFO ] 07:40:40.280 [Connection-1-ThreadExecutor] c.a.icatch.imp.TransactionServiceImp - Entering shutdown (false, 0)... [INFO ] 07:40:41.239 [Atomikos:1] c.a.d.xa.XATransactionalResource - resource-267-ds_20174: refreshed XAResource [INFO ] 07:40:42.875 [Atomikos:1] c.a.d.xa.XATransactionalResource - resource-252-ds_20204: refreshed XAResource .... [INFO ] 07:43:32.864 [Atomikos:1] c.a.d.xa.XATransactionalResource - resource-235-ds_20170: refreshed XAResource [INFO ] 07:43:34.512 [Atomikos:1] c.a.d.xa.XATransactionalResource - resource-183-ds_20101: refreshed XAResource [INFO ] 07:43:34.662 [Connection-1-ThreadExecutor] c.a.icatch.imp.TransactionServiceImp - Shutdown leaves no pending transactions - ok to delete logfiles [INFO ] 07:43:34.665 [Connection-1-ThreadExecutor] c.a.icatch.provider.imp.AssemblerImp - Loaded jar:file:/home/work/sharding-proxy-5.0.1/lib/transactions-5.0.8.jar!/transactions-defaults.properties [INFO ] 07:43:34.666 [Connection-1-ThreadExecutor] c.a.icatch.provider.imp.AssemblerImp - Loaded jar:file:/home/work/sharding-proxy-5.0.1/lib/shardingsphere-transaction-xa-atomikos-5.1.0.jar!/transactions.properties [WARN ] 07:43:34.667 [Connection-1-ThreadExecutor] c.a.icatch.provider.imp.AssemblerImp - Thanks for using Atomikos! This installation is not registered yet. REGISTER FOR FREE at http://www.atomikos.com/Main/RegisterYourDownload and receive: - tips & advice - working demos - access to the full documentation - special exclusive bonus offers not available to others - everything you need to get the most out of using Atomikos! Thanks for using Atomikos! This installation is not registered yet. REGISTER FOR FREE at http://www.atomikos.com/Main/RegisterYourDownload and receive: - tips & advice - working demos - access to the full documentation - special exclusive bonus offers not available to others - everything you need to get the most out of using Atomikos! [INFO ] 07:43:34.668 [Connection-1-ThreadExecutor] c.a.icatch.provider.imp.AssemblerImp - USING core version: 5.0.8 [INFO ] 07:43:34.668 [Connection-1-ThreadExecutor] c.a.icatch.provider.imp.AssemblerImp - USING: com.atomikos.icatch.default_max_wait_time_on_shutdown = 9223372036854775807 [INFO ] 07:43:34.668 [Connection-1-ThreadExecutor] c.a.icatch.provider.imp.AssemblerImp - USING: com.atomikos.icatch.allow_subtransactions = true [INFO ] 07:43:34.668 [Connection-1-ThreadExecutor] c.a.icatch.provider.imp.AssemblerImp - USING: com.atomikos.icatch.recovery_delay = 300000 [INFO ] 07:43:34.668 [Connection-1-ThreadExecutor] c.a.icatch.provider.imp.AssemblerImp - USING: com.atomikos.icatch.automatic_resource_registration = false [INFO ] 07:43:34.668 [Connection-1-ThreadExecutor] c.a.icatch.provider.imp.AssemblerImp - USING: com.atomikos.icatch.oltp_max_retries = 5 [INFO ] 07:43:34.668 [Connection-1-ThreadExecutor] c.a.icatch.provider.imp.AssemblerImp - USING: com.atomikos.icatch.throw_on_heuristic = false [INFO ] 07:43:34.668 [Connection-1-ThreadExecutor] c.a.icatch.provider.imp.AssemblerImp - USING: com.atomikos.icatch.logcloud_datasource_name = logCloudDS [INFO ] 07:43:34.668 [Connection-1-ThreadExecutor] c.a.icatch.provider.imp.AssemblerImp - USING: com.atomikos.icatch.serial_jta_transactions = false [INFO ] 07:43:34.668 [Connection-1-ThreadExecutor] c.a.icatch.provider.imp.AssemblerImp - USING: com.atomikos.icatch.jvm_id = 16944@us-aliyun-loget-airflow-001 [INFO ] 07:43:34.668 [Connection-1-ThreadExecutor] c.a.icatch.provider.imp.AssemblerImp - USING: com.atomikos.icatch.log_base_dir = ./logs [INFO ] 07:43:34.668 [Connection-1-ThreadExecutor] c.a.icatch.provider.imp.AssemblerImp - USING: com.atomikos.icatch.max_actives = 10000 [INFO ] 07:43:34.668 [Connection-1-ThreadExecutor] c.a.icatch.provider.imp.AssemblerImp - USING: com.atomikos.icatch.checkpoint_interval = 50000 [INFO ] 07:43:34.668 [Connection-1-ThreadExecutor] c.a.icatch.provider.imp.AssemblerImp - USING: com.atomikos.icatch.enable_logging = true [INFO ] 07:43:34.668 [Connection-1-ThreadExecutor] c.a.icatch.provider.imp.AssemblerImp - USING: com.atomikos.icatch.log_base_name = xa_tx [INFO ] 07:43:34.668 [Connection-1-ThreadExecutor] c.a.icatch.provider.imp.AssemblerImp - USING: com.atomikos.icatch.max_timeout = 300000 [INFO ] 07:43:34.668 [Connection-1-ThreadExecutor] c.a.icatch.provider.imp.AssemblerImp - USING: com.atomikos.icatch.tm_unique_name = 172.20.70.23.tm [INFO ] 07:43:34.668 [Connection-1-ThreadExecutor] c.a.icatch.provider.imp.AssemblerImp - USING: com.atomikos.icatch.forget_orphaned_log_entries_delay = 86400000 [INFO ] 07:43:34.668 [Connection-1-ThreadExecutor] c.a.icatch.provider.imp.AssemblerImp - USING: com.atomikos.icatch.oltp_retry_interval = 10000 [INFO ] 07:43:34.668 [Connection-1-ThreadExecutor] c.a.icatch.provider.imp.AssemblerImp - USING: com.atomikos.icatch.force_shutdown_on_vm_exit = false [INFO ] 07:43:34.668 [Connection-1-ThreadExecutor] c.a.icatch.provider.imp.AssemblerImp - USING: com.atomikos.icatch.default_jta_timeout = 300000 [INFO ] 07:43:34.668 [Connection-1-ThreadExecutor] c.a.icatch.provider.imp.AssemblerImp - Using default (local) logging and recovery..

sogngenWang avatar Feb 21 '22 08:02 sogngenWang

@wsg96321 Valuable feedback, let's wait for @menghaoranss to help see if it can be optimized.

RaigorJiang avatar Feb 21 '22 12:02 RaigorJiang