WindowServer high CPU with an external monitor on Mac

2026-11-28来源 dev.toEnglish
WindowServer high CPU with an external monitor on Mac

If WindowServer jumps to 30, 50 or 80% CPU the moment you plug in an external monitor, nothing is broken. WindowServer is the process that draws your screens, and its cost scales with three things: how many pixels it composites, how many times a second it does it, and how much on screen is changing. An external display can raise the first two at once.

The biggest single cause is a scaled resolution. When you pick a "Looks like" size that isn't exactly half the panel's pixels, macOS renders a larger image at 2x and then shrinks it to fit. On a 4K monitor set to look like 2560 × 1440, that's a 5120 × 2880 frame, about 1.8 times the pixels the panel actually has. Add a 120 or 144 Hz refresh rate and a browser tab with an animation, and WindowServer has real work to do every frame.

The fixes, in order of how much they usually help: use the monitor's default or an exact-2x resolution, lower the refresh rate if you don't need it, find the app that's animating, and turn on Reduce transparency. The rest of this post is how each of those works and how to measure it, so you're not guessing. For the basics of the process itself, see the WindowServer process page.

What WindowServer actually does

Apps don't draw directly to the screen. Each app renders its own windows into buffers, and WindowServer (it lives in SkyLight.framework and runs as the _windowserver user) composites them: stacks the windows, adds shadows, blurs whatever sits behind the menu bar and sidebars, draws the cursor, runs Spaces and Mission Control animations, and hands a finished frame to each display.

You can confirm it's the real one:

ps -o user,pid,%cpu,command -p $(pgrep -x WindowServer) 
USER PID %CPU COMMAND _windowserver 394 20.5 /System/Library/PrivateFrameworks/SkyLight.framework/Resources/WindowServer -daemon 

Two things make its numbers confusing. First, its CPU is the sum of what everything else on screen is asking for, so the cause is almost never WindowServer itself. Second, much of the compositing happens on the GPU, so its CPU column only shows part of the cost. While I wrote this on an M1 Pro, with only the built-in display, Chrome open and a terminal streaming output, top showed WindowServer between about 20 and 35%. That's normal for a busy desktop. What isn't normal is a high number when nothing on screen is moving.

Why an external monitor costs so much

Scaled resolutions render more pixels than the panel has

macOS draws its interface at 2x on Retina-class screens. When the "Looks like" size is exactly half the panel's resolution, the 2x image matches the panel one to one. When it isn't, macOS renders at 2x of the size you picked and downsamples the result. The bigger the "Looks like" size, the bigger the hidden frame.

For a common 27-inch 4K panel (3840 × 2160, 8.3 million pixels):

Looks like macOS renders Pixels per frame vs the panel
1920 × 1080 3840 × 2160 8.3 MP 1.0x, no downsampling
2560 × 1440 5120 × 2880 14.7 MP 1.8x, downsampled
3008 × 1692 6016 × 3384 20.4 MP 2.5x, downsampled
3840 × 2160 (1x, not Retina) 3840 × 2160 8.3 MP 1.0x, but blurry-looking text

This is why the 5K Studio Display and LG UltraFine 5K are the "Mac" monitors: at 5120 × 2880, looking like 2560 × 1440 is an exact 2x, so you get the space without the downsampling.

Bar chart of pixels rendered per frame on a 4K monitor: looks like 1920x1080 renders 8.3 megapixels, 2560x1440 renders 14.7, 3008x1692 renders 20.4, while a 5K panel at 2560x1440 renders 14.7 with no downsampling; at 144 Hz the 2560x1440 case is 2.1 gigapixels per second versus 0.5 at 60 Hz for 1920x1080

Pixels per frame, times frames per second. The scaled sizes are the ones that cost more than the panel.

Refresh rate multiplies everything

A 144 Hz monitor can ask for 144 frames a second instead of 60. WindowServer only recomposites what changed, so a static screen at 144 Hz is cheap. But while anything moves (scrolling, a video, a spinner, a window being dragged) it does that work up to 2.4 times as often. The 14.7 MP frame from the table above at 144 Hz is about 2.1 billion pixels a second, against roughly 0.5 billion for a 1:1 4K frame at 60 Hz.

Treat those as ceilings rather than measurements: the compositor redraws only damaged regions. But they show why the same desktop can be fine on the built-in screen and heavy on an external one.

More displays, more Spaces, more windows

Each display is its own frame to build. Every window keeps a backing buffer on every Space it's on, which is also why WindowServer's memory can reach a few gigabytes with many windows on a large screen. Mirroring a display at a different resolution means rendering for both.

Things that redraw on their own

The resolution sets the price per frame. These decide how many frames get drawn:

  • A browser tab with animation. Ads, animated backgrounds, a dashboard that repaints every second, a canvas game left in a background window that's still visible.
  • Transparency and blur. The menu bar, Dock, sidebars, Control Center and Notification Center blur whatever's behind them. When the content behind moves, the blur is recomputed.
  • Stage Manager. The thumbnails on the side are live. Its own process is WindowManager, but the compositing lands on WindowServer.
  • Moving wallpapers. The aerial wallpapers in Sonoma and later animate on the desktop and lock screen.
  • Screen sharing and recording. Zoom, Teams, Meet in a browser, OBS and Screen Sharing all capture frames through WindowServer, often the whole display at full resolution.
  • Menu bar apps that redraw constantly. Every status item update is a redraw that WindowServer has to composite.

