Linux VPS7 min read•Last updated: •By SkyRain Cloud Team

How to Optimise an Ubuntu VPS for Performance

A fresh Ubuntu VPS is configured to be safe and general-purpose, not fast for your particular workload. A few targeted changes can make websites respond quicker, let the same server handle more visitors and delay the day you need a bigger plan. Many "speed up Linux" lists online, though, are copied tweaks that do nothing on a modern kernel or quietly make things worse.

This guide takes a measured approach: find out what is actually slow, remove waste, apply the handful of system settings that genuinely help, then tune the application layer (PHP, the web server and the database), which is where most of the gains are.

Quick answer

To optimise an Ubuntu VPS: measure first with htop, vmstat and iostat; update packages and disable services you do not use; set a small swap file with vm.swappiness=10; raise open-file limits for busy services; enable TCP BBR for better throughput to distant users; then tune the application layer: enable PHP OPcache, size PHP-FPM workers to your RAM, set the MySQL buffer pool correctly, and add caching (Redis or page caching). Re-measure after each change.

Step 1: Measure your Ubuntu VPS before changing anything

sudo apt install htop sysstat
htop                 # CPU, memory and the busiest processes
vmstat 1 10          # run queue, swapping, I/O wait, steal
iostat -x 1 5        # per-disk utilisation and latency
free -h; df -h

What you see decides what to tune:

ObservationLikely bottleneckFocus on
CPU near 100% in user timeApplication codeOPcache, caching, worker counts, more vCPUs
High I/O waitDisk accessDatabase buffer pool, caching, fewer writes
Swap in use, si/so non-zeroMemoryFewer workers, smaller buffers, or more RAM
High st (steal)Host contentionProvider; see CPU steal time
Everything idle but pages slowNetwork, DNS or the application waiting on somethingApplication logs, external API calls

Also record a baseline from outside: time a few page loads, or run a simple load test, so you can tell whether each change helped.

Ubuntu VPS – SkyRain Cloud servers in India

Step 2: Update and remove waste

sudo apt update && sudo apt full-upgrade
systemctl list-unit-files --type=service --state=enabled

If you installed a desktop for a Linux VPS with GUI setup, remember it uses memory even when nobody is connected. Disable services you do not need, for example a mail server you never use, or snapd if you install nothing from snaps:

sudo systemctl disable --now service-name

Limit how much disk the journal can take, which also keeps log searches quick:

sudo sed -i 's/^#\?SystemMaxUse=.*/SystemMaxUse=500M/' /etc/systemd/journald.conf
sudo systemctl restart systemd-journald

Step 3: System settings that actually help

Swap and swappiness

A small swap file (1–2 GB) prevents sudden out-of-memory kills during spikes. Lower swappiness so the kernel prefers keeping applications in RAM:

sudo fallocate -l 2G /swapfile && sudo chmod 600 /swapfile
sudo mkswap /swapfile && sudo swapon /swapfile
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
echo 'vm.swappiness=10' | sudo tee /etc/sysctl.d/60-swappiness.conf

Swap is a safety net. If the server swaps constantly, it needs less memory use or more RAM, not more swap.

TCP BBR congestion control

BBR often improves throughput for users on long or lossy paths, such as visitors on mobile networks or in other countries:

printf 'net.core.default_qdisc=fq\nnet.ipv4.tcp_congestion_control=bbr\n' | sudo tee /etc/sysctl.d/60-bbr.conf
sudo sysctl --system
sysctl net.ipv4.tcp_congestion_control

Open-file limits for busy services

High-traffic Nginx or database servers can hit the default limit on open files. Raise it per service with a systemd override rather than globally:

sudo systemctl edit nginx
# add:
[Service]
LimitNOFILE=65535

Settings that rarely help on a modern Ubuntu VPS include changing the disk I/O scheduler (virtual NVMe disks already use a suitable default), dropping caches with drop_caches, and pasting long lists of network sysctls without measuring. Ubuntu's own Ubuntu Server documentation is a better reference than copied tweak lists.

Step 4: Tune the application layer

PHP: OPcache and PHP-FPM workers

OPcache stores compiled PHP in memory and is the biggest single win for WordPress, Laravel and other PHP sites. Check it is enabled with php -i | grep opcache.enable, and give it enough memory in the FPM php.ini:

opcache.enable=1
opcache.memory_consumption=256
opcache.max_accelerated_files=20000

Then size PHP-FPM workers to your RAM. If each PHP process uses about 60 MB and you can spare 3 GB for PHP, set pm.max_children to about 50. Too many workers causes swapping, which is slower than queuing requests. If you are not sure which php.ini the web server reads, see how to find and edit php.ini.

