Our Next.js deployment guide covers getting an app running on a VPS. This guide is about making it fast and sizing the server: which rendering mode to use where, how caching behaves when you self-host, and how to use all the vCores you pay for.
Choose the Cheapest Rendering That Works
| Mode | When it renders | Server cost per request | Use for |
|---|---|---|---|
| Static (SSG) | At build time | Almost none | Marketing pages, docs, blog posts |
| Incremental (ISR / revalidate) | At build, then in the background on a schedule or on demand | Low | Product pages, listings, content that changes occasionally |
| Dynamic (SSR) | On every request | High | Per-user dashboards, personalised pages |
| Client-side | In the browser | None for HTML (API calls still cost) | Highly interactive app sections |
In the App Router, caching depends on how data is fetched and on route segment settings; check the build output, which marks each route as static or dynamic, and make dynamic only what must be.
Standalone Output
// next.config.js
module.exports = { output: 'standalone' };
The build produces .next/standalone with a minimal server.js and only the dependencies it needs. Copy .next/static and public next to it. The result is small, starts fast and deploys easily as a release directory or Docker image.
Build in CI, Not on the Server
Next.js builds can use several GB of memory and all CPU cores for minutes. Building on the production server slows the live site and can trigger out-of-memory kills. Build in CI, upload the standalone output and switch releases with a symlink (see our GitHub Actions guide and zero-downtime guide).
Use Every vCore
A Node.js process uses one core for JavaScript. On a multi-vCore EPYC plan, run several instances behind Nginx:
upstream nextjs {
server 127.0.0.1:3001;
server 127.0.0.1:3002;
server 127.0.0.1:3003;
server 127.0.0.1:3004;
keepalive 32;
}
Start each with a different PORT as separate systemd services (or PM2 instances).
ISR and the Cache with Several Processes
By default, a self-hosted Next.js server stores its ISR and data cache on the local filesystem and in memory, per process. With several processes, each regenerates pages independently, and on-demand revalidation in one process does not update the others. Options:
- Configure a shared cache handler (Next.js supports a custom
cacheHandler; community handlers store the cache in Redis). - Run a single process for revalidation-heavy apps and rely on Nginx caching for scale.
- Use time-based revalidation only, accepting that processes refresh independently.
Check the documentation for your Next.js version, as caching behaviour has changed between major releases.
Nginx in Front
location /_next/static/ {
alias /srv/next/current/.next/static/;
expires 1y;
add_header Cache-Control "public, immutable";
access_log off;
}
location / {
proxy_pass http://nextjs;
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
Hashed static assets can be cached for a year and served directly by Nginx, freeing Node.js for rendering. Add compression and HTTP/2 at the Nginx level (see our web server tuning guide).
Image Optimisation
The built-in image optimiser resizes and converts images on demand and caches results on disk. It is CPU-intensive the first time each size is requested, and uses the sharp library when installed (recommended for production). For image-heavy sites, pre-generate common sizes at build time, put a CDN in front, or use an external image service, so rendering is not slowed by image work.
Data Fetching
- Fetch in parallel instead of sequential waterfalls.
- Cache API and database responses that do not change per user.
- Keep the database or API close: same server or same datacenter.
- Use streaming and Suspense so the page shell appears before slow data.
Memory and Node.js Settings
Each Next.js process typically uses a few hundred MB, more with large caches or heavy pages. Watch memory per process over days for leaks, and set a memory limit in the systemd unit (MemoryMax). Use the current Node.js LTS release supported by your Next.js version.
Measure Real Performance
- Server timing: response time for HTML from Nginx logs (
$upstream_response_time). - Core Web Vitals (LCP, INP, CLS) from real users or Lighthouse.
- Load test key routes with k6 at expected peak (see our k6 guide).
Sizing
| Site | EPYC plan |
|---|---|
| Mostly static marketing or blog site | 2 vCores / 8 GB |
| E-commerce or content site with ISR and some SSR | 4 vCores / 16 GB |
| Heavy SSR, dashboards, image optimisation at scale | 8 vCores / 32 GB |
Middleware and Edge Logic
Middleware runs before every matching request, so keep it fast and limit it with a matcher to the paths that need it. Heavy work in middleware, such as database calls or large dependencies, adds latency to every page, including cached ones. Authentication checks that only verify a signed cookie are cheap; anything more belongs in the route itself.
Ship Less JavaScript
Server performance is only half the experience. Large client bundles slow interaction on mid-range phones, which many Indian users rely on. Use Server Components for content that does not need interactivity, import heavy libraries dynamically, and check bundle sizes in the build output. Faster pages also reduce the number of requests users repeat out of frustration.
Common Mistakes When Self-Hosting
- Running
next devinstead of a production build. - Building on the live server and running out of memory.
- Making every route dynamic by reading cookies or headers in a shared layout.
- Serving static assets through Node.js instead of Nginx.
- Running several processes without a shared cache while relying on on-demand revalidation.
Next.js Performance Checklist
- Build output reviewed: only routes that must be dynamic are dynamic.
- Standalone build created in CI and deployed as a release.
- One process per vCore, with a shared cache if you rely on revalidation.
- Nginx serving
/_next/staticwith one-year caching, plus compression and HTTP/2. - sharp installed, or images pre-optimised or served via a CDN.
- Response times and Core Web Vitals monitored after each release.
SkyRainCloud Plans for This Workload
Next.js servers are CPU-bound during rendering and memory-bound during builds. 2 vCores / 8 GB runs a typical site; 4–8 vCores help sites with heavy server rendering, image optimisation or builds on the same server.
AMD EPYC 7C13 VPS
Dedicated KVM vCores on AMD EPYC 7C13 (up to 3.70 GHz) with DDR4 ECC memory, NVMe SSD and an unmetered 1 Gbps port.
| Plan | vCores | RAM | Storage | Network | Price | Good for | Buy |
|---|---|---|---|---|---|---|---|
| VPS 1 — AMD | 2 | 8 GB DDR4 ECC | 40 GB NVMe SSD | 1 Gbps, unmetered | ₹649/month | Websites, small APIs, bots, staging and VPN servers | Order |
| VPS 2 — AMD | 4 | 16 GB DDR4 ECC | 80 GB NVMe SSD | 1 Gbps, unmetered | ₹1,299/month | WooCommerce, Node.js/Python backends, Docker Compose stacks, CI runners | Order |
| VPS 3 — AMD | 8 | 32 GB DDR4 ECC | 150 GB NVMe SSD | 1 Gbps, unmetered | ₹2,499/month | Production databases, high-traffic sites, multi-container apps | Order |
| VPS 4 — AMD | 16 | 64 GB DDR4 ECC | 250 GB NVMe SSD | 1 Gbps, unmetered | ₹4,899/month | Large production workloads, SaaS platforms, analytics, in-memory caches | Order |
Prices are monthly in INR as listed on the SkyRainCloud store (verified 2026-11-14). Stock and final pricing are shown on the product page at checkout.