How Puppet Server Uses Resources
| Resource | Why it matters |
|---|---|
| CPU cores | One compile uses one core. More cores allow more parallel compiles |
| Memory (JVM heap) | Each JRuby instance needs memory. Too little causes slow garbage collection or crashes |
| Disk and I/O | Reading code, writing reports and PuppetDB data |
| Network | File serving for source => files, many agents polling |
Rules of Thumb for Sizing
| Fleet size | Typical starting point |
|---|---|
| Up to ~500 nodes | One server: 4 to 8 cores, 8 to 16 GB RAM (PuppetDB and PostgreSQL on the same host or separate) |
| ~500 to 2,500 nodes | Larger single server, or server plus PuppetDB on a separate host, tuned JRuby pool |
| 2,500 to 10,000+ nodes | Primary server plus several compilers behind a load balancer, separate PuppetDB and PostgreSQL |
A quick estimate of how many agents one JRuby instance can serve:
Tune Puppet Server
| Setting | Meaning |
|---|---|
-Xmx | Maximum heap. Roughly (max-active-instances x 512 MB to 1 GB) + 1 GB extra |
max-active-instances | Number of compile workers. Too high: memory pressure. Too low: queue |
max-requests-per-instance | Recycle workers after N requests, to prevent leaks from old gems |
environment-class-cache-enabled | Faster class lookups, useful with Code Manager and PE |
Spread the Load: Run Interval and Splay
Without splay, thousands of nodes (for example, after a mass reboot) request catalogs at the same minute, creating a spike. With splay, every agent adds a random delay once and then keeps its own schedule. For long-running fleets, you can also use cron or a systemd timer with a random delay instead of a long-lived daemon.
Compilers and Load Balancer
- The primary server holds the CA and is the source of code. Compilers only compile catalogs and serve files
- Code is deployed to all compilers (Code Manager does this, or r10k on each)
- Agents talk to the load balancer name. Certificates must include that name in
dns_alt_nameson the compilers - Use health checks against
/status/v1/simple - Certificate signing goes to the primary. Many setups send CA traffic by a separate rule or by
ca_server
Make Catalogs Cheaper
| Cause of slow or heavy catalogs | What to do |
|---|---|
Huge file trees with recurse => true | Package the files, or use an archive, or recurse => remote carefully |
| Many tiny resources made in loops | Move bulk data into a template or one file |
| Big facts (large hashes) | Block unused facts, trim custom facts |
Very deep Hiera with many files and deep merges | Shorten hierarchy, avoid huge merges |
| Custom Ruby functions that call the network | Cache, or run on the agent (Deferred) |
Complex inline_template and generate() | Replace with EPP and data |
| Source files via Puppet Server | Use a package repository, or a file mirror, instead of source => puppet:/// |
Environment Caching
Compile speed improves a lot when code is cached. Use environment_timeout = unlimited and refresh the cache when you deploy code (r10k or Code Manager do it). Frequent changes with environment_timeout = 0 read files on every request and are slow.
PuppetDB and PostgreSQL
- Give PuppetDB its own memory (
-Xmxin/etc/default/puppetdb), a starting point is 1 GB per ~1,000 nodes, adjusted by measuring - Run PostgreSQL on SSD storage, tune
shared_buffers(25% of RAM) andwork_mem - Set
node-ttlandreport-ttlso old data is removed (report-ttl = 14dis common) - Watch the command queue: a growing queue means PuppetDB cannot keep up
- Vacuum and monitor database size. Archive old reports if you need long retention
- Consider a PostgreSQL replica or managed service for production
Measure Before Tuning
The module puppetlabs-puppet_metrics_dashboard installs Grafana dashboards for Puppet Server and PuppetDB. Look at JRuby borrow time, queue length, average compile time and heap usage. If JRuby instances are all busy and requests wait, add instances (if you have memory) or compilers.
Troubleshooting Symptoms
| Symptom | Likely cause | Action |
|---|---|---|
| Agents time out or get HTTP 503 | No free JRuby instances | More instances/compilers, more splay, tune code |
java.lang.OutOfMemoryError | Heap too small for pool size | Increase -Xmx or reduce instances |
| Spikes every 30 minutes at the same time | No splay, or time sync cron | Enable splay, spread schedules |
| Slow only on first run after deploy | Environment cache empty | Warm up or accept, avoid frequent flushes |
| PuppetDB queue grows | Database too slow or PuppetDB heap small | More memory/IO, reduce report size, tune PostgreSQL |
| Disk fills up | Reports and logs | Set TTLs, rotate logs, remove old environments |
Practice Tasks
- Measure compile time for five nodes with
puppet catalog compileand compute agents per instance - Set
splayon lab agents and plot request times from the server log - Change
max-active-instancesand observe memory use - Draw a diagram with a load balancer and two compilers for 3,000 nodes
- Set PuppetDB TTLs and verify old reports are removed
Conclusion
Puppet Server performance is mostly CPU and memory per compile. Measure compile time, set JRuby instances and heap together, use splay, cache environments, simplify heavy catalogs and add compilers behind a load balancer as the fleet grows.

