Medplum capacity planning and server sizing

Size Medplum application servers, PostgreSQL and Redis from measured load, with CPU headroom targets, connection pool limits and scaling triggers set before an incident.

On this page

Why Medplum capacity planning starts before go-live

Capacity planning for a self-hosted Medplum deployment means estimating the load your users and integrations will place on the system, sizing the application tier, PostgreSQL and Redis to carry that load, then setting headroom targets and the triggers that tell you to add capacity. Start this work before go-live, not after the first slowdown. Medplum's server is built on Node.js and TypeScript, uses PostgreSQL as its database and Redis as its cache, so each of those three layers has its own limits and its own signals. No published sizing figures are supplied for this topic, so the numbers you act on must come from your own load tests and metrics, not from a vendor table or a rule of thumb copied from another deployment.

Teams need this work at three points. The first is before launch, when expected traffic from applications, Bots and integrations has to be translated into request rates, concurrent sessions and database connections. The second is before a large data load, such as a bulk import during a migration, because imports can produce sustained write pressure that looks nothing like steady clinical traffic. The third is before an upgrade, since a new version or a post-deploy data migration can change resource use, and you want a known baseline to compare against. Ask your team to record current CPU, memory, connection counts and request latency at each of these points so that the next decision rests on measurements you already hold.

How load flows through the Medplum tiers

Requests start at clients and integrations, pass through a load balancer to several Medplum app instances, and then hit PostgreSQL for records and Redis for cache. The monitoring box reads CPU, connection pool and latency signals from each tier, so sizing decisions can be checked against the tier that actually saturates first. Read the diagram left to right and ask which tier reaches its limit first under your peak load, because that tier sets the scaling trigger.

Request path from callers through app instances to PostgreSQL and Redis, with monitoring across tiers.

Sizing options and when each fits

This table compares four ways to size a self-hosted Medplum deployment: load testing a staging copy, projecting transaction volumes, scaling one database instance up, and adding application instances behind a balancer. Read each row for the conditions that favor it, the effort it takes, and the risk that most often causes trouble. Most teams combine two or more of these approaches rather than relying on one.

ApproachWhen it fitsEffortMain risk
Load test against a staging copyGo-live is near, or traffic patterns are hard to predict from paper estimatesModerate: a production-like dataset, test scenarios and time to read database and cache metricsStaging data volume or query mix may not match production, so results look better or worse than reality
Size from projected transaction volumesEarly planning, before real traffic exists, or when a new integration has a known message rateLow to moderate: requires agreed volume estimates per workflow, such as FHIR reads, writes and Bot runsProjections often miss peak bursts, bulk imports and Subscription fan-out, which dominate load
Scale up one database instanceDatabase CPU or memory is the proven bottleneck and the application tier is not saturatedLow in configuration, but usually needs a maintenance window and a rehearsed rollbackVertical growth has a ceiling and a single instance remains a failure point until replicas are added
Add application instances behind a load balancerRequest latency rises while database and cache headroom remain, or when you need failure toleranceModerate: deployment changes, health checks, shared session and cache configurationExtra instances add connections to PostgreSQL, so pool limits can be exhausted faster than CPU

How to size Medplum step by step

This sequence turns expected FHIR, Bot and integration demand into a tested sizing decision for the app servers, PostgreSQL and Redis, with the thresholds that trigger scaling written down before go-live. Each step ends with a check you can record and rerun after changes.

  1. Define expected request volumes and workloads

    Your architecture or product team lists the expected FHIR reads and writes per second at peak, the search and GraphQL patterns that dominate, and the Bot, Subscription and integration traffic that runs alongside user activity. Include batch loads such as nightly imports and reporting exports, since they often set the peak. Record the peak window and the growth you expect over the next planning period. The step is done when the team signs off a single workload profile that the load test in a later step can reproduce.

  2. Deploy a staging stack matching production

    The platform team deploys a staging Medplum stack using the same deployment type you plan to run in production, whether that is AWS with CDK, Kubernetes, Docker or another supported option. Match the instance classes, container limits, PostgreSQL version and configuration, and Redis setup as closely as your budget allows, because sizing results from a smaller or different topology will not transfer. Confirm that the Medplum version matches the one you intend to run in production. The step is done when staging passes a health check and its configuration is captured in version control for comparison later.

  3. Set connection pool limits against PostgreSQL capacity

    Before any load test, the database owner calculates the total connections that all app server instances can open at their configured pool size, and compares that total with the maximum connections the PostgreSQL instance accepts, minus headroom for administrative sessions, migrations and monitoring. Confirm the exact configuration keys and defaults in the self-hosting documentation for your version. If the product of instances and pool size exceeds available connections, reduce the pool size or add a pooler before testing. The check passes when the worst-case total, including a scale-out event, stays below the limit with spare capacity.

  4. Run load tests across ramp phases

    The performance team runs load tests against staging that reproduce the workload profile, increasing traffic in phases so that you can see where latency and errors begin to rise. Include a sustained peak phase long enough to reveal memory growth, connection exhaustion and queue buildup. Run the same scenario after any configuration change so results are comparable. The step is done when the team has a test report for each phase that shows throughput, latency percentiles and error rates alongside the resource metrics captured during each phase.

  5. Read app, PostgreSQL and Redis metrics against headroom targets

    During each load phase, the on-call or platform engineer reads application server CPU, PostgreSQL CPU, active and waiting connections, query latency, and Redis memory use and eviction behavior. Compare each figure with the headroom target your team sets before testing, so that the peak phase leaves capacity for bursts and failover. Look for signs that a resource is saturated, such as connection waits, rising Redis memory without a plateau, or CPU that stays high after load falls. The check passes when every resource at the sustained peak stays under its target, or when the team records the constraint that needs a fix and reruns the test.

  6. Set scaling triggers and alert thresholds

    The platform team defines the signals that will prompt more app server instances, a larger database instance, or a Redis change, using the metrics from the load tests as the baseline. Write each trigger with its metric, threshold, duration and the action it starts, and link those triggers to alerts in your monitoring system. Confirm that the triggers fire before the saturation point identified in testing, not after. The step is done when each trigger has an owner, a documented action and a test that shows the alert fires in staging.

  7. Right-size the database before go-live

    The database owner compares the measured peak against the instance class, storage throughput and connection limits chosen in the staging stack, and resizes the production PostgreSQL instance so that the expected peak fits with headroom. Recheck the pool limits from the earlier step against the final instance size, and confirm that the chosen storage can sustain the write rate from the workload profile. Ask your cloud or data center team for current pricing and instance options when you request the quote, since sizing changes recurring infrastructure cost. The step is done when the production sizing is approved, documented, and rechecked by a second engineer.

  8. Repeat sizing after every major change

    The platform team schedules a repeat of the load test and metric review after a Medplum upgrade, a change in data volume, a new Bot or integration, or a new deployment region. Medplum's upgrade path requires moving through each minor version in order, so plan capacity checks as part of each upgrade rather than assuming earlier results still hold. Update the workload profile, the scaling triggers and the connection calculation at the same time. The step is done when the capacity record is updated, the staging results are archived, and the next review date is set.

Scaling triggers to define before an incident

Each trigger below points at a different layer of a self-hosted Medplum deployment: the application servers, the connection path to PostgreSQL, the query workload, the Redis cache and the rate limits clients hit. Define them together, because a single metric rarely shows the whole picture. Every threshold must come from your own baselines measured under representative load, not from a number copied from another team.

Sustained application CPU

Track CPU on the Medplum application servers over a sustained window, not brief spikes. Set a headroom threshold that leaves room for a failed instance to be absorbed by the rest of the fleet, so losing one server does not push the others past saturation. Record the baseline at normal peak hours, then alert when sustained CPU crosses the level where a single instance loss would hurt. Confirm the window length and threshold with your own load tests before you rely on them.

Connection pool wait time

Medplum servers hold a pool of connections to PostgreSQL. When requests spend time waiting for a free connection, the database may be healthy while the application is starved. Measure how long requests queue for a pool slot at peak and alert on a rising trend, not a single reading. Rising wait time often comes before CPU or latency alarms, so it is one of the earliest signals that more capacity or a pool change is needed.

PostgreSQL connection saturation

Compare total open connections across all application instances with the maximum PostgreSQL accepts. Multiple app servers each hold their own pool, so adding instances raises database connection demand even when traffic is flat. Alert well before the limit, and account for admin sessions, migrations and any connection proxy in the count. Scaling out app servers without checking this total is a common way to trigger a database incident.

Slow query growth

Watch the duration and frequency of the slowest queries over time, not only the average. A query that grows as tables fill can stay acceptable for months and then degrade quickly. Use pg_stat_statements to track total time per statement and flag statements whose share of database time is climbing. Each trend should trigger a review of indexes and data volume before the database hits its limits.

Redis memory pressure

Redis serves as Medplum's cache, so memory pressure shows up as lower hit rates and more load on PostgreSQL. Track used memory against the configured maximum, eviction counts and cache hit rate together. Alert when memory headroom shrinks or evictions begin during normal traffic, because a cache that evicts under routine load pushes work back onto the database. Confirm the memory limit and eviction policy in your own configuration.

Rate limit 429 responses

Medplum applies rate limits and FHIR quotas, and clients receive 429 responses when they exceed them. A rising 429 rate can mean an integration is misbehaving, a quota is set too low for real demand, or the platform is being pushed toward its limits. Split 429 counts by project and client, then decide whether the cause is client behavior or genuine growth that needs more capacity. Review the limits before adding hardware for them.

Right-sizing PostgreSQL before an incident forces it

The database is usually the hardest tier to resize live, so size PostgreSQL for where the data will be in one to two years, not for today's load. Application servers can be added behind a load balancer or replaced in a rolling change, but changing instance class, storage or connection limits on a busy primary often means a maintenance window, a failover or a restart. Medplum stores FHIR resources in PostgreSQL, and resource tables and their indexes grow with every write, history version and search parameter. Ask your team to record current database size, the growth rate of the largest resource tables and the size of their indexes, then project those numbers forward and check that storage, memory and IOPS still cover the projection with room to spare.

Index size matters as much as row count. Search performance depends on whether the working set of tables and indexes fits in memory, so a database that was comfortable at launch can slow sharply once indexes outgrow available RAM. Plan storage in terms of total on-disk footprint including indexes, WAL and backups, and set a trigger for resizing that fires well before the disk or memory limit is reached. Confirm with your Medplum and PostgreSQL versions how the server manages connections and statement timeouts, because those settings interact with how much concurrency the database can absorb.

Upgrades add temporary load that steady-state sizing does not show. The Medplum upgrading guide notes that Medplum must be upgraded through each minor version in sequence, and that post-deploy data migrations can run for hours or days on large datasets. During that period the database may serve normal traffic while also rewriting or reindexing data, so it needs CPU, I/O and storage headroom beyond the usual peak. For illustrative planning, schedule a staging run of the largest migration on a copy of production data, measure its duration and storage growth, and add those numbers to your upgrade window. Capacity plans should therefore include the upgrade path and the time it takes, not only the production traffic curve.

Security and operational considerations for capacity changes

Capacity changes touch the same settings that control access, data paths and recovery, so they need the same discipline as any other production change. The cards below cover the controls that keep a resizing exercise from creating a security gap, an outage or an unexplained record.

Put pool and instance changes under change control

Connection pool sizes, instance classes and replica counts are production configuration, and a change to any of them can exhaust PostgreSQL connections or shift load onto a single node. Record each change with its reason, the metric that justified it, the rollback value and the approver. Make the change through the same infrastructure code path used for the rest of the deployment, so the running state matches what the team reviewed. Confirm with your own environment's tooling how a rollback is applied under load.

Keep metrics endpoints off public networks

