Open GGist opened 7 years ago
Seems that most of the CPU was coming from the disk manager.
However, I still see an issue (both on windows and linux), where after the download is complete, the CPU is pegged at 13% (windows desktop) or 40% (linux droplet). Interestingly enough, that CPU pegging seems to go away when adding a println statement here https://github.com/GGist/bip-rs/blob/master/bip_peer/src/manager/mod.rs#L335.
I thought it may be due to our usage of Mutex polling in the futures themselves, but switching those out for RefCell didnt make a difference. Additionally, I tried using unsync channels as opposed to the sync channels, and that did nothing as well (though interestingly, it seems the channel capacitys for sync and unsync mean different things, as an unsync capacity of 0 caused the channel to block, but I think thats a separate issue...).
I am going to try and reproduce using just the futures crate, as it may be that tasks are waking up more than they should (though it would be for both unsync and sync, which seems like a stretch).
Looks like its an issue with tokio-timer Sleep
notifying us too frequently. Changing our tick duration doesnt seem to have a large effect on the CPU usage for us waking up, perhaps more often than we need to.
Will look in to what we can do to fix this.
So I was able to re-produce this very reliably yesterday, but today I can't reproduce it at all. Going to leave it here for a while in case it comes back...
Seeing high CPU usage when running the example, which should be mostly IO bound (aside from checksumming).
Interestingly, even when disabling the disk manager, I am still seeing a lot of calls to sha1 digest...