riot-ml / riot

An actor-model multi-core scheduler for OCaml 5 🐫
https://riot.ml
Other
545 stars 37 forks source link

High CPU Usage #65

Open leostera opened 6 months ago

leostera commented 6 months ago

This issue got reported first here https://github.com/leostera/minttea/issues/38 – but Github doesn't let me transfer an issue across organizations.

Possible culprits:

tjdevries commented 6 months ago

Can confirm, I also have this problem:

Riot 0.0.8 from opam, OCaml 5.1.1, Linux (I can give more sys information if you need)

tjdevries commented 5 months ago

I was also able to reproduce on OCaml 5.2.0~alpha (altho the memory usage looked better!)

tjdevries commented 5 months ago

From what I can tell so far, something is happening with blink to make it happen (we can chat on discord more if you want)

tjdevries commented 5 months ago

OK, maybe it's not blink, I'm very confused haha, i can send you link in VOD to watch if you have any ideas

leostera commented 5 months ago

Thanks @tjdevries for the context and comments! ✨ I've been digging and found 3 specific things that could've be responsible. 2 of those are now fixed.

If you have code examples that I could try that would help me narrow down on the 3rd or others.

charleslambert commented 4 months ago

Hey @leostera, I was looking into this, and from what I can tell it seems to be caused by having multiple schedulers, and one of the schedulers ending up with a list of skippable messages. It's non deterministic though.

I tested using 2 schedulers and 10 spawned processes. Every once and a while a scheduler gets stuck spinning on a mailbox full of skippable messages. I am trying to dig in more, but don't fully understand the architecture yet.