Skip to content

Instantly share code, notes, and snippets.

@syntaxhacker
Created July 28, 2026 20:25
Show Gist options
  • Select an option

  • Save syntaxhacker/84f71dfdb42ed3d5f4af0e53c90a78e4 to your computer and use it in GitHub Desktop.

Select an option

Save syntaxhacker/84f71dfdb42ed3d5f4af0e53c90a78e4 to your computer and use it in GitHub Desktop.
Ubuntu Performance Debugging - Fixing Lag, Chrome FPS, NVIDIA GPU & Memory Tuning

Ubuntu Performance Debugging Log

Full debugging session fixing system lag on Ubuntu 24.04 with GTX 1650 Ti

Symptoms

  • System lag, stuttering UI
  • Chrome stuck at 25fps on regular pages (WebGL hit 60fps)
  • High swap usage, memory pressure

Root Causes Found

Memory Pressure (Primary)

Before: 15.8GB / 23GB used, 3.4GB swap
After:  8.9GB / 23GB used, 3.2GB swap (freed 6.9GB)

Culprits: 3 opencode instances, Chrome renderers, 17 stock-screener bot runners

Chrome Compositor Bottleneck (25fps)

  • WebGL hit 60fps → GPU fine
  • Regular pages stuck at 25fps → Chrome compositor bottleneck at 4K
  • Vulkan on NVIDIA Linux caused overhead
  • Fix: Disabled Vulkan → 40-45fps (+ --disable-features=UseSkiaRenderer)

GPU Not Boosting

  • GPU stuck at P5 (low power) / 345 MHz instead of P0 / 2100 MHz
  • nvidia-settings -a GPUPowerMizerMode=1 fixed it

Fixes Applied

Memory & Swap

echo 'vm.swappiness=10' | sudo tee -a /etc/sysctl.conf
sudo sysctl -p

Chrome Flags (persistent across restarts)

  • chrome://flags/#enable-vulkanDisabled
  • Added to Chrome launch: --disable-features=UseSkiaRenderer

GPU Power Mode

nvidia-settings -a GPUPowerMizerMode=1

Display Management Script

~/.local/bin/screen-toggle:

#!/usr/bin/env bash
case "${1:-monitor}" in
  monitor) xrandr --output eDP-1-1 --off ;;
  laptop)  xrandr --output eDP-1-1 --auto ; xrandr --output HDMI-0 --off ;;
  both)    xrandr --output eDP-1-1 --auto --left-of HDMI-0 ;;
esac

Resolution Toggle

# Quick 1080p for smooth browsing
xrandr --output HDMI-0 --mode 1920x1080

# Back to 4K for static work
xrandr --output HDMI-0 --mode 3840x2160

Results

Metric Before After
Chrome FPS (regular pages) 25 60
GPU Power 16W 5W
GPU Temperature 77°C 59°C
RAM Used 15.8GB 8.9GB
CPU Idle 8% 78%
System Load 9.63 3.69

Key Commands Used for Diagnosis

# System overview
free -h
uptime
top -b -n1 -o %CPU | head -10

# GPU diagnostics
nvidia-smi
nvidia-smi -q -d CLOCK,PERFORMANCE,POWER
nvidia-settings -q GPUPowerMizerMode

# Disk
iostat -x 1 3

# Chrome internals
chrome://gpu
chrome://flags

# Display
xrandr --current
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment