-
Notifications
You must be signed in to change notification settings - Fork 8.7k
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 file write performance #795
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #795 +/- ##
============================================
- Coverage 37.75% 37.16% -0.6%
+ Complexity 1033 1024 -9
============================================
Files 224 224
Lines 8796 8882 +86
Branches 1064 1065 +1
============================================
- Hits 3321 3301 -20
- Misses 5081 5196 +115
+ Partials 394 385 -9
Continue to review full report at Codecov.
|
# Conflicts: # core/src/main/java/io/seata/core/exception/TransactionExceptionCode.java # server/src/main/java/io/seata/server/store/FileTransactionStoreManager.java
# Conflicts: # core/src/main/java/io/seata/core/exception/TransactionExceptionCode.java # server/src/main/java/io/seata/server/store/FileTransactionStoreManager.java
if (!writeDataFile(new TransactionWriteStore(session, logOperation).encode())) { | ||
return false; | ||
} | ||
lastModifiedTime = System.currentTimeMillis(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not get file. lastModifiedTime?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why use file. lastModifiedTime? I'm not sure it get the lastModifiedTime from disk every time
|
||
public void waitForFlush(long timeout) { | ||
try { | ||
this.countDownLatch.await(timeout, TimeUnit.MILLISECONDS); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check return value?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think it should not check return value as rocketmq. even it happend time out , we should not block our process
|
||
private void closeAndFlush(CloseFileRequest req) { | ||
long diff = FILE_TRX_NUM.get() - FILE_FLUSH_NUM.get(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
call syncFlush()? param StoreRequest
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
syncFlush will weakUp. Close does not need
server/src/main/java/io/seata/server/store/FileTransactionStoreManager.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
* optimize fil write performance
Ⅰ. Describe what this PR did
mac: 2.2 GHz Intel Core i7. 4 core .
per_thread_write_file = per_thread_trx_num * 9
===========new file write aync mode====================
thread nums:1, per_thread_trx_num:65535 ,cost2600
thread nums:4, per_thread_trx_num:65535 ,cost13329
thread nums:8, per_thread_trx_num:65535 ,cost27613
thread nums:16, per_thread_trx_num:65535 ,cost57764
===========old file write aync mode====================
thread nums:1, per_thread_trx_num:65535 ,cost17816
thread nums:4, per_thread_trx_num:65535 ,cost42218
thread nums:8, per_thread_trx_num:65535 ,cost87016
thread nums:16, per_thread_trx_num:65535 ,cost176943
Performance improved by more than 60%
set trx_time_out = 1000ms, each saveHistory will save 3000 data.
===========new saveHistory ====================
thread nums:16, per_thread_trx_num:65535 ,cost 60559
===========old saveHistory ====================
thread nums:16, per_thread_trx_num:65535 ,cost90189
Ⅱ. Does this pull request fix one issue?
#858
Ⅲ. Why don't you add test cases (unit test/integration test)?
Ⅳ. Describe how to verify it
Ⅴ. Special notes for reviews