Nginx

  • worker_processes auto; to match vCPUs.
  • Enable gzip (or Brotli) for text assets, and long cache headers for static files.
  • Serve static files directly from Nginx rather than through PHP.

MySQL or MariaDB

On a server dedicated mostly to the database, set innodb_buffer_pool_size to 50–70% of RAM; on a server shared with a web stack, considerably less. Turn on the slow query log to find the queries worth indexing. Our database tuning guide goes further.

Caching

Redis for object caching, and full-page caching for content that is the same for every visitor, often reduce server work more than every system tweak combined.

Step 5: Keep it fast

  • Automatic security updates with unattended-upgrades, plus planned reboots for kernel updates.
  • Monitoring of CPU, memory, disk and response time, so you see slowdowns before users do.
  • Log rotation and at least 20% free disk space.
  • Regular checks for malware and unexpected processes; see scanning with ClamAV.
  • A troubleshooting routine for when something does go wrong; our VPS troubleshooting guide lists the commands.

Why developers choose SkyRain Cloud VPS

Tuning helps most on hardware that is not holding you back. SkyRain Cloud Intel VPS plans include:

  • KVM virtualization. Your own kernel and allocated vCores, so you can tune the system the way this guide describes.
  • Intel Xeon Platinum 8269CY hosts. Server-class Cascade Lake CPUs with DDR4 ECC memory.
  • NVMe SSD storage on every plan, which keeps I/O wait low for databases and builds.
  • Full root access to install and configure whatever your stack needs.
  • Unmetered 1 Gbps port in India, close to your users.
  • Simple billing and real support. Monthly billing in rupees with UPI, plus 24/7 tickets, WhatsApp and Discord.

Frequently Asked Questions

How can I make my Ubuntu VPS faster?
Measure first, then remove unused services, add a small swap file, enable PHP OPcache, size PHP-FPM workers and the database buffer pool to your RAM, and add caching. Application tuning usually gives the biggest gains.
What swappiness should I use on a VPS?
A value of 10 is a common choice for servers. It keeps applications in RAM while still allowing swap as a safety net.
Should I enable TCP BBR on Ubuntu?
It is usually worth enabling on web servers. BBR often improves throughput for users on long or lossy network paths, and it is easy to switch back if you see no benefit.
How many PHP-FPM workers should I run?
Divide the memory you can spare for PHP by the average memory per PHP process. Too many workers cause swapping, which is slower than queuing requests.
Do sysctl tweak lists from the internet help?
Most make little difference on modern kernels and some cause problems. Change one setting at a time and measure.
When should I upgrade instead of tuning?
When measurements show a resource consistently exhausted (CPU at capacity, memory forcing swap, or disk saturated) after reasonable tuning.

Conclusion

Optimising an Ubuntu VPS is mostly about measuring, then fixing the real bottleneck. Remove unused services, add a small swap file with low swappiness, enable BBR and raise file limits where needed, then spend most of your effort on OPcache, PHP-FPM sizing, the database buffer pool and caching. Re-measure after each change, and when tuning no longer helps, the data will show you which resource to upgrade.

For a fast starting point in India, see our Intel VPS plans.

SkyRain Cloud Intel Xeon VPS Plans

KVM VPS on Intel Xeon Platinum 8269CY (up to 3.80 GHz Turbo) with DDR4 ECC memory, NVMe SSD, full root access and an unmetered 1 Gbps port.

PlanvCoresRAMStorageNetworkPriceGood forBuy
VPS 1 — Intel28 GB DDR4 ECC40 GB NVMe SSD1 Gbps, unmetered₹649/monthBusiness websites, small apps, scheduled jobs and botsOrder
VPS 2 — Intel416 GB DDR4 ECC80 GB NVMe SSD1 Gbps, unmetered₹1,169/monthBusiness software, mid-size databases, several sites on one serverCheck stock
VPS 3 — Intel832 GB DDR4 ECC150 GB NVMe SSD1 Gbps, unmetered₹2,249/monthERP/CRM stacks, heavier databases, multiple production appsCheck stock
VPS 4 — Intel1664 GB DDR4 ECC250 GB NVMe SSD1 Gbps, unmetered₹4,299/monthHigh-memory workloads and consolidated production serversCheck stock

Prices are monthly in INR as listed on the SkyRain Cloud store (verified 2026-11-23). Live stock and final price are shown at checkout.

Instant UPI • ₹649/mo
Fast KVM Cloud Provisioning