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

Reduce memory allocation during address change notification. #5613

Merged
merged 22 commits into from
May 7, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
f7e0bf5
performance tuning, reduce memo allocation on address notification path.
chickenlj Dec 27, 2019
074a4e7
performance tuning:
chickenlj Jan 9, 2020
77911ea
remove timestamp key from default provider registry keys
chickenlj Jan 9, 2020
cd0f4d1
refactor: build modifiable sub URL
chickenlj Feb 7, 2020
35652e0
user modifiable URL in certain path.
chickenlj Feb 7, 2020
c5d76f3
fix ClusterUtils according to review
chickenlj Feb 9, 2020
1c42e11
enhance registry notification event merge mechanism
chickenlj Feb 9, 2020
4361579
use positive delta
chickenlj Feb 9, 2020
ac720cc
add a quick documentation link
chickenlj Mar 27, 2020
19c2bf6
Merge branch 'master' into registry-perf
chickenlj Mar 27, 2020
616bfeb
merge master
chickenlj Apr 1, 2020
506bb43
Merge branch 'master' of https://github.com/apache/dubbo
chickenlj Apr 2, 2020
c42ecae
Merge branch 'master' of https://github.com/apache/dubbo
chickenlj Apr 3, 2020
d122482
Merge branch 'master' of https://github.com/apache/dubbo
chickenlj Apr 3, 2020
8e8a3d4
Merge branch 'master' of https://github.com/apache/dubbo
chickenlj Apr 13, 2020
3fef429
Merge branch 'master' of https://github.com/apache/dubbo
chickenlj Apr 17, 2020
7e9c7db
Merge branch 'master' of https://github.com/apache/dubbo
chickenlj Apr 22, 2020
b73a967
Merge branch 'master' of https://github.com/apache/dubbo
chickenlj Apr 28, 2020
6b16c54
Merge branch 'master' into registry-perf
chickenlj May 1, 2020
880d450
enable URLStrParser
chickenlj May 7, 2020
e594cc3
Merge branch 'master' of https://github.com/apache/dubbo
chickenlj May 7, 2020
17c419b
Merge branch 'master' into registry-perf
chickenlj May 7, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix ClusterUtils according to review
  • Loading branch information
chickenlj committed Feb 9, 2020
commit c5d76f3ef669fe8f2d6dcda4ca8912c5b0d7140d
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
import static org.apache.dubbo.common.constants.CommonConstants.THREADPOOL_KEY;
import static org.apache.dubbo.common.constants.CommonConstants.THREADS_KEY;
import static org.apache.dubbo.common.constants.CommonConstants.THREAD_NAME_KEY;
import static org.apache.dubbo.common.utils.CollectionUtils.isNotEmptyMap;
import static org.apache.dubbo.common.utils.StringUtils.isNotEmpty;
import static org.apache.dubbo.remoting.Constants.TRANSPORTER_KEY;

/**
Expand All @@ -56,22 +58,20 @@ public static URL mergeUrl(URL remoteUrl, Map<String, String> localMap) {
remoteMap.remove(ALIVE_KEY);
remoteMap.remove(TRANSPORTER_KEY);
chickenlj marked this conversation as resolved.
Show resolved Hide resolved

if (localMap != null && localMap.size() > 0) {
String remoteApplication = remoteMap.get(APPLICATION_KEY);
remoteMap.put(REMOTE_APPLICATION_KEY, remoteMap.get(APPLICATION_KEY));

if (isNotEmptyMap(localMap)) {
remoteMap.putAll(localMap);
remoteMap.put(REMOTE_APPLICATION_KEY, remoteApplication);

// Combine filters and listeners on Provider and Consumer
String remoteFilter = remoteMap.get(REFERENCE_FILTER_KEY);
String localFilter = localMap.get(REFERENCE_FILTER_KEY);
if (remoteFilter != null && remoteFilter.length() > 0
&& localFilter != null && localFilter.length() > 0) {
if (isNotEmpty(remoteFilter) && isNotEmpty(localFilter)) {
remoteMap.put(REFERENCE_FILTER_KEY, remoteFilter + "," + localFilter);
}
String remoteListener = remoteMap.get(INVOKER_LISTENER_KEY);
String localListener = localMap.get(INVOKER_LISTENER_KEY);
if (remoteListener != null && remoteListener.length() > 0
&& localListener != null && localListener.length() > 0) {
if (isNotEmpty(remoteListener) && isNotEmpty(localListener)) {
remoteMap.put(INVOKER_LISTENER_KEY, remoteListener + "," + localListener);
}
}
Expand Down
8 changes: 5 additions & 3 deletions dubbo-common/src/main/java/org/apache/dubbo/common/URL.java
Original file line number Diff line number Diff line change
Expand Up @@ -1013,9 +1013,11 @@ public URL addParameters(Map<String, String> parameters) {
return this;
}

Map<String, String> map = new HashMap<>(getParameters());
map.putAll(parameters);
return new URL(protocol, username, password, host, port, path, map);
Map<String, String> srcParams = getParameters();
Map<String, String> newMap = new HashMap<>((int) ((srcParams.size() + parameters.size()) / 0.75 + 1));
newMap.putAll(srcParams);
newMap.putAll(parameters);
return new URL(protocol, username, password, host, port, path, newMap);
}

public URL addParametersIfAbsent(Map<String, String> parameters) {
Expand Down