performance – Process throttled after exceeding limit of 150 wakeups per second

I have a process that crunches through some data, running more than 12h. Often it completes without issues but sometimes it slows to a crawl as if it is being throttled. The CPU is close to idle after this happens but the process still appears to do something and has not crashed.

The console (see below) shows a wakeup limit that has been reached. Can this be the cause of the issue?

I tried to renice -n -5 -p PID without effect. I’d like to avoid having to restart the process as it can’t resume.

How can I avoid this situation, remove/change the wakeup limit or how can I make the process run normally again when this happens?

Data Source:      Microstackshots
Shared Cache:     0x512b000 4D8DECCA-68A1-3A8F-9311-EFC83DC9C512

Command:          Python
Path:             /usr/local/Cellar/python@3.9/3.9.2_2/Frameworks/Python.framework/Versions/3.9/Resources/Python.app/Contents/MacOS/Python
Identifier:       org.python.python
Version:          3.9.2 (3.9.2)
PID:              28198

Event:            wakeups
Action taken:     none
Wakeups:          45001 wakeups over the last 287 seconds (157 wakeups per second average), exceeding limit of 150 wakeups per second over 300 seconds
Wakeups limit:    45000
Limit duration:   300s
Wakeups caused:   45001
Wakeups duration: 287s
Duration:         286.96s
Duration Sampled: 162.16s
Steps:            21