improve isWindows method in HashedWheelTimer#6845
Merged
htynkn merged 2 commits intoapache:masterfrom Oct 30, 2020
Merged
Conversation
Member
|
this change makes sense to me and will merge soon when CI pass. Another thing is current way to check OS maybe not good enough. there are many utils can do similar work: Maybe this is something we can improve in the future |
htynkn
approved these changes
Oct 30, 2020
Codecov Report
@@ Coverage Diff @@
## master #6845 +/- ##
============================================
- Coverage 59.15% 59.00% -0.15%
+ Complexity 510 506 -4
============================================
Files 1028 1028
Lines 41534 41535 +1
Branches 6041 6041
============================================
- Hits 24570 24509 -61
- Misses 14194 14244 +50
- Partials 2770 2782 +12 Continue to review full report at Codecov.
|
Member
|
thanks for your contribution :) |
LeeGuoPing
added a commit
to LeeGuoPing/dubbo
that referenced
this pull request
Nov 3, 2020
improve isWindows method in HashedWheelTimer (apache#6845)
chickenlj
pushed a commit
to chickenlj/incubator-dubbo
that referenced
this pull request
Nov 25, 2020
AlbumenJ
added a commit
to AlbumenJ/dubbo
that referenced
this pull request
May 26, 2021
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Memory usage is too high。frequently GC
发现所有分支皆有此问题,则提交到主分支
#6820
#6808
bug 所在文件 https://github.com/apache/dubbo/blob/master/dubbo-common/src/main/java/org/apache/dubbo/common/timer/HashedWheelTimer.java
出现问题的方法:
private boolean isWindows() { return System.getProperty("os.name", "").toLowerCase(Locale.US).contains("win"); }
问题产生原因:
1.waitForNextTick() 中无限调用 isWindows();
2.toLowerCase(Locale.US) 将急速产生 char[] 对象。导致内存占用过高。
解决方案:
` private static boolean isWindows = System.getProperty("os.name", "").toLowerCase(Locale.US).contains("win");
private boolean isWindows() {
return isWindows;
}`
close #6820