microsoft / microsoft/vscode-remote-release

High CPU usage by vscode-server/typescript

Open
#3,319 34 comments 7 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

containers feature-request plan-review
Dominant language
Dockerfile
Stars
4.2k
Forks
470
Avg merge
1d 1h
Merged PRs (30d)
1

Description

Screen Shot 2020-07-05 at 4 59 25 PM

As top reports, VSCode server is using more than 80% of the CPU on my devserver, leaving me with little CPU to run useful commands. It's a free tier t2.micro ec2, making this doubly bad as I'm long-term penalized for any usage over 20%.

The cmd for pids with highest CPU usage, 10553 and 10760 respectively, are reported by /proc/*/cmdline as

/home/ec2-user/.vscode-server/bin/cd9ea6488829f560dc949a8b2fb789f3cdc05f5d/node--max-old-space-size=3072/home/ec2-user/.vscode-server/bin/cd9ea6488829f560dc949a8b2fb789f3cdc05f5d/extensions/node_modules/typescript/lib/tsserver.js--useInferredProjectPerProjectRoot--enableTelemetry--cancellationPipeName/tmp/vscode-typescript1000/259048e745e4b6b760a9/tscancellation-389a5bb0a343f462a86f.tmp*--globalPluginstypescript-vscode-sh-plugin--pluginProbeLocations/home/ec2-user/.vscode-server/bin/cd9ea6488829f560dc949a8b2fb789f3cdc05f5d/extensions/typescript-language-features--localeen--noGetErrOnBackgroundUpdate--validateDefaultNpmLocation

and

/home/ec2-user/.vscode-server/bin/cd9ea6488829f560dc949a8b2fb789f3cdc05f5d/node/home/ec2-user/.vscode-server/bin/cd9ea6488829f560dc949a8b2fb789f3cdc05f5d/extensions/node_modules/typescript/lib/typingsInstaller.js--globalTypingsCacheLocation/home/ec2-user/.cache/typescript/3.9--enableTelemetry--typesMapLocation/home/ec2-user/.vscode-server/bin/cd9ea6488829f560dc949a8b2fb789f3cdc05f5d/extensions/node_modules/typescript/lib/typesMap.json--validateDefaultNpmLocation

These plugins are doing Typescript things. I'm working in JS, and would be fine with not having TS LSP enabled features.

In general, it would be great if vscode-server could cap the CPU usage of extension processes, such as putting them in a cgroup with cpu.weight/cpu.max.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by examining the reported /proc/*/cmdline entries for tsserver.js and typingsInstaller.js and the TypeScript language-features extension. Reproduce the high CPU usage on a remote server, then investigate whether extension processes can be constrained using the mentioned cgroup cpu.weight/cpu.max controls. Done means the cause is identified and a concrete, validated mitigation is documented or implemented.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, vscode
Domain
developer-experience, devtools
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.