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

Set spin count to 1 in ManualResetEventSlim #1830

merged 1 commit into from Jan 25, 2019


2 participants
Copy link

shaan1337 commented Jan 17, 2019


  • High CPU usage when idle (particularly for StorageChaser,~40% CPU when idle)

This PR fixes performance issues seen after introducing this commit which was hoping that the issues seen earlier with ManualResetEventSlim on mono were fixed in mono 5.16.

The same high CPU usage symptoms were seen earlier in this commit and the workaround was to use AutoResetEvent:

After experimentation, setting the spinCount to 1 drops the CPU usage to 0-5% and write speeds increase by approximately 50% (atleast on my laptop).

It seems that default spin count of 10 used by mono was too high, causing excess spinning (this was manually verified by setting the spin count to 10):

Set spin count to 1 for ManualResetEventSlim. This drastically reduce…
…s CPU usage on mono and increases write speeds by ~50%.

@Lougarou Lougarou merged commit a9eac03 into master Jan 25, 2019

@Lougarou Lougarou deleted the manualreseteventslim-fix branch Jan 25, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment