cats-effect icon indicating copy to clipboard operation
cats-effect copied to clipboard

CPU starvation checker

Open TimWSpence opened this issue 3 years ago • 4 comments

Run a background fiber that detects CPU starvation by looking for clock drift when sleeping. Writes a warning to stderr if starvation is detected

It can be configured via the new system properties

  • cats.effect.cpu.starvation.check.interval: FiniteDuration: how long it should sleep for on each loop
  • cats.effect.cpu.starvation.check.initialDelay: Duration: how long to wait before starting the check (set to Duration.Inf to disable entirely)
  • cats.effect.cpu.starvation.check.threshold: FiniteDuration: how much clock drift can be tolerated before warning

Resolves https://github.com/typelevel/cats-effect/issues/2762

TimWSpence avatar Jul 11 '22 13:07 TimWSpence

@armanbilge are you still planning to do https://github.com/typelevel/cats-effect/pull/3098? Or should I add another parameter to toggle this on/off (instead of allowing initialDelay = Duration.Inf)?

TimWSpence avatar Jul 25 '22 16:07 TimWSpence

Yup, feel free to base off https://github.com/typelevel/cats-effect/pull/3098.

armanbilge avatar Jul 25 '22 16:07 armanbilge

Oh additional question: can we do this in a common location so it can be shared across the IOApps? This is even more useful on JavaScript than on the JVM!

djspiewak avatar Sep 21 '22 07:09 djspiewak

Oh additional question: can we do this in a common location so it can be shared across the IOApps? This is even more useful on JavaScript than on the JVM!

Yes, good point!

TimWSpence avatar Sep 22 '22 11:09 TimWSpence

Apologies @djspiewak and @armanbilge for being so slow on this. Will try to get it over the line this week

TimWSpence avatar Oct 05 '22 11:10 TimWSpence

Just need a couple adjustments and then I think we're good to go. I changed the base so we're now pointing to 3.4.x

Thank you!!

TimWSpence avatar Oct 10 '22 08:10 TimWSpence