Files
WiseTLP/examples/development-workstation.md
2025-09-16 14:27:34 +03:00

383 lines
10 KiB
Markdown

# Development Workstation Configuration Example
This example demonstrates WiseTLP configuration for a development workstation optimized for coding, compiling, and development workflows while maintaining energy efficiency.
## System Specifications
- **System**: Desktop workstation / High-end laptop
- **CPU**: AMD Ryzen 9 5900X (12 cores, 24 threads)
- **RAM**: 64GB DDR4-3200
- **Storage**: 2TB NVMe SSD (primary) + 4TB HDD (storage)
- **GPU**: NVIDIA RTX 3060 (for CUDA development)
- **Power**: 650W PSU / 100Wh battery (if laptop)
- **Display**: Dual 27" 4K monitors
## User Preferences
```
Power Profile: Balanced
Use Case: Development
Battery Priority: Runtime (if applicable)
Performance Mode: Adaptive
Special Requirements:
- Fast system wake/sleep
- Minimize fan noise during coding
- Optimize for external displays
- Maximum performance during compilation
```
## Generated TLP Configuration
### General Settings
```bash
TLP_ENABLE=1
TLP_WARN_LEVEL=3
TLP_DEBUG=0
```
### CPU Management
```bash
# Adaptive CPU scaling for development workloads
CPU_SCALING_GOVERNOR_ON_AC=ondemand
CPU_SCALING_GOVERNOR_ON_BAT=powersave
# Allow full frequency range for compilation
CPU_SCALING_MIN_FREQ_ON_AC=2200000
CPU_SCALING_MAX_FREQ_ON_AC=4950000
# Conservative battery frequencies
CPU_SCALING_MIN_FREQ_ON_BAT=2200000
CPU_SCALING_MAX_FREQ_ON_BAT=3600000
# Balanced platform profiles
PLATFORM_PROFILE_ON_AC=balanced
PLATFORM_PROFILE_ON_BAT=low-power
# Responsive energy performance
CPU_ENERGY_PERF_POLICY_ON_AC=balance_performance
CPU_ENERGY_PERF_POLICY_ON_BAT=balance_power
# Turbo boost for compilation workloads
CPU_BOOST_ON_AC=1
CPU_BOOST_ON_BAT=0
# Hardware P-states
CPU_HWP_DYN_BOOST_ON_AC=1
CPU_HWP_DYN_BOOST_ON_BAT=0
```
**Rationale**: Development work requires responsive performance for IDE operations and maximum performance for compilation. Ondemand governor provides good balance between responsiveness and power efficiency.
### Memory and Swap Management
```bash
# Optimize for large development environments
VM_DIRTY_WRITEBACK_CENTISECS_ON_AC=500
VM_DIRTY_WRITEBACK_CENTISECS_ON_BAT=1500
# Laptop mode for battery
VM_LAPTOP_MODE_ON_AC=0
VM_LAPTOP_MODE_ON_BAT=5
```
**Rationale**: Development environments often use significant memory. Balanced writeback settings ensure good I/O performance without excessive disk activity.
### Storage Management
```bash
# High performance for development tools and compilation
DISK_APM_LEVEL_ON_AC=254
DISK_APM_LEVEL_ON_BAT=192
# No spindown for SSDs, moderate for HDDs
DISK_SPINDOWN_TIMEOUT_ON_AC=0
DISK_SPINDOWN_TIMEOUT_ON_BAT=240
# Optimize SATA link power
SATA_LINKPWR_ON_AC=max_performance
SATA_LINKPWR_ON_BAT=medium_power
# NVMe optimization for development
AHCI_RUNTIME_PM_ON_AC=on
AHCI_RUNTIME_PM_ON_BAT=auto
# Disk device IDs for different handling
DISK_DEVICES="nvme0n1 sda"
DISK_APM_CLASS_DENYLIST="usb ieee1394"
```
**Rationale**: Development requires fast I/O for IDE operations, file indexing, and compilation. SSD performance is prioritized while HDD is allowed moderate power saving.
### Network Configuration
```bash
# Reliable networking for remote development
WIFI_PWR_ON_AC=off
WIFI_PWR_ON_BAT=on
# Ethernet optimization
WOL_DISABLE=N
# Network device power management
RUNTIME_PM_DRIVER_DENYLIST="mei_me nouveau nvidia e1000e"
```
**Rationale**: Development often requires reliable network connectivity for git operations, remote debugging, and API calls. Power saving on battery preserves runtime.
### GPU and Graphics
```bash
# NVIDIA GPU for CUDA development
RUNTIME_PM_ON_AC=auto
RUNTIME_PM_ON_BAT=auto
# Intel integrated graphics
INTEL_GPU_MIN_FREQ_ON_AC=300
INTEL_GPU_MAX_FREQ_ON_AC=1200
INTEL_GPU_MIN_FREQ_ON_BAT=300
INTEL_GPU_MAX_FREQ_ON_BAT=600
# External display optimization
RUNTIME_PM_DRIVER_DENYLIST="nvidia nouveau"
```
**Rationale**: CUDA development requires NVIDIA GPU availability. External displays need reliable graphics performance. Power management is balanced for development needs.
### USB and Peripheral Management
```bash
# Development peripherals optimization
USB_AUTOSUSPEND=1
USB_EXCLUDE_AUDIO=1
USB_EXCLUDE_BTUSB=1
USB_EXCLUDE_PHONE=1
# Exclude development devices
USB_ALLOWLIST="0403:6001 10c4:ea60" # FTDI and CP210x USB-to-serial
# Runtime PM exclusions
USB_EXCLUDE_WWAN=1
USB_EXCLUDE_PRINTER=1
# Autosuspend delays for development tools
USB_AUTOSUSPEND_DELAY=2
```
**Rationale**: Development often involves USB devices like programmers, debuggers, and serial adapters. These need to remain active while other devices can power save.
### Audio and Multimedia
```bash
# Audio for development (video calls, notifications)
SOUND_POWER_SAVE_ON_AC=1
SOUND_POWER_SAVE_ON_BAT=10
SOUND_POWER_SAVE_CONTROLLER=Y
# Timeout for development environment
SOUND_POWER_SAVE_TIMEOUT=10
```
**Rationale**: Audio power saving with reasonable timeout for development notifications and video calls without impacting quality.
### Thermal and Fan Management
```bash
# Quiet operation for coding sessions
TEMP_LIMITS_ON_AC="75/85"
TEMP_LIMITS_ON_BAT="70/80"
# Fan speed control for quiet development
FAN_SPEED_ON_AC=auto
FAN_SPEED_ON_BAT=auto
```
**Rationale**: Lower thermal limits promote quieter fan operation during coding. Higher limits still allow performance during compilation.
### System Sleep and Power
```bash
# Fast wake for development workflow
RESTORE_DEVICE_STATE_ON_STARTUP=1
# Devices to keep configured
DEVICES_TO_DISABLE_ON_STARTUP=""
# Runtime PM for development
RUNTIME_PM_ALL=1
```
**Rationale**: Development workflow benefits from fast system wake/sleep cycles and maintaining device states for immediate productivity.
## Development-Specific Optimizations
### IDE and Editor Performance
```bash
# Filesystem optimizations for large codebases
VM_DIRTY_RATIO=15
VM_DIRTY_BACKGROUND_RATIO=5
# I/O scheduler optimization
DISK_IOSCHED="mq-deadline"
```
### Compilation Workloads
```bash
# Temporary CPU boost for compilation
CPU_SCALING_GOVERNOR_ON_AC=performance # During make/ninja
CPU_SCALING_GOVERNOR_ON_AC=ondemand # Return to balanced
```
### Container and Virtualization
```bash
# Docker/VM optimization
VM_SWAPPINESS=10
VM_VFS_CACHE_PRESSURE=50
```
## Performance Characteristics
### Development Tasks Performance
- **IDE Startup**: Fast application launch with responsive UI
- **Code Indexing**: Efficient background processing
- **File Operations**: Quick file system operations for large projects
- **Git Operations**: Responsive version control operations
- **Compilation**: Maximum performance when needed
### Power Efficiency
- **Idle Power**: 15-25W desktop, 8-12W laptop
- **Coding Power**: 45-65W desktop, 15-25W laptop
- **Compilation Power**: 150-200W desktop, 45-65W laptop
- **Battery Runtime**: 8-12 hours coding, 3-5 hours compilation
## Workflow Optimization
### Morning Startup Routine
```bash
# System wake optimization
RESTORE_THINKPAD_BATTERY_THRESHOLDS=1
RESTORE_DEVICE_STATE_ON_STARTUP=1
```
### Compilation Sessions
```bash
# Temporary performance mode
echo performance > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
# Compile project
make -j$(nproc)
# Return to balanced
echo ondemand > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
```
### End-of-day Shutdown
```bash
# Clean shutdown with state preservation
DEVICES_TO_DISABLE_ON_SHUTDOWN=""
USB_AUTOSUSPEND_DISABLE_ON_SHUTDOWN=0
```
## Tool-Specific Configurations
### Docker Development
```bash
# Container runtime optimization
RUNTIME_PM_DRIVER_DENYLIST="docker0 br-*"
USB_EXCLUDE_PRINTER=1 # Prevent conflicts
```
### Remote Development
```bash
# SSH and network optimization
WIFI_PWR_ON_AC=off
WIFI_PWR_ON_BAT=on
WOL_DISABLE=N
```
### Database Development
```bash
# I/O optimization for databases
DISK_APM_LEVEL_ON_AC=254
SATA_LINKPWR_ON_AC=max_performance
```
### Web Development
```bash
# Browser testing optimization
RUNTIME_PM_DRIVER_DENYLIST="nvidia nouveau" # For GPU acceleration
SOUND_POWER_SAVE_ON_AC=0 # For media testing
```
## Monitoring and Optimization
### Development Metrics
```bash
# Monitor compilation performance
time make -j$(nproc)
# I/O performance for large projects
iotop -o
# Memory usage for IDEs
htop
# Network performance for remote work
iftop
```
### Power Monitoring
```bash
# Real-time power consumption
sudo powertop --time=30
# Battery optimization
sudo tlp-stat -b
# Thermal monitoring during compilation
watch -n 1 sensors
```
## Troubleshooting
### Performance Issues
- **Slow compilation**: Check CPU governor and thermal throttling
- **IDE lag**: Monitor memory usage and I/O wait
- **Network issues**: Verify WiFi power management settings
### Power Issues
- **High idle power**: Check for runaway processes and USB devices
- **Poor battery life**: Review active background services
- **Thermal throttling**: Monitor temperatures during heavy workloads
### Development Environment Issues
- **USB device issues**: Check autosuspend settings for development tools
- **Display problems**: Verify graphics power management
- **Audio problems**: Check power save timeouts
## Custom Scripts
### Development Mode Toggle
```bash
#!/bin/bash
# dev-mode.sh - Toggle between development and power-save modes
if [ "$1" == "performance" ]; then
echo "Enabling development performance mode..."
echo performance | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
echo 0 | sudo tee /sys/class/drm/card0/device/power_dpm_force_performance_level
elif [ "$1" == "balanced" ]; then
echo "Enabling balanced development mode..."
echo ondemand | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
echo auto | sudo tee /sys/class/drm/card0/device/power_dpm_force_performance_level
fi
```
### Compilation Optimizer
```bash
#!/bin/bash
# compile-optimized.sh - Optimize system for compilation
echo "Optimizing for compilation..."
echo performance | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
echo 254 | sudo tee /sys/class/scsi_host/host*/link_power_management_policy
# Run compilation
"$@"
echo "Returning to balanced mode..."
echo ondemand | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
echo med_power_with_dipm | sudo tee /sys/class/scsi_host/host*/link_power_management_policy
```
This configuration provides optimal development performance while maintaining good power efficiency and system responsiveness for professional development workflows.