That last one includes system monitors, mine too, so it's worth being specific. A menu bar monitor that redraws every item every second costs WindowServer a little every second, forever. Stat Space draws its items with Core Graphics and compares what it would draw with what's already there. If the number hasn't changed, nothing is redrawn. If the item's width hasn't changed, its length isn't touched either, because each change round-trips to the system process that hosts status items. The honest caveat: a sparkline or line-chart item changes every sample by design, so it does redraw every tick. If you're chasing every last percent, plain text items redraw least. The 0.3% CPU post covers the rest of that design.

Measure it before changing anything

Read your display setup

system_profiler shows what each display is and how it's driven:

system_profiler SPDisplaysDataType 

On my MacBook Pro with no monitor attached, the built-in screen looks like this:

Graphics/Displays: Apple M1 Pro: Chipset Model: Apple M1 Pro Type: GPU Bus: Built-In Total Number of Cores: 16 Displays: Color LCD: Display Type: Built-in Liquid Retina XDR Display Resolution: 3024 x 1964 Retina Main Display: Yes Mirror: Off Online: Yes Connection Type: Internal 

An external display adds a few more lines. The two that matter here are Resolution, the panel's real pixels, and UI Looks like, the size you picked and its refresh rate. A 4K monitor at a scaled setting reads something like this (an example, with the serial line removed; yours will include it, so redact it before posting the output anywhere):

 LG HDR 4K: Resolution: 3840 x 2160 (2160p/4K UHD 1 - Ultra High Definition) UI Looks like: 2560 x 1440 @ 60.00Hz Main Display: No Mirror: Off Online: Yes Connection Type: Thunderbolt/DisplayPort 

The quick check: double the "Looks like" numbers. If that matches Resolution, you're at 1:1. If it's bigger, macOS is rendering the larger frame and downsampling. System Settings › Displays shows the same thing as the selected thumbnail, and the refresh rate is in the menu below it.

Watch WindowServer, CPU and GPU

In Activity Monitor's CPU tab, sort by % CPU and find WindowServer. Then add the GPU side: View › Columns › % GPU adds a GPU column, and Window › GPU History (⌘4) opens a live GPU graph. Leave both open and work for a minute. A WindowServer that's busy while the GPU graph is busy is compositing. A WindowServer at 60% with a flat GPU graph and nothing moving is worth a restart and a cable or dock check.

The high CPU guide covers the general method with top and ps if you'd rather stay in Terminal.

Find the app that's driving it

Because WindowServer works on behalf of other apps, the fastest diagnosis is subtraction: hide or quit apps one at a time and watch its CPU. A big drop names the culprit. Hiding an app with ⌘H is a quick, reversible test, since a hidden window has nothing to composite. Start with the browser, then anything with video, then Electron apps.

How to bring it down

  1. Use an exact-2x or default resolution. In System Settings › Displays, pick "Default" for the monitor, or a size that's exactly half its pixels (1920 × 1080 on 4K, 2560 × 1440 on 5K). If you need more space on a 4K panel, that's a fair trade, just a known one.
  2. Lower the refresh rate when you don't need it. The Refresh rate menu under the display in System Settings. 60 Hz is plenty for documents and code; keep 120 or 144 for games and smooth scrolling if you value them.
  3. Close or minimize animated tabs. Especially dashboards, ads and anything with a canvas. A tab that's hidden behind another window is still drawn if any of it is visible.
  4. Turn on Reduce transparency. System Settings › Accessibility › Display › Reduce transparency. This removes most of the blur work. Reduce motion in the same pane shortens Spaces and Mission Control animations.
  5. Use a still wallpaper instead of an aerial one.
  6. Try Stage Manager off for a day if you use it.
  7. Fewer windows, fewer Spaces. Hundreds of open Finder or browser windows across many desktops each hold a buffer.
  8. Stop sharing when you're done. A meeting app that's still capturing your screen after the call is a common leftover.

If none of that moves the number and WindowServer stays high on a static screen, the usual suspects are a flaky dock or adapter, a display that keeps renegotiating its connection, or a macOS bug fixed in a point release. Unplug the monitor and see if the number falls back; if it does, try a different cable or a direct connection. The broader why is my Mac slow checklist is the next step if it isn't the display at all.

Where Stat Space helps

Two parts of Stat Space are useful for this. The Devices tab lists each display with its pixels, looks-like size and refresh rate, and you can expand a display to change either without opening System Settings, which makes trying 60 Hz against 144 Hz a two-click experiment. The Apps tab groups helpers under their app, so all of Chrome's renderers show as Chrome and the app that's keeping WindowServer busy is one row instead of twenty.

Stat Space is a lean menu bar system monitor for Apple Silicon, free with a one-time Pro upgrade, and it shows its own CPU and memory in the popover footer so you can check what it costs WindowServer and everything else. It's at statspace.app.

Originally published at statspace.app.

原文:https://www.a8q9.cn/en/article/windowserver-high-cpu-with-an-external-monitor-on-mac-a732a2.html

相关文章