Open m00dy opened 11 months ago
There are 4 threads that I put into sleep; algorithm, event_bus, networking and sync_server. 4 milliseconds enough to get around cpu exhaustion.
Thanks for the feedback, @m00dy.
The reason you're probably seeing high CPU utilization in some of your cores is that we use busy-waiting in a few places in the codebase, including busy-waiting on Receiver::try_recv
. We are aware of this behavior, and one of our ideas for how to reduce busy-waiting is to adopt Async Rust. However, this entails a major refactor and will also affect the stability and compatibility of our library (the Async Rust ecosystem is not super stable yet), which is why we don't have this as an immediate priority.
Hi,
has anyone observed high cpu usage on a network with 3 validators ? I'm testing on a dedicated machine where specs should be fine. I also attach the flame graph here.
If you look at the flamegraph, it is easy to spot std::sync::mpsc::Receiver::try_recv doing some nasty things...I wonder is it possible to replace it something less resource hugry ?
here is my network implementation.
pub struct TestNetwork { pub my_verifying_key: VerifyingKey, pub my_hostname: String, pub all_hostnames: HashMap<VerifyingKey, String>, pub outgoing_sender_queue: Sender<(String, MessagePayload)>, pub incoming_msg_queue: Arc<Mutex<Receiver<(String, MessagePayload)>>>, }
impl Network for XoXoNetwork { fn init_validatorset(&mut self, : ValidatorSet) { }
}
lscpu output >
Architecture: x86_64 CPU op-mode(s): 32-bit, 64-bit Address sizes: 39 bits physical, 48 bits virtual Byte Order: Little Endian CPU(s): 8 On-line CPU(s) list: 0-7 Vendor ID: GenuineIntel Model name: Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz CPU family: 6 Model: 94 Thread(s) per core: 2 Core(s) per socket: 4 Socket(s): 1 Stepping: 3 CPU max MHz: 4000.0000 CPU min MHz: 800.0000 BogoMIPS: 6799.81