Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

dummydecoy

macrumors newbie
Original poster
Oct 30, 2021
28
12
I don't get it, which is the offending app in Activity Monitor that is causing this?
Macbook M3Max 128GB with updated Sonoma connected to an external 1080p widescreen monitor.


Screen Recording SUPER LAGGY
 
I would like to see the CPU activity rather than memory activity.
I switch to the CPU tab halfway in the video.

What about if you use the integrated screen capture tools?


Does it stutter?
I was actually using the integrated capture of MacOs to record that video. What's weird is the lag doesn't get worse with an ongoing screen recording whether it be the builtin recorder or CleanshotX or OBS.
 
Last edited:
OP wrote:
"The problem completely goes away after a restart by the way..."

Another "Fishrrman completely stupid reply":
Then... just restart the Mac and be done with it.
(what works... works)
 
First, you can try the quick fixes like these on Macupdate.com: Onyx or Sonoma Cache Cleaner. They might fix it for you without more debugging if you get lucky. It's worked for me more than a few times.

Second, If that doesn't work, you're going to want to determine what is using most of the CPU/GPU resources on the system.

You say that a reboot fixes it. Let's start there. What do you do just prior to it starting to stutter? It is extremely important that your answer contain more than "nothing" or "it's random". That's the cornerstone of where you start to debug.

In the video, you show WindowServer using a lot of CPU. What is open on the system? Browser? IDE? LLM Chat AI App? The answer should again contain more than "nothing" as there are many little icons in the top right showing software running. One of those might be the culprit.

Third, try Terminal to get a command line view. The top utility can be a good way to see it.

Note: TAKE BACKUPS BEFORE RUNNING ANYTHING. MAKE SURE YOU HAVE FULL BACKUPS YOU KNOW YOU CAN RESTORE BEFORE RUNNING ANY COMMANDS!

Open Terminal.

Run the following:

top -o cpu -stats pid,command,cpu | grep WindowServer -A 20

That might give a rolling view of some of the system usage that could be causing it.

Fourth, have you performed any hardware A/B tests such as does it do this when not attached to the external monitor?
 
In the video, WindowServer is using 75% CPU, so I'd say it's that. If you quit WindowServer I think it logs you out, because it's the process that handles all that stuff. Almost the same as a reboot.
 
  • Wow
Reactions: _Mitchan1999
How long after restart does it take for the problem to appear?

Does it happen all at once, or does it gradually get worse?

If you reboot to Safe Mode, does the problem appear or not?

I also suggest restarting without restoring all apps and windows. That is, restart to a minimal state: Finder only. Open apps one by one. Take note of when the problem appears.


When the "Memory" pane is showing in the video (last several seconds), the "Ports" column for WindowServer says it has over 5000 ports open. The text is too tiny for me to discern the exact number; it's at least 5700 or 6700. That number seems excessive to me.

I suggest running Activity Monitor immediately after restart, with the Memory pane visible, and sorted on the Ports column (click the col heading; click again to reverse sort). Take notes on what happens with the Ports count over time.

I suggest doing this both in Safe Mode and after a normal restart. Safe Mode won't run any startup items, so you'll have to launch it manually.
 
Just to state the obvious, check your software settings to ensure you're sampling (and then compressing) the screen at an adequate rate. It might be set to 5 fps and it's doing exactly what it's supposed to.
 
  • Love
Reactions: _Mitchan1999
I don't get it, which is the offending app in Activity Monitor that is causing this?
Macbook M3Max 128GB with updated Sonoma connected to an external 1080p widescreen monitor.
View attachment 2398962

Screen Recording SUPER LAGGY
This is an issue with screen sharing/recording and replayd on Sonoma. Theres some info out there on things to try but it affects stuff like your VNC client, OBS, etc

 
Run the following:

top -o cpu -stats pid,command,cpu | grep WindowServer -A 20

That might give a rolling view of some of the system usage that could be causing it.

Fourth, have you performed any hardware A/B tests such as does it do this when not attached to the external monitor?
Thank you for your reply, I appreciate it. I will try this terminal command and also do some tests without using an external monitor and note the results the next time the issue rears its ugly head.

In the video, WindowServer is using 75% CPU, so I'd say it's that. If you quit WindowServer I think it logs you out, because it's the process that handles all that stuff. Almost the same as a reboot.
Yes, this is exactly how I have been working around the issue without restarting the mac. I just force kill Windowserver which logs me out. I thought Windowserver using 75% is just 75% of one core though? How is that making the entire system super laggy?

Following on from the comment about WindowServer usage, do you have Google Chrome installed?

If so, completely uninstalling it may be worth a shot:
No I don't have any Chromium-based browser installed at all, I use Firefox.

There's nothing taking enough CPU or RAM to cause that kind of stutter - I'd ask you to enable GPU% utilisation in Activity Monitor and sort by that to see if anything is absolutely killing GPU usage.
Thank you for your reply, is this column what you are referring to?
How long after restart does it take for the problem to appear?

Does it happen all at once, or does it gradually get worse?

If you reboot to Safe Mode, does the problem appear or not?

I also suggest restarting without restoring all apps and windows. That is, restart to a minimal state: Finder only. Open apps one by one. Take note of when the problem appears.


When the "Memory" pane is showing in the video (last several seconds), the "Ports" column for WindowServer says it has over 5000 ports open. The text is too tiny for me to discern the exact number; it's at least 5700 or 6700. That number seems excessive to me.

I suggest running Activity Monitor immediately after restart, with the Memory pane visible, and sorted on the Ports column (click the col heading; click again to reverse sort). Take notes on what happens with the Ports count over time.

I suggest doing this both in Safe Mode and after a normal restart. Safe Mode won't run any startup items, so you'll have to launch it manually.

I will try your suggestions, thank you so much for your reply. I appreciate it. I already restarted the machine and it's working OK, here's the current ports column. Does it look abnormal to you? What does it mean if so?

The problem usually appears when I wake up the Macbook from sleep to resume working, but it isn't 100% reproducible. It hasn't happened today but it happened twice yesterday.

How is your gpu% usage? I could easily bring max of Linux to crawl with a shader.
This is what I'm seeing right now, but I am not experiencing the laggy issue yet
Just to state the obvious, check your software settings to ensure you're sampling (and then compressing) the screen at an adequate rate. It might be set to 5 fps and it's doing exactly what it's supposed to.

Thank you for your reply, I apprecaite it. I'm a MacOS noob from a lifetime of Windows. Can you please give me more information about this 5fps sampling and compressing limit? Where can I check this setting?

No matter what, there is going to be lag using JumpDesktop.

The screen recording was done locally, not through a JumpDesktop connection/session.

This is an issue with screen sharing/recording and replayd on Sonoma. Theres some info out there on things to try but it affects stuff like your VNC client, OBS, etc


Thank you for your reply, I will quit JumpDesktop next time I encounter this lag and see if it helps. But in the video, I didn't have any remote machine connected to the Mac, and OBS wasn't running.
 
  • Love
Reactions: jchap
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.