-
Notifications
You must be signed in to change notification settings - Fork 77
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
Make the coordinator less CPU-spin happy #30
Comments
An alternative option would be to move to CamIO2, which can be made to sleep, but will still have an asyc pattern for speed.
|
ping @ms705 Is there updates in this issue? |
Hi @WIZARD-CXY, Sorry for the delayed response -- we've been bogged down with a bunch of paper deadlines recently. This issues is still outstanding. Our plan to fix it is to replace our own home-baked, polling RPC layer with gRPC, which will fix the spinning. However, it will take us a while to implement this. In the meantime, you can work around the issue by adding a Hope that helps! |
@ms705 Thanks, I will give it a shot tomorrow! |
|
@WIZARD-CXY Ah -- this workaround only works if there actually are any channels (i.e., other running coordinators or running tasks). Otherwise, the code falls into the early exit condition on line 59 and you spin until channels show up. Here's a patch that works even when there are no channels (with the same provision re RPC latency as above): diff --git a/src/engine/node.cc b/src/engine/node.cc
index 5c01a75..6353e55 100644
--- a/src/engine/node.cc
+++ b/src/engine/node.cc
@@ -106,6 +106,7 @@ void Node::AwaitNextMessage() {
VLOG(3) << "Waiting for next message from adapter...";
m_adapter_->AwaitNextMessage();
- //boost::this_thread::sleep(boost::posix_time::seconds(1));
+ usleep(500000);
} In other words, add the |
It works now@ms705, thanks |
Currently, the coordinator spins hard on incoming messages in the
StreamSocketsAdapter
when doing asynchronous receives. This was the easiest way of implementing the functionality, but is not actually required.Instead, we should rework the
StreamSocketsAdapter
andStreamSocketsChannel
code to use the Boost ASIO proactor pattern correctly (with a finishing async receive callback setting up the next async receive), or move to alibev
orselect
-based implementation.This isn't a correctness issue, but a performance one: the coordinator currently uses an entire CPU core on each machine. Usually, that's not an issue, but we may as well not waste resources unnecessarily.
The text was updated successfully, but these errors were encountered: