VPS with 4 GB RAM: Windows, an online shop, a Docker stack and Java without compromises
Four gigabytes is the point at which a server stops being "single-task". It fits a full online shop with a database and cache, Windows Server for remote work, a small game server or a stack of several Docker containers. Yet 4 GB is still easy to waste: one misconfigured Java VM or an oversized database buffer eats half of it.
Typical tasks and their memory budget
- Windows Server with RDP. The system itself takes 1.5–2 GB after boot, and a browser with a few tabs plus an office suite add another gigabyte. For one or two users this is the working minimum; more on the VPS with Windows page.
- An online shop on a CMS. Nginx, PHP-FPM with 10–15 processes, MySQL with a 1 GB buffer and Redis for sessions fit in 3–3.5 GB. For 1C-Bitrix with composite caching this is a sensible minimum; see VPS for Bitrix.
- Docker Compose with 5–8 services: an application, PostgreSQL, Redis, a reverse proxy, monitoring. A typical example is an automation platform with its own database, as in the VPS for n8n section.
- A vanilla Minecraft server for 10–20 players: 2.5–3 GB goes to the Java heap, the rest to the system. With modpacks this is no longer enough.
- A test environment with a Java or .NET application and a database.
For a single bot, landing page or small blog, 4 GB is overpaying: such projects use less than a gigabyte, and the rest sits idle.
Java and Windows: where people most often go wrong
A Java application without an explicit limit takes a quarter of the machine's memory for its heap and may try to grow further under load. On 4 GB, set -Xmx manually and leave 20–30% on top of it for metaspace, thread stacks and buffers: with -Xmx3G the process actually takes 3.5–3.8 GB, and on a server with a database that is a sure path to the OOM killer. The same rule applies to Minecraft servers: a 3 GB heap out of 4 is the maximum, and only if nothing else runs on the server.
Windows has its own quirk: the page file is system-managed and grows by default, so a memory shortage shows up not as crashing processes but as sluggishness and RDP freezes. Look at the Committed line in Task Manager: if it is consistently above the physical amount, you are short of memory, no matter what Available shows.
How 4 GB pairs with cores and disk
On most plans 4 GB comes with 2 virtual cores and a 40–80 GB disk; options with 1 core or with 4 are less common. For a shop and Windows the second core matters more: PHP and the Windows interface hit single-thread CPU limits before they run out of memory. For a Docker stack with a database the disk matters more: take NVMe and check that there is enough space for images, since each layer takes hundreds of megabytes and nobody runs docker system prune just in case. If your scenario fits the budget, good-value plans of this size are collected in the cheap VPS with 4 GB selection.
Guaranteed memory or burst
On KVM, all 4 GB are allocated to the virtual machine. On OpenVZ and LXC, a "4 GB" plan is often made up of 2 GB of guaranteed memory and 2 GB of burst, which the node hands out only when resources are free. Container virtualisation doesn't suit Windows at all, and for Java and databases burst is dangerous: the application grows into the "bonus" memory and then hits OOM when the neighbours take their share. Look for the words "guaranteed" or "dedicated" memory and the virtualisation type in the plan description.
Checks after buying
systemd-detect-virt: make sure the virtualisation is the one you paid for.free -handcat /proc/meminfo: MemTotal should be about 3.8 GB. If you see 2 GB with "the rest on demand", you are looking at burst.- On a container, look at
/proc/user_beancounters(OpenVZ) or/sys/fs/cgroup/memory.max(LXC with cgroup v2): they show the real limits. - A load test:
stress-ng --vm 1 --vm-bytes 3G --timeout 60s. On an honest 4 GB it completes without killed processes and without a sharp rise in steal intop. - On Windows, open System Information and Resource Monitor: installed memory should match the plan.
If, once set up, the server consistently uses more than 3 GB excluding cache and swap keeps growing, the project has outgrown the plan: move to 8 GB before an OOM happens during working hours.