VPS Windows mặc định chạy rất nhiều service không cần thiết, ngốn RAM và CPU. Thực hiện các bước dưới đây để VPS chạy nhanh và mượt hơn đáng kể.
Bước 1: Tắt Visual Effects (tiết kiệm RAM, CPU)
1. Nhấn Win + R → gõ sysdm.cpl → Enter
2. Tab Advanced → Performance → Settings
3. Chọn Adjust for best performance → Apply → OK
Hoặc dùng PowerShell:
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects" -Name VisualFXSetting -Value 2
Bước 2: Cấu hình Page File (bộ nhớ ảo)
1. Vào System Properties → Advanced → Performance Settings → Advanced → Virtual Memory → Change
2. Bỏ tick Automatically manage
3. Chọn ổ C: → Custom size:
- RAM 1GB: Initial 1024MB / Maximum 2048MB
- RAM 2GB: Initial 2048MB / Maximum 4096MB
- RAM 4GB+: Initial = RAM size / Maximum = RAM x2
4. Nhấn Set → OK → Restart
Bước 3: Tắt các service không cần thiết
Nhấn Win + R → gõ services.msc → tìm và set Startup type: Disabled cho các service sau:
- Windows Search — index file, ngốn disk I/O
- Superfetch / SysMain — không cần thiết trên SSD
- Print Spooler — nếu không dùng máy in
- Fax — không cần
- Windows Error Reporting — gửi báo cáo lỗi về Microsoft
- Diagnostics Tracking Service — telemetry
- Remote Registry — bảo mật, nên tắt
Dùng PowerShell để tắt nhanh:
$services = @("WSearch","SysMain","Spooler","Fax","WerSvc","DiagTrack","RemoteRegistry")
foreach ($svc in $services) {
Stop-Service -Name $svc -Force -ErrorAction SilentlyContinue
Set-Service -Name $svc -StartupType Disabled -ErrorAction SilentlyContinue
Write-Host "Disabled: $svc"
}
Bước 4: Bật Windows Update (quan trọng!)
VPS Windows thường bị tắt Windows Update. Cần bật để nhận bản vá bảo mật:
Set-Service -Name wuauserv -StartupType Automatic
Start-Service wuauserv
# Chạy update ngay
Install-Module PSWindowsUpdate -Force
Import-Module PSWindowsUpdate
Get-WindowsUpdate
Install-WindowsUpdate -AcceptAll -AutoReboot
Bước 5: Dọn disk
# Chạy Disk Cleanup tự động
cleanmgr /sagerun:1
# Xóa temp files
Remove-Item -Path "$env:TEMP\*" -Recurse -Force -ErrorAction SilentlyContinue
Remove-Item -Path "C:\Windows\Temp\*" -Recurse -Force -ErrorAction SilentlyContinue
# Xóa Windows Update cache cũ
Stop-Service wuauserv
Remove-Item "C:\Windows\SoftwareDistribution\Download\*" -Recurse -Force
Start-Service wuauserv
Bước 6: Tối ưu Network
# Tắt IPv6 nếu không dùng
Disable-NetAdapterBinding -Name "*" -ComponentID ms_tcpip6
# Tối ưu TCP
netsh int tcp set global autotuninglevel=normal
netsh int tcp set global chimney=enabled
netsh int tcp set global rss=enabled
Bước 7: Tắt Windows Defender tạm thời (nếu cần hiệu năng)
Chỉ tắt nếu VPS dùng cho mục đích cụ thể và bạn biết mình đang làm gì:
Set-MpPreference -DisableRealtimeMonitoring $true
Bật lại:
Set-MpPreference -DisableRealtimeMonitoring $false
Bước 8: Kiểm tra hiệu năng sau tối ưu
# Xem RAM đang dùng
Get-Process | Sort-Object WorkingSet -Descending | Select-Object Name, @{N="RAM(MB)";E={[math]::Round($_.WorkingSet/1MB,1)}} | Select-Object -First 15
# Xem CPU usage
Get-Counter "\Processor(_Total)\% Processor Time" -SampleInterval 2 -MaxSamples 3
# Xem disk space
Get-PSDrive C | Select-Object Used,Free | ForEach-Object { Write-Host "Used: $([math]::Round($_.Used/1GB,1))GB | Free: $([math]::Round($_.Free/1GB,1))GB" }
Kết quả thường thấy sau tối ưu:
- RAM idle giảm từ 1.2GB xuống còn ~600-800MB
- CPU idle từ 5-10% xuống còn 1-2%
- Disk I/O giảm đáng kể (không còn Windows Search indexing)
- Boot time nhanh hơn 20-30%