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

Add a callback 'onBusy' used to adaptive rate limit #1401

Merged
merged 4 commits into from
Apr 14, 2021
Merged

Conversation

Linary
Copy link
Contributor

@Linary Linary commented Mar 22, 2021

Change-Id: I03859dbc9dc2ae71a2a47f3072d65276565ebba0

coderzc
coderzc previously approved these changes Mar 22, 2021
@@ -112,6 +113,7 @@ public void onApply(Iterator iter) {
LOG.debug("Node role: {}", this.node().selfIsLeader() ?
"leader" : "follower");
StoreClosure closure = null;
List<Future<?>> futures = new ArrayList<>();
Copy link
Contributor

Choose a reason for hiding this comment

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

move to line 138

Copy link
Contributor Author

Choose a reason for hiding this comment

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

line 156 need use it

@@ -133,7 +135,7 @@ public void onApply(Iterator iter) {
byte[] bytes = iter.getData().array();
// Follower seems no way to wait future
// Let the backend thread do it directly
this.context.backendExecutor().submit(() -> {
futures.add(this.context.backendExecutor().submit(() -> {
Copy link
Contributor

Choose a reason for hiding this comment

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

how many tasks in general?

Copy link
Contributor Author

@Linary Linary Apr 2, 2021

Choose a reason for hiding this comment

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

about 10 ~ 20

@@ -285,6 +286,13 @@ public void onError(PeerId peer, Status status) {
}
}

@Override
public void onBusy(PeerId peer, Status status) {
Copy link
Contributor

Choose a reason for hiding this comment

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

seperate into 2 commits:

  1. raft commit for: raft/* and raft-tools.sh
  2. task commit for: TaskManager and rest-server.properties

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@Linary Linary changed the title Some improve for raft backend Add a callback 'onBusy' used to adaptive rate limit Apr 2, 2021
}
iter.next();
}
System.out.println("futures size: " + count);
Copy link
Contributor

Choose a reason for hiding this comment

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

remove it

print_usage
;;
# list-peers
--list-peers|-l)
Copy link
Contributor

Choose a reason for hiding this comment

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

update to list_peers and seperate the commit

@codecov
Copy link

codecov bot commented Apr 2, 2021

Codecov Report

Merging #1401 (eed2800) into master (39b9474) will decrease coverage by 0.04%.
The diff coverage is 28.57%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #1401      +/-   ##
============================================
- Coverage     62.09%   62.05%   -0.05%     
+ Complexity     5854     5853       -1     
============================================
  Files           386      386              
  Lines         32290    32297       +7     
  Branches       4506     4507       +1     
============================================
- Hits          20052    20042      -10     
- Misses        10201    10216      +15     
- Partials       2037     2039       +2     
Impacted Files Coverage Δ Complexity Δ
.../baidu/hugegraph/license/LicenseVerifyManager.java 0.00% <0.00%> (ø) 0.00 <0.00> (ø)
...m/baidu/hugegraph/backend/store/raft/RaftNode.java 0.00% <0.00%> (ø) 0.00 <0.00> (ø)
...ugegraph/backend/store/raft/RaftSharedContext.java 0.00% <0.00%> (ø) 0.00 <0.00> (ø)
...ugegraph/backend/store/raft/StoreStateMachine.java 0.00% <0.00%> (ø) 0.00 <0.00> (ø)
.../main/java/com/baidu/hugegraph/util/Consumers.java 44.21% <25.00%> (-0.38%) 18.00 <0.00> (ø)
...com/baidu/hugegraph/auth/ContextGremlinServer.java 53.84% <100.00%> (ø) 0.00 <0.00> (ø)
...java/com/baidu/hugegraph/config/ServerOptions.java 98.91% <100.00%> (ø) 0.00 <0.00> (ø)
...n/java/com/baidu/hugegraph/config/CoreOptions.java 99.45% <100.00%> (ø) 2.00 <1.00> (ø)
...raph/backend/store/rocksdb/RocksDBStdSessions.java 64.45% <100.00%> (ø) 37.00 <0.00> (ø)
...va/com/baidu/hugegraph/task/ServerInfoManager.java 70.78% <0.00%> (-2.81%) 51.00% <0.00%> (-1.00%)
... and 3 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 39b9474...eed2800. Read the comment docs.

}
iter.next();
}
System.out.println("futures size: " + count);
Copy link
Contributor

Choose a reason for hiding this comment

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

remove the println

print_usage
;;
# list-peers
--list-peers|-l)
Copy link
Contributor

Choose a reason for hiding this comment

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

update to list_peers and seperate the commit

Change-Id: I2a1139f6e436744ee6b20557ec18f2181b2e63be
javeme
javeme previously approved these changes Apr 9, 2021
Change-Id: Ifc12c9b408ee24583e42fcd4842915ec2a71e554
zhoney
zhoney previously approved these changes Apr 13, 2021
@@ -362,7 +362,7 @@ private ExecutorService createBackendExecutor(int threads) {
private static ExecutorService newPool(int coreThreads, int maxThreads,
String name,
RejectedExecutionHandler handler) {
BlockingQueue<Runnable> workQueue = new LinkedBlockingQueue<>();
BlockingQueue<Runnable> workQueue = new SynchronousQueue<>();
Copy link
Contributor

Choose a reason for hiding this comment

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

userArrayBlockingQueue with capacity

Change-Id: Ib74c3df54ed2f7cbbe27a76d6f344173792bf654
Change-Id: I2a6a8b39f7066008483fde2c8fb66fa7db32ca0e
@@ -73,6 +74,7 @@
public static final int WAIT_RPC_TIMEOUT = 30 * 60 * 1000;
// compress block size
public static final int BLOCK_SIZE = 8192;
public static final int QUEUE_SIZE = 10;
Copy link
Contributor

Choose a reason for hiding this comment

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

set CPUS

@zhoney zhoney merged commit ec974d0 into master Apr 14, 2021
@zhoney zhoney deleted the raft-improve branch April 14, 2021 02:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants