Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sharding-jdbc 5.1.2 startup very slow #18653

Closed
boot-vue opened this issue Jun 28, 2022 · 19 comments · Fixed by #19882
Closed

sharding-jdbc 5.1.2 startup very slow #18653

boot-vue opened this issue Jun 28, 2022 · 19 comments · Fixed by #19882

Comments

@boot-vue
Copy link

sharding-jdbc : 5.1.2

      <dependency>
            <groupId>org.apache.shardingsphere</groupId>
            <artifactId>shardingsphere-jdbc-core-spring-boot-starter</artifactId>
            <version>5.1.2</version>
        </dependency>

tables : 200+

same config, with version 5.1.0 , application startup very fast

change to version 5.1.2 , application start very slow......

@shanrenxj
Copy link

yes, rolling back to 5.1.1 is very fast

@terrymanu
Copy link
Member

What is your configuration and database type?

@boot-vue
Copy link
Author

What is your configuration and database type?

mysql 8

spring:
  shardingsphere:
    datasource:
      names: node1,node2
      node1:
        type: com.zaxxer.hikari.HikariDataSource
        jdbc-url: jdbc:mysql://xxxxxxx:3307/oooo?characterEncoding=utf8&useSSL=false&autoReconnect=true&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
        username: root
        password: vvvv
        driver-class-name: com.mysql.cj.jdbc.Driver
        hikari:
          pool-name: ccc1
          maximum-pool-size: 25
          max-lifetime: 900000
          validation-timeout: 2000
          idle-timeout: 60000
          minimum-idle: 15
      node2:
        type: com.zaxxer.hikari.HikariDataSource
        jdbc-url: jdbc:mysql://oooooo:3308/oooo?characterEncoding=utf8&useSSL=false&autoReconnect=true&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
        username: root
        password: cccccc
        driver-class-name: com.mysql.cj.jdbc.Driver
        hikari:
          pool-name: vvvvv2
          maximum-pool-size: 25
          max-lifetime: 900000
          validation-timeout: 2000
          idle-timeout: 60000
          minimum-idle: 15
    rules:
      readwrite-splitting:
        data-sources:
          oooo:
            type: Static
            props:
              write-data-source-name: node1
              read-data-source-names: node2
              load-balancer-name: random
        load-balancers:
          random:
            type: RANDOM

@linghengqian
Copy link
Member

What if you could exclude JOOQ or specify a later version of JOOQ under JDK11+? New perspectives from #18691 .

@boot-vue
Copy link
Author

What if you could exclude JOOQ or specify a later version of JOOQ under JDK11+? New perspectives from #18691 .

upgrade jooq version from 3.12.3 to 3.17.1

or

exclude jooq dependence , start application both perform well ✔

don't know if there are other effects @linghengqian

@linghengqian
Copy link
Member

linghengqian commented Jun 29, 2022

upgrade jooq version from 3.12.3 to 3.17.1 ✔

@boot-vue
Copy link
Author

yes , version is 3.14.16 , I don't know why it becomes 3.12.3 , didn't find any conflict 😂😂😂

exclude 3.12.3 and add 3.14.16 , it still slow

200+ tables, application start cost about 197.448 seconds


previous change to version 3.17.1 , I still use jdk 1.8 and application start cost about 61.109 seconds

@boot-vue
Copy link
Author

boot-vue commented Jun 29, 2022

image


I know , I use spring boot 2.2.1 , it specify jooq version 3.12.3

@linghengqian
Copy link
Member

linghengqian commented Jun 29, 2022

previous change to version 3.17.1 , I still use jdk 1.8 and application start cost about 61.109 seconds

  • This is logically problematic because the minimum JDK baseline version for JOOQ 3.17.x is 17, which is in https://blog.jooq.org/3-17-0-release-with-computed-columns-audit-columns-pattern-matching-reactive-transactions-and-kotlin-coroutine-support/ 's blog has been explained.

  • ShardingSphere's own SQL dialect translation module I remember was not finished in ShardingSphere 5.1.2, so the default implementation of SQL dialect translation SPI is JOOQ, which is a really tricky problem. 🌝🌝 If there is a self-implement, it should actually be able to replace the default SPI implementation.

  • Or, add a switch within the Config configuration file to this module? Similar to sql-translator-enabled. But this module is part of the database gateway, and I'm not sure how to change it.

  • update in 2022.06.30: I think it's better to wait until Add SQL dialect translator module #17619 is turned off before discussing this switch.

@newchendb
Copy link

I have the same problem. It starts slowly after upgrading from 5.1.1 to 5.1.2

@terrymanu
Copy link
Member

It looks like JooQ problem. I'd like to resolve this problem.
I just remove JooQ from default translator.

@terrymanu
Copy link
Member

@linghengqian
Copy link
Member

linghengqian commented Jul 5, 2022

@terrymanu
Copy link
Member

@zoujianchao Hi, could you have a look for spring boot starter?

@terrymanu
Copy link
Member

@terrymanu After I checked locally, I noticed that spring.shardingsphere.rules of ShardingSphere 5.1.2 does not have a similar module. Is this a specific configuration of the master branch? Also refer to https://shardingsphere.apache.org/document/5.1.2/en/user-manual/shardingsphere-jdbc/spring-boot-starter/rules/ .

update: Update required https://github.com/apache/shardingsphere/blob/master/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-core-spring/shardingsphere-jdbc-core-spring-boot-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json ?

If new issue, is it better to create a new one?

@linghengqian
Copy link
Member

A new SpringBoot Starter related issue is located at #18889 .

@liuwenliang0632
Copy link

@boot-vue do u reslove the promblem?

@linghengqian
Copy link
Member

At the heart of this issue is actually a documentation issue, and I think this issue can be closed.

@boot-vue
Copy link
Author

A new SpringBoot Starter related issue is located at #18889 .

🎃🎃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants