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

optimize: mysql jdbc connect param #3291

Merged
merged 4 commits into from
Dec 14, 2020

Conversation

caohdgege
Copy link
Contributor

Ⅰ. Describe what this PR did

对于MySQL来说,executeBatch的效率受连接参数rewriteBatchedStatements影响较大
然后我们这边插入锁的时候用的是executeBatch,因此加上一个提示让用户如果用的MySQL的话,可以在启动jdbc连接参数加上rewriteBatchedStatements=true

Ⅱ. Does this pull request fix one issue?

Ⅲ. Why don't you add test cases (unit test/integration test)?

Ⅳ. Describe how to verify it

Ⅴ. Special notes for reviews

附上测试的时候的性能结果:

# 没有加rewriteBatchedStatements参数时
i.s.s.s.db.lock.LockStoreDataBaseDAO : insert lock usage: 302, size: 1000
i.s.s.s.db.lock.LockStoreDataBaseDAO : insert lock usage: 248, size: 1000
i.s.s.s.db.lock.LockStoreDataBaseDAO : insert lock usage: 310, size: 1000

i.s.s.s.db.lock.LockStoreDataBaseDAO : insert lock usage: 2663, size: 10000
i.s.s.s.db.lock.LockStoreDataBaseDAO : insert lock usage: 2130, size: 10000
i.s.s.s.db.lock.LockStoreDataBaseDAO : insert lock usage: 2093, size: 10000


# 加了rewriteBatchedStatements参数时
i.s.s.s.db.lock.LockStoreDataBaseDAO : insert lock usage: 22, size: 1000
i.s.s.s.db.lock.LockStoreDataBaseDAO : insert lock usage: 20, size: 1000
i.s.s.s.db.lock.LockStoreDataBaseDAO : insert lock usage: 23, size: 1000

i.s.s.s.db.lock.LockStoreDataBaseDAO : insert lock usage: 204, size: 10000
i.s.s.s.db.lock.LockStoreDataBaseDAO : insert lock usage: 177, size: 10000
i.s.s.s.db.lock.LockStoreDataBaseDAO : insert lock usage: 456, size: 10000

@codecov-io
Copy link

codecov-io commented Nov 19, 2020

Codecov Report

Merging #3291 (46dc17b) into develop (be83b1e) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##             develop    #3291   +/-   ##
==========================================
  Coverage      50.88%   50.88%           
+ Complexity      3281     3280    -1     
==========================================
  Files            612      612           
  Lines          20113    20113           
  Branches        2519     2519           
==========================================
  Hits           10235    10235           
+ Misses          8852     8851    -1     
- Partials        1026     1027    +1     
Impacted Files Coverage Δ Complexity Δ
...o/seata/server/coordinator/DefaultCoordinator.java 54.63% <0.00%> (-0.52%) 28.00% <0.00%> (-1.00%)
...in/java/io/seata/server/session/GlobalSession.java 82.72% <0.00%> (-0.46%) 70.00% <0.00%> (-1.00%)
...in/java/io/seata/rm/datasource/util/JdbcUtils.java 8.75% <0.00%> (+0.35%) 10.00% <0.00%> (+1.00%)

Copy link
Member

@slievrly slievrly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@funky-eyes funky-eyes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@funky-eyes funky-eyes added this to the 1.5.0 milestone Dec 10, 2020
@funky-eyes funky-eyes added the module/config config module label Dec 10, 2020
@slievrly slievrly merged commit f5ee231 into apache:develop Dec 14, 2020
@caohdgege caohdgege deleted the optimize-mysql-jdbc-connect-param branch February 8, 2021 04:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module/config config module
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants