Load testing Medplum with Artillery before go-live
Medplum's own load and stress testing uses Artillery, and your test plan should exercise the Medplum server, PostgreSQL and Redis together. A self-hosted team preparing for go-live needs to know where its deployment starts to degrade before clinicians or integrations find out in production. Testing only the application tier hides the most common limits, which sit in database connections, cache round trips and the interaction between them. Medplum's load testing documentation is the natural starting point for the scenario files and run setup, and it should be read alongside your own capacity assumptions.
The unauthenticated /healthcheck endpoint is the first thing to understand in that plan. It connects to PostgreSQL and Redis and reports whether the instance can reach both, which is why load balancers use it to decide whether a server instance is healthy. That makes it useful as a signal during a test, but it is a shallow check: a passing healthcheck does not show that FHIR searches, writes or Bot executions are fast enough under load. Confirm with your load balancer's configuration how its health check interval, timeout and unhealthy threshold interact with a server that is slow but still responding, because a test that pushes latency up can trigger instance removal before you see the real limit.
Run this testing at three points: before go-live, before a major Medplum upgrade, and before any scaling change such as a different instance count, larger database class or new connection pool settings. Each of these changes the baseline, so results from an earlier build or sizing do not carry over. Ask your team to record the Medplum version, instance sizes, database and Redis configuration and the test scenarios with each run, so that a later comparison is valid. Plan the test window so it does not overlap with production traffic or shared environments, and agree in advance who can stop a run.
Choosing between healthcheck, FHIR and mixed scenarios
A healthcheck-only scenario repeatedly calls the unauthenticated /healthcheck endpoint. That endpoint connects to PostgreSQL and Redis, and load balancers use it to decide whether a server instance is healthy. The test shows how the load balancer and the application instances behave under concurrent connections, and whether the health check itself stays responsive as request volume grows.
- Load balancer behavior: Observe whether health check failures appear, how quickly unhealthy targets are removed, and whether targets recover.
- Connection handling: Watch for connection errors or timeouts at the server layer before any FHIR logic runs.
- Database and cache reachability: Because the endpoint checks both dependencies, slow responses can signal pressure on PostgreSQL or Redis connections.
- What it cannot prove: It says nothing about FHIR query cost, indexes, write throughput or authorization overhead.
- Use: Treat it as a smoke test for the infrastructure layer, not as evidence of clinical workload capacity.
Before relying on the results, confirm the endpoint behavior and response codes in the version you run against the Medplum load testing docs.
A read and search scenario sends authenticated FHIR requests that fetch resources by ID and run search queries. This is where most database query paths are exercised, including the index lookups behind common search parameters and the cost of returning large result sets. Cache use shows up here as repeated reads of the same resources.
- Query paths: Search parameters with and without supporting indexes behave very differently, so use a realistic mix of parameters.
- Cache effect: Repeated reads of hot resources can look fast because Redis absorbs them, which may hide cold-cache behavior.
- Result size: Searches that return many entries stress serialization and PostgreSQL in ways single reads do not.
- What it cannot prove: Write contention, index maintenance cost and background jobs stay outside this scenario.
- Dependencies: Confirm the exact FHIR search paths, parameters and token handling for your Medplum version before scripting them.
Keep the query mix and data volume recorded, because search results depend heavily on the dataset you load.
A write scenario creates or updates FHIR resources. Writes are where index maintenance, transaction handling and PostgreSQL write-ahead activity become visible. They also reveal whether the database can keep up when many clients change data at once.
- Index and write cost: Each write updates indexes, so write latency can rise as tables and indexes grow during the test.
- Contention: Concurrent updates to the same resources or the same project can create lock waits that reads never trigger.
- Table growth: Writes change dataset size, so a test that runs longer will measure a different system than a short one.
- What it cannot prove: Writes triggered by Bots, Subscriptions or async jobs are separate paths and need their own scenario.
- Cleanup: Plan how created test data is removed or isolated so it does not contaminate later runs or production-like datasets.
Confirm the create and update request shapes, and any required headers or project settings, against your deployed version and its authentication setup.
A mixed scenario combines healthchecks, reads, searches and writes in proportions that resemble the expected production pattern. It is the only type that shows how the components interact, because reads compete with writes for connections, cache and database resources.
- Interaction effects: Slow writes can increase connection pool wait times that then affect read latency.
- Ratios: Choose the request mix from your own usage analysis or from workflow estimates, and record how you derived it.
- Ramp behavior: Mixed traffic is the best place to observe how queues build as load ramps up.
- What it cannot prove: A test environment with different instance sizes, data volume or network paths will not match production exactly.
- Limits of the mix: Any ratio you choose is an assumption, so test several mixes rather than one.
Before sign-off, check that the mix, dataset size and environment are documented well enough for the results to be repeated and explained.
Artillery test options and when each fits
This table compares the main Artillery test shapes for a self-hosted Medplum deployment, from arrival-rate load phases to soak runs and network placement. Read each row against the load you expect in production, because the right rate and duration come from your own forecast rather than a default. The main takeaway is that a healthcheck-only run proves the stack is reachable, while only authenticated FHIR flows show whether PostgreSQL and Redis hold up under real work.
| Option | What it measures | When it fits | Trade-off |
|---|---|---|---|
| Load phase at expected arrival rate | Latency and error rate at the volume you forecast for normal business hours | First baseline run and every pre-go-live sign-off, using a rate you derive from your own expected traffic | Shows steady-state behavior only, so it can miss spikes that arrive faster than the forecast |
| Stress phase above expected peak | The rate at which latency climbs, errors begin, or the database and cache saturate | After the baseline passes, to find headroom and the first bottleneck (app servers, connection pool, PostgreSQL or Redis) | Can overload shared environments and produce failures that would not occur in production, so run it in an isolated copy |
| Soak run over extended duration | Slow leaks, connection growth, cache memory drift and log or disk growth over time | Before go-live and after upgrades, to see whether performance degrades during long operation | Takes the most wall-clock time and generates the most data to review; choose the duration from your change and release calendar |
| Healthcheck-only scenario | Whether the unauthenticated healthcheck endpoint responds, including its PostgreSQL and Redis connectivity checks | Quick verification that load balancers will see instances as healthy, and for testing health-driven failover behavior | Does not exercise FHIR reads, writes, search or authorization, so it overstates real capacity |
| Authenticated FHIR workflow scenario | Token issuance, search, create, update and read paths across PostgreSQL and Redis under realistic resource mixes | Sizing decisions and go-live readiness, once you have representative test users, projects and data | Needs test credentials, seeded data and scripted flows that match your workflows, which takes the most preparation |
| Run from inside the network | Internal latency to the app tier, database and cache without internet or load balancer edge effects | Isolating server and database limits, and checking connection pool behavior | Excludes edge components such as the public load balancer, DNS and WAF, so results can look better than users will see |
| Run from outside the network | End-to-end latency and errors as clients experience them, including load balancer and TLS termination | Validating the public path and any rate limits or firewall rules the clients will meet | Results include generator-side and internet variability, so separate those effects before blaming the server |
How to set up an Artillery test against Medplum
This sequence moves a load test from an isolated target that matches production sizing through a warm-up, ramped load, and checks against database and cache metrics, so the results show where a self-hosted Medplum deployment starts to struggle before go-live.
Confirm a non-production target that matches production
The platform or SRE lead confirms that the test environment runs the same Medplum version, application server count, instance sizes, PostgreSQL and Redis configuration, and load balancer settings as the production target, and that no real patient data or live integrations can reach it. Results from a smaller or differently configured stack describe that stack, not production. Record the target's sizing in the test plan so every later result can be read against it. The step is done when a reviewer has signed off the environment inventory and the isolation controls, including network boundaries and outbound connections that are blocked or stubbed.
Create test projects and least-privilege client credentials
The Medplum administrator creates a dedicated test project and a client application with client credentials for the Artillery runner, granting only the access policies that the scenarios need, such as reading and creating the resource types they exercise. Credentials stay out of scenario files and are injected from the runner's secret store at run time. Separate credentials for each scenario make it possible to trace load to its source in the logs. The step is complete when a test token can call the intended FHIR endpoints and is refused on resources outside the scenario, which the team confirms with a few manual requests.
Seed representative FHIR data
The team loads synthetic patients, encounters, observations and other resources that match the shape and volume the scenarios will query, including the search parameters and sort orders used by real workflows. Seeding with empty tables produces misleading query plans and cache behavior, so the dataset size and distribution should be chosen with the clinical application owners and recorded. Synthetic data should be clearly labeled and should never be copied from production records. The step is done when row counts and index usage in PostgreSQL are close to the planned volume and a sample of searches returns expected results.
Write the Artillery scenario file
The load engineer writes an Artillery scenario that covers the unauthenticated
/healthcheckendpoint, which Medplum's load testing guidance describes as checking connectivity to PostgreSQL and Redis, plus authenticated FHIR reads, searches and writes that reflect the planned mix of traffic. Each scenario has a named weight, think time and assertions on status codes and response times. Variables for the base URL and credentials come from the environment, not from the file. The step is done when the scenario passes a dry run against a single virtual user and the request log shows each intended call succeeding.Run a warm-up healthcheck test
Before any load, the engineer runs a short Artillery test that only calls
/healthcheckon each application server behind the load balancer. The check confirms that every instance reports healthy, because the load balancer uses this endpoint to decide whether an instance receives traffic. An instance that fails here will skew results, so it must be fixed before the test continues. The warm-up also primes connections and caches. The step is complete when all instances return a healthy response consistently and the team has recorded the baseline latency for the endpoint.Step through ramp phases with checks after each phase
The load engineer runs the authenticated scenario in increasing phases, holding each arrival rate long enough to reach steady state, and stops early if error rates climb or response times break the thresholds set in the plan. Between phases the team pauses to confirm that the healthcheck still reports healthy on every instance. Stress phases above the expected peak show where the system fails, and each phase is labeled so results can be compared. The step is done when the planned peak has been reached or a clear limit has been found and the run has been stopped safely.
Check results against database and cache metrics
After each phase, the operations team compares Artillery's latency and error output with PostgreSQL metrics such as connection use, lock waits and slow statements, and Redis metrics such as memory use, latency and evictions, along with application server CPU and memory. A rise in response time that tracks connection pool saturation or database waits points to a different fix than one that tracks CPU on the application tier. Results and metric exports are stored together with the phase label. The step is complete when each phase has a written finding that names the constraint, or states that no constraint was reached at that load.
Record limits and decide on sizing changes
The engineering lead summarizes the phases into a report that states the sustained load each configuration handled, the first constraint observed, and the metrics that showed it. The team then decides whether to change sizing, pool limits or rate limits and reruns the affected phases to confirm the change. Confirm with the Medplum deployment owner which limits are acceptable for go-live and which need a retest after changes. The step is done when the report is approved and the retest plan is scheduled.
Designing ramp phases that find the breaking point
A useful load test is a sequence of phases, each answering a different question, and the stop rules are written down before the first request is sent. Start with a warm-up phase at low arrival rate so connection pools in the Medplum server, PostgreSQL and Redis fill to their normal working state and caches are populated. Results from a cold start say more about startup behavior than about steady-state capacity, so discard warm-up numbers when you compare runs. Follow it with a linear ramp that increases the arrival rate in fixed steps, which shows where latency starts to bend and where error rates begin to climb. Use the same scenario file for every step so that a change in results comes from load, not from changed test logic.
Hold a sustained load at the level you expect at peak for long enough to surface slow leaks and queue build-up, such as connections that are not returned to the pool or Redis memory that grows over time. Then push a stress phase above expected peak to find the actual breaking point and to confirm how the deployment fails. A healthy system degrades in a predictable way, with rising latency and clear rejections, rather than with a cascade of timeouts. Finish with a cool-down phase back to low load, because recovery time is a result in its own right: if latency or connection counts do not return to baseline, something is holding resources. Your team should confirm the target peak and the duration of each phase with the people who own the traffic forecast, since those numbers come from your own usage, not from this guide.
Set stop thresholds for PostgreSQL connection use, Redis latency, HTTP error rate and /healthcheck failures before the run, and agree who can halt the test. Watch the database and cache metrics live, not only the Artillery summary, because a Medplum deployment can hit pool exhaustion in PostgreSQL before the load generator reports errors. When a threshold is crossed, stop the phase, record the step at which it happened, and do not continue to see whether things recover on their own. Ask your database and cache owners to confirm which metrics and alert levels they will watch during the test, and make sure stopping the run is a documented action with a named owner.
How the load test traffic reaches Medplum
The test starts with Artillery workers, which send FHIR and healthcheck requests through the load balancer to the Medplum server instances. Each instance reads and writes PostgreSQL and uses Redis as its cache, and the load balancer uses the unauthenticated /healthcheck endpoint to decide whether an instance stays in rotation. Results from Artillery and the metrics from the environment flow back to the team, who should check whether slow responses line up with database or cache pressure, and whether any instance failed its healthcheck during the ramp.
Load test traffic path, healthcheck probes and metrics feedback inside the test environment.
Reading Artillery results against database and cache metrics
Artillery output on its own tells you how requests behaved from the client side: response times, error counts and throughput. The cause of a slow or failing request sits on the server side, so the useful reading comes from lining up each Artillery phase with what PostgreSQL, Redis and the application servers were doing at the same moment. Export or record the test window, then pull the matching time range from your monitoring. For each ramp step, check whether latency rose first in the database (active connections approaching the pool limit, query time climbing, lock waits appearing), in Redis (command latency growing), or in the application processes (CPU saturated or memory climbing). The first resource to saturate is usually the one to fix.
Do not treat a passing /healthcheck as evidence that the deployment is fast enough. Medplum's unauthenticated /healthcheck endpoint confirms that the server can reach PostgreSQL and Redis, and load balancers use it to decide whether an instance stays in rotation. It says nothing about whether a FHIR search that touches a large table returns within your target, or whether requests are queuing for a pool connection. Keep the healthcheck in your Artillery scenario so you can see whether it degrades under load, but judge the business requests separately, and set latency and error thresholds for each request type before the test runs.
Results transfer to production only when the test environment matches it in the parts that drive performance: instance sizes and counts, database and Redis capacity, connection pool and timeout configuration, and the data volume and index state a realistic workload would hit. A test against an empty database on a smaller instance will look better than production will be. Ask your team to confirm, in writing, which differences remain and what each one could change. For the metric detail behind these correlations, see the monitoring topic and the capacity planning topic in this group.
What goes wrong in load tests of self-hosted Medplum
Most load tests that look successful on a self-hosted Medplum deployment answer a different question than the one the go-live decision needs. The cards below cover the mistakes that make results misleading, from data that does not resemble production to healthchecks that report a server as healthy while requests are failing.
Testing against a thin dataset
A Medplum database with a few thousand resources behaves very differently from one holding years of Patient, Observation and Encounter history. Indexes, search plans and connection contention change with table size, so a fast result on an empty instance says little about go-live. Seed the test environment with volume and shape close to production, and record the row counts used so the result can be read later. Confirm the seeding approach with your own data profile before you trust any number.
Load generator becomes the bottleneck
Artillery runs on a machine with its own CPU, memory and network limits. If the generator saturates first, latency climbs and error rates rise even though the Medplum server still has headroom, and the report points at the wrong component. Check the generator's CPU and network utilization during every run, and split virtual users across several generator hosts when one host approaches its limit. Keep the generator in the same region as the target to avoid measuring internet latency.
Running against a shared environment
A staging environment that other teams use for integration testing, Bot development or nightly jobs produces results that mix several workloads. Background async jobs, a colleague's bulk export or a Subscriptions backlog can all look like server degradation. Run load tests on a dedicated stack that matches production topology, and schedule other work out of the window. Record what else was running so that a spike in the results can be traced to its cause.
Healthcheck hiding real failures
Medplum's unauthenticated /healthcheck endpoint connects to PostgreSQL and Redis and is what load balancers use to decide whether an instance is healthy. A server can pass that check while FHIR search, writes or authentication are slow or failing under load. Treat the healthcheck as a liveness signal only, and measure authenticated FHIR interactions in the scenario itself. Compare healthcheck results with request-level error rates and latency percentiles from the same run.
Traffic mix that misses production
A scenario that hits only one endpoint, such as a simple Patient read, does not reproduce the blend of searches, writes, Bot invocations, token refreshes and bundle transactions that production generates. Each request type stresses different parts of the server, PostgreSQL and Redis, so a single-endpoint run can pass while the real mix fails. Build the scenario from request logs or an agreed workload model, and weight each flow by its expected share. Label the mix used in the report so reviewers can judge its fit.
Load tests on production data
Running load traffic against a production database, or copying production records into a test system without controls, exposes protected health information to people and tools that are not authorized to see it. Synthetic patients should be generated for load tests, and any extract used for realism should be de-identified under your governance process before it leaves production. Confirm with your privacy and compliance team who may access the test environment, how it is logged and how it is deleted after the test.
Questions teams ask before running Medplum load tests
How much effort does a first Medplum load test plan take?
The effort depends on how many workflows the test must cover, how much of the deployment is already documented, and how many people must agree on the targets. A first plan usually covers the request mix that real users and integrations generate, the traffic shape (steady load, ramps and spikes), the environment the test runs against, and the pass or fail thresholds for latency, error rate and resource use. The biggest drivers are the number of distinct workflows, whether a production-like environment exists, and whether the team already knows its peak request volumes. Ask any partner for a written plan that lists these inputs before agreeing on a quote, since the plan sets the size of the test cycle.
Can an in-house team run Medplum load tests without a partner?
Yes, if the team has engineers who can write Artillery scenarios, operate the test environment and read database and cache metrics together. Medplum's own load testing documentation describes Artillery as the tool it uses for load and stress testing, so the starting material is public. The harder parts are building realistic FHIR workloads, keeping the test environment isolated from production data, and interpreting results across the application servers, PostgreSQL and Redis. Teams without a performance engineer often benefit from an outside review of the scenarios and thresholds before they treat the results as a go-live signal.
What does a load test need from our team?
A load test needs a non-production environment that matches the deployment's sizing, a dataset representative of your records, and named owners for each area. Typical inputs include access to the Medplum server endpoints, credentials for test clients with the right project and access policies, and permission to watch load balancer, application, PostgreSQL and Redis metrics during runs. You also need an owner who can approve test windows, a person who can stop a run if the database or cache is at risk, and a contact on the infrastructure side who can scale resources. Confirm each of these with your own environment before scheduling, because the access model differs by hosting choice.
How long does a Medplum load test cycle take, and what sets its length?
A cycle is the full loop of building scenarios, running ramp phases, collecting metrics, analyzing results, fixing findings and retesting. Its length is set by the number of scenarios, how long each ramp phase must hold to show steady-state behavior, how many fixes the results require, and how quickly the environment can be reset between runs. Ask any partner or internal lead for a timeline tied to these drivers rather than a single number. If the environment must be rebuilt or the dataset reloaded before each run, add that time to every iteration.
Is Artillery required to load test a self-hosted Medplum deployment?
Artillery is not strictly required, but it is the tool Medplum documents and uses for its own load and stress testing, which makes it the natural starting point for most teams. Using the same tool as the vendor helps when you compare results with Medplum's published guidance and when you share scenarios with the Medplum community. If your organization already standardizes on another load generator, you can use it, but you should confirm that it can exercise the same authenticated FHIR endpoints and that its results are comparable across runs. Whichever tool you choose, keep the scenario files in version control.
When should we repeat Medplum load tests?
Repeat load tests after any change that alters the capacity or request path of the deployment. Common triggers include a Medplum version upgrade, a change to application server count or instance size, database or cache changes, new integrations that add traffic, and changes to rate limits or access policies. Medplum ships minor versions two to three times a year and patch versions weekly, and self-hosted upgrades must pass through each minor version in sequence, so a team on an active upgrade path will face frequent triggers. Rerun the healthcheck and the key FHIR workloads at minimum, and run the full stress scenario when the change affects the database or cache layers.
What does a DeployOpen load testing engagement deliver?
DeployOpen plans, implements and documents work on self-hosted open-source platforms inside your own infrastructure, and load testing is delivered as part of that scope. Engagements are fixed-scope, so the deliverables, timelines and environment responsibilities are agreed in writing before work starts. A typical written scope for this work would list the workflows and endpoints covered, the Artillery scenarios and ramp phases, the metrics reviewed against database and cache data, the findings with recommended fixes, and the retest after changes. DeployOpen does not publish a price list, so a quote follows from that written scope. Ongoing testing after upgrades or sizing changes can be arranged as a retainer.
How DeployOpen scopes and delivers Medplum load testing
DeployOpen plans, runs and documents Artillery load and stress tests against a self-hosted Medplum deployment in infrastructure you control. The work starts from a written scope that names the workloads, environments and metrics to be watched, so the results can be read against your real database and cache limits before go-live.
How we scope
- Written scope names the Medplum version, hosting target and environment to be tested before any work starts
- Scenarios are agreed for healthcheck traffic and FHIR read and write workloads that match expected clinical usage
- Scope lists the PostgreSQL, Redis and load balancer metrics you want captured alongside each run
- Engagements are fixed-scope, with deliverables and timelines agreed in writing; ongoing support is available as a retainer
How we build
- Artillery scenarios are written for the agreed workloads, including the unauthenticated healthcheck endpoint used by load balancers
- Ramp phases move from baseline traffic to sustained and stress levels, with each phase recorded as a separate result
- Test runs are paired with database and cache metrics so latency and saturation can be traced to a specific component
- Test data, credentials and load generator placement are set up so the runs do not touch production records
How we hand over
- A findings report states the observed limits, the phase where each began to degrade, and the metrics behind that reading
- Scenario files, run configurations and dashboards are delivered so your team can rerun the tests after changes
- Recommended fixes for connection pools, instance counts and database sizing are listed with their expected trade-offs
- A walkthrough explains how to read the results and which thresholds to alert on before go-live
How we support
- Retesting after fixes or Medplum upgrades confirms whether the limits moved, under the agreed scope
- Ongoing load testing and continuous testing are available as retainers for teams that release changes regularly
- Support questions about the scenarios, results or your environment are handled against the written engagement
- Your team keeps full control of the infrastructure, and results stay within your own environment

