How much RAM does Keycloak need?
Self-hosted identity and access management with single sign-on, OpenID Connect, SAML 2.0, social login and LDAP/Active Directory user federation. Official requirements, sourced, plus our own measurements.
Last updated: 2026-11-27
Pinned version: Keycloak 26.8.2 (quay.io/keycloak/keycloak@sha256:7e66a96e4739)
Our measurement
698 MB idle RAM · 655 MB disk (images 473 + data 182) · keycloak 698 MiB (single container, built-in H2 database)
The official Docker getting-started command (start-dev, one container) with the image pinned to 26.8.2 and a 2 GB container memory limit as the docs advise. Port 8080 was published on localhost only and the default admin user from the docs was used. At idle only the built-in master realm existed. The container's writable layer was 182 MB after the load test (about 7 MB of it the H2 database; the rest are files the server writes at first start).
Method: Official docker run command from the Keycloak docs, run with docker run (-m 2g) and the exact version tag. Measured 10 minutes after the server reported it had started as docker stats MEM USAGE (MiB), 3 samples 20 s apart (median). Disk = pulled image size (docker reports 473 MB) + the container's writable layer after the load test (182 MB).
Host: 8 vCPU Intel Xeon VM, 16 GB RAM, Debian 13 (kernel 6.12), Docker 26.1.5
Version: Keycloak 26.8.2 (quay.io/keycloak/keycloak@sha256:7e66a96e4739) · Compose: source · Date: 2026-11-27
With sample data
698 MB idle RAM · 655 MB disk · keycloak 883 MiB at the highest sample (877 MiB during the logins themselves); 883 MiB settled about 5 minutes after the last login
Peak RAM during processing: 883 MB
Sample: Followed the docs: created a realm (myrealm) and an OpenID Connect client (myclient), with direct access grants switched on for scripted logins. Created 100 users with passwords, logged each in once, then ran 1,000 more password logins (8 at a time, each followed by a userinfo request). All 1,100 logins succeeded. A first attempt failed because the test users had no email address (Keycloak answered 'Account is not fully set up'); we deleted that realm and repeated the test with emails, and the figures below are from the repeat.
RAM rose from 698 MiB at idle to 877 MiB during the logins, and crept up to 883 MiB in the following minutes before staying flat. The highest sample was 883 MiB. The logins used the default password hashing (Argon2) with a small user list, one client and the built-in H2 database, so real traffic with many clients, a PostgreSQL database or federated users will use more.
Method: Same official setup and host as the idle measurement. Peak RAM = docker stats of the container polled about every 2 seconds from before the first request until the end of the settle check, about 5 minutes after the last login (the highest sample is shown). Settled RAM = 3 samples 20 s apart, about 5 minutes after the last login (median).
Version: Keycloak 26.8.2 (quay.io/keycloak/keycloak:26.8.2) · Date: 2026-11-27
Compare
What the official docs say
- The official Docker guide gives a single docker run command (quay.io/keycloak/keycloak:26.8.2 with start-dev), exposed on port 8080 with an initial admin user created from two environment variables. It states no minimum RAM or CPU.
- The container guide says to always set a container memory limit, because without one the Java heap can grow up to 70% of the container memory, and gives 2 GB as the recommended memory limit for smaller production-ready deployments.
- The production sizing guide gives 1250 MB of RAM as the base memory for a pod including realm caches and 10,000 cached sessions, plus about 1 vCPU for every 15 password-based logins per second.
- The database guide says the built-in H2 database is the default and only exists for development use-cases; the Docker guide says to switch to a production-ready database such as PostgreSQL before running in production. Our test used start-dev with H2, so a production setup adds a separate PostgreSQL database.
Fits a 4GB server?
yesThe docs recommend a 2 GB container memory limit for smaller production deployments. We measured 698 MB idle and 883 MB at the highest sample while 100 users were created and 1,100 logins were run. Plus 512 MB for the OS and 30% headroom that is about 1.8 GB, so it fits 4 GB for a small instance. This test used the development mode with the built-in H2 database; a production setup adds PostgreSQL, and many users, realms or logins per second will need more.
Sources
- Keycloak docs: Getting started with Docker checked 2026-11-27
- Keycloak docs: Running Keycloak in a container checked 2026-11-27
- Keycloak docs: Concepts for sizing CPU and memory resources checked 2026-11-27
- Keycloak docs: Configuring the database checked 2026-11-27
- Keycloak 26.8.2 release checked 2026-11-27
- Keycloak home page checked 2026-11-27