Metrics and health endpoints reveal request volumes, error rates, queue depths and sometimes internal hostnames, which is useful to an attacker mapping a deployment. When you add app servers or scale a load balancer, confirm that metrics listeners are reachable only from your monitoring network and that load balancer rules do not expose them. Check this after every scaling event, because new instances can inherit a broader security group than the one you reviewed.

Keep secrets out of scaling scripts

Autoscaling hooks, resize scripts and one-off capacity runbooks often end up with database passwords or Redis credentials pasted into them. Pull credentials at run time from your secrets manager, scope the identity that runs the script to the actions it needs, and never print connection strings into job logs. Review the scripts in version control the same way you review application code.

Test failover at the capacity you expect

A deployment sized for normal traffic may fail when one app server or one database node is removed and the remaining nodes take the full load. Rehearse a node loss at your planned peak in a non-production copy, and watch connection counts, CPU headroom and Redis memory during the rehearsal. Record whether the remaining nodes stayed under the headroom target you set. Pair this with the high-availability and disaster recovery work so the failover test and the recovery test use the same assumptions.

Confirm Medplum upgrades keep sizing settings

Sizing decisions can drift during a Medplum upgrade, since a new server release may change defaults or migration load. Before an upgrade window, check the release notes for the version you are moving to and confirm the database and pool settings still apply. Medplum's upgrade guide requires moving through each minor version in sequence, so plan capacity checks at each step rather than only at the end.

Upgrade guide

Record sizing decisions as compliance evidence

Compliance reviewers often ask how a system was sized, who approved the change and how availability was protected. Keep a dated sizing record that links each setting to the load test, the metric review and the approval that supports it. Medplum's compliance documentation states that compliance is a shared responsibility between Medplum and the customer, so the operator must hold this evidence. Confirm with your assessor which records they expect before you start.

Medplum compliance docs

Capacity planning questions buyers ask

How much effort does a Medplum sizing exercise take?

Effort depends mostly on how well the expected load is known and how many environments must be measured. A team that already has traffic data from an existing system can build a workable load profile quickly, while a greenfield build needs assumptions that must be tested. The work covers collecting request patterns, mapping them to FHIR interactions, sizing application servers, PostgreSQL and Redis, and running load tests against a staging copy. Ask any partner to show how the estimate splits between discovery, testing and tuning, and to name who pays for each part. No fixed duration is given here because it varies with the scope agreed in writing.

Can our own team size Medplum without a partner?

Yes, if the team has engineers who understand Node.js services, PostgreSQL tuning and container resource limits, and access to metrics from a realistic environment. Medplum's server is built on Node.js and TypeScript and uses PostgreSQL and Redis, so the same metrics that show database and cache pressure will guide sizing. The harder part is usually producing a credible load profile and a repeatable test. Teams without that experience often benefit from an outside review of their results before committing to instance sizes. Your own staff can keep the sizing current as usage grows.

What do we need to provide for a sizing engagement?

The work depends on inputs from your side that no outside team can invent. Expect to provide the expected number of users and integrations, peak and average request rates by type, batch and Bot activity, data volumes and growth expectations, and the hosting target such as AWS, Kubernetes or Ubuntu. You also need a staging environment that matches production topology closely enough to test, and read access to application, load balancer, PostgreSQL and Redis metrics for the period you want to model. Confirm retention of those metrics before the project starts, since short retention limits what can be analyzed.

How long does sizing take relative to go-live?

Sizing should finish before the production build is frozen, because instance classes, connection limits and database settings are expensive to change late. The sequence is usually discovery, a baseline test, tuning, and a retest against the expected peak. Each step depends on how quickly staging can be provisioned and how many test cycles are needed. Plan sizing as a gate on the go-live schedule rather than a parallel task, and confirm with any partner how many test rounds the written scope includes. The exact duration should come from that scope and your environment, not a general rule.

What changes in capacity needs after a Medplum upgrade?

An upgrade can change resource use even when your traffic stays the same, so sizing needs a check after each one. Medplum ships new minor versions regularly and requires upgrades to proceed through each minor version in sequence, so the path itself is a planning input. Changes to query patterns, indexes, background jobs or data migrations can shift CPU, memory and database load. Rerun a targeted load test against staging before and after the upgrade, compare the same metrics, and review connection pool settings. Keep the baseline from the previous version so any regression is visible.

Which metrics show that Medplum needs more capacity?

Watch CPU headroom on application servers, PostgreSQL connection usage and query latency, pool wait times, Redis memory and latency, and load balancer error rates. Sustained high CPU, growing waits for pool connections and rising database latency at normal peaks are the clearest signals to scale. Set these as alerts well before saturation, not at the point of failure. The monitoring content for this deployment covers thresholds in detail, and sizing decisions should be tied to the same numbers the on-call team will see.

Does DeployOpen size Medplum deployments?

DeployOpen plans, implements, hardens and supports self-hosted open-source platforms in infrastructure you control, and sizing is part of that work when it is in the written scope. The engagement can cover load profile design, staging tests, sizing recommendations for application servers, PostgreSQL and Redis, and a retest after changes. DeployOpen does not issue performance certifications or audit reports. Ask for the scope, deliverables and test rounds in writing before work starts, and confirm which environments and metrics the scope requires from your team.

Official Medplum sources for sizing decisions

Before you set any CPU, memory, connection or rate limit values, check the official Medplum material for the version you actually run. The Medplum self-hosting documentation describes the supported deployment paths and the infrastructure each one assumes, and it is the first place to confirm which components your chosen path deploys and how they are wired together. Medplum's server is built on Node.js and TypeScript, uses PostgreSQL as its database and Redis as its cache, and sizing questions for each of those layers start from that architecture. Record the exact version of each component in your environment so every later sizing decision can be traced to a specific release.

Next, read the Medplum upgrading guide and the medplum/medplum GitHub repository. The upgrading guide matters for capacity work because post-deploy data migrations can run for hours or days on large datasets, which means a version change can temporarily change the load profile on your database. The repository shows the current components, including the FHIR API, Bots, Subscriptions and the HL7 client and server, and the code paths that drive database and cache usage. Where the documentation does not state a value, such as a recommended connection pool size for your instance class, ask Medplum or check the configuration reference for your version rather than copying a number from another deployment.

Finally, review the release notes for your version on the Medplum releases page before you set any limits. Release notes can change default behavior for rate limits, database access patterns or caching, and those changes can invalidate a sizing baseline you measured on an earlier version. Treat each upgrade as a point where you re-check headroom against the new notes and your own load measurements. Keep a short sizing record that lists the version, the defaults you accepted, the overrides you made and the reason for each, so the next person to review capacity can see what was decided and why.

How DeployOpen scopes and delivers Medplum capacity work

DeployOpen plans, implements and documents self-hosted Medplum inside infrastructure you control, including the sizing of application servers, PostgreSQL and Redis. Engagements are fixed-scope, with the sizing method, deliverables and timelines agreed in writing before work starts.

How we scope

  • Written scope covers current and forecast load, target environment and the components to be sized.
  • We confirm which Medplum version and deployment method your team runs before sizing begins.
  • Scope states which measurements, load evidence and handover documents are included in the fixed deliverables.

How we build

  • We set CPU headroom targets, connection pool limits and scaling triggers for each Medplum component.
  • Sizing is checked against load tests and database and cache metrics before values are recommended.
  • Configuration changes are applied through your own infrastructure as code and version control.

How we hand over

  • You receive a sizing document with the assumptions, thresholds and reasoning behind each recommendation.
  • Scaling triggers and alert thresholds are documented so your on-call team can act on them.
  • Walkthroughs with your platform and database owners cover how to review sizing as load changes.

How we support

  • Ongoing support, upgrades and continuous testing are available as retainers for growing deployments.
  • Retainers can include periodic re-sizing as user counts, data volumes and Medplum versions change.
  • Ask any provider to confirm how sizing is revisited after each Medplum minor version upgrade.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.