-
Notifications
You must be signed in to change notification settings - Fork 521
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
Conversation
@@ -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<>(); |
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.
move to line 138
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.
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(() -> { |
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.
how many tasks in general?
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.
about 10 ~ 20
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/store/raft/RaftNode.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/StandardHugeGraph.java
Outdated
Show resolved
Hide resolved
@@ -285,6 +286,13 @@ public void onError(PeerId peer, Status status) { | |||
} | |||
} | |||
|
|||
@Override | |||
public void onBusy(PeerId peer, Status status) { |
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.
seperate into 2 commits:
- raft commit for: raft/* and raft-tools.sh
- task commit for: TaskManager and rest-server.properties
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.
done
} | ||
iter.next(); | ||
} | ||
System.out.println("futures size: " + count); |
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.
remove it
print_usage | ||
;; | ||
# list-peers | ||
--list-peers|-l) |
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.
update to list_peers and seperate the commit
Codecov Report
@@ 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
Continue to review full report at Codecov.
|
} | ||
iter.next(); | ||
} | ||
System.out.println("futures size: " + count); |
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.
remove the println
print_usage | ||
;; | ||
# list-peers | ||
--list-peers|-l) |
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.
update to list_peers and seperate the commit
Change-Id: I2a1139f6e436744ee6b20557ec18f2181b2e63be
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/store/raft/RaftNode.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/store/raft/StoreStateMachine.java
Outdated
Show resolved
Hide resolved
Change-Id: Ifc12c9b408ee24583e42fcd4842915ec2a71e554
@@ -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<>(); |
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.
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; |
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.
set CPUS
Change-Id: I03859dbc9dc2ae71a2a47f3072d65276565ebba0