Blog

    Software Performance Testing for a FHIR API: Test Data, Rate Limits and Pass Criteria Before Go-Live

    By GauravSeptember 12, 20269 mins read
    On this page

    Software performance testing for a FHIR API tells you, before launch, whether the API will stay fast and correct when real apps, partners and nightly jobs hit it at the same time. A FHIR API carries extra traps that a generic web load test misses: search paging, large patient histories, token issuance and rate limits shared across many clients.

    Startup founders and product or engineering leaders preparing a FHIR API for go-live will find how to model the traffic, build data without real PHI, test rate limits and write pass criteria that give a clear launch decision.

    What is software performance testing for a FHIR API?

    Software performance testing for a FHIR API sends realistic, repeatable traffic to a production-like copy of the API and measures response times, error rates and resource use against agreed limits. It covers reads, searches, writes and token calls together, so the team learns how the whole service behaves under expected and peak demand before go-live.

    Getting a FHIR API ready for launch?

    We plan the load model, build the test data and run the tests against agreed pass criteria.

    A load test is not the same as a health probe. A probe sends one small request every few minutes to prove the endpoint answers; a load test pushes many concurrent users through real workflows to find where the service bends and where it breaks.

    Why test performance before go-live?

    Testing performance before go-live matters because the first heavy users of a FHIR API are often systems, not people. An app store launch, a partner's nightly sync or a payer's bulk pull can arrive in one burst, and a slow API at that moment damages trust with every connected organization.

    Problems found after launch are also harder to fix. Index changes, cache layers and paging rules touch the data model, and changing them while partners depend on the API means coordinated releases and regression testing across every client.

    Which traffic should the load model include?

    The load model should include each kind of client that will call the API, with its own mix of requests, its own peak times and its own way of handling errors.

    • Patient-facing apps: many short sessions that read the patient record, recent observations and medications right after sign-in.
    • Clinician tools: searches across encounters, conditions and documents, often with several parameters and includes.
    • Partner integrations: scheduled polling or sync jobs that read large result sets page by page at fixed times.
    • Write traffic: questionnaire responses, device observations or appointment changes posted in bursts.
    • Token traffic: authorization and token refresh calls that happen before any FHIR request succeeds.

    Write each client down with the operations it calls, how often, and at what time of day. That table becomes the input to the test scripts and the record of what the test assumed.

    How do you build test data without real PHI?

    Build test data with a synthetic patient generator or scripted fixtures, then shape it to match the size and spread of production rather than an even, tidy sample.

    • Long histories: include patients with years of encounters and thousands of observations, because those records drive the slowest searches.
    • Skewed volumes: a few organizations or practitioners should own most of the data, as they do in real deployments.
    • Realistic references: link resources the way the source system does, so includes and chained searches do real work.
    • Fresh state per run: reset or reload the data so each run starts from the same point and results can be compared.

    Never copy production data into a load environment to save time. Real PHI in a test system brings access, logging and retention duties that the test environment was not built to meet.

    How does paging affect FHIR performance results?

    Paging changes the numbers because a single search can become many requests, and the cost of later pages often differs from the first.

    The HL7 FHIR R4 search specification says a server shall not return more resources than the _count parameter asks for, even if it does not support paging, and may return fewer. The search Bundle carries the links a client follows for further pages, and Bundle.total remains optional.

    Scripts should follow the next links the way a real client does, not just call the first page. Measure the time to fetch a complete result set as well as each page, since a partner sync cares about the total.

    • Test with the page sizes clients will actually send, including the largest your API allows.
    • Check deep pages: offset-based paging can slow down sharply far into a large result set.
    • Decide whether the API returns a total, because counting matches can cost more than fetching a page.

    How should rate limits be tested?

    Rate limits should be tested as a feature with expected behavior, not treated as a failure that spoils the run.

    RFC 6585 defines HTTP status 429 Too Many Requests for a user that has sent too many requests in a given amount of time. The response may carry a Retry-After header saying how long to wait, and the RFC leaves it to the server to decide how it identifies the user and counts requests.

    Agree how your API counts requests (per client, per user, per token or per IP address) and test each rule on purpose. A client that exceeds its limit should get a clear 429 with a Retry-After value, while other clients keep working at normal speed.

    • Confirm one noisy client cannot slow down everyone else.
    • Check that the limit is enforced the same way on every instance behind the load balancer.
    • Make the load scripts honour Retry-After, so the test does not turn into a retry storm.
    • Log rejected requests with the client identifier, so support can explain a 429 to a partner.

    Load, stress, soak and spike tests compared

    Load, stress, soak and spike tests answer different questions, and a FHIR API usually needs all four before launch.

    Performance test types for a FHIR API
    Test typeQuestion it answersWhat to watch
    LoadDoes the API meet its targets at expected peak traffic?Response time percentiles per operation, error rate
    StressWhere does it break, and how does it fail?The point where errors rise, and whether it recovers on its own
    SoakDoes it stay healthy over many hours?Memory growth, connection pool use, slow queries building up
    SpikeCan it absorb a sudden burst, such as an app launch?Autoscaling delay, queueing, token service behavior

    What should the pass criteria say?

    The pass criteria should say, in numbers agreed before the test, what the API must achieve at each load level for the team to approve go-live.

    • Latency: a response time percentile for each operation type, set separately for reads, searches and writes.
    • Errors: the accepted error rate, with 429 responses counted separately from 5xx errors.
    • Correctness: results under load match results at rest, with no missing or duplicated resources across pages.
    • Capacity: CPU, memory and database connections stay below agreed limits with headroom for growth.
    • Recovery: after a stress run, the API returns to normal response times without a restart.

    Get product, engineering and operations to sign the criteria before the first run. Targets set after seeing the results tend to drift toward whatever the system happened to do.

    How do teams run the test step by step?

    • Step 1, agree scope: list the operations, clients and peak periods the test must cover.
    • Step 2, prepare the environment: match production sizing, configuration and network path as closely as budget allows.
    • Step 3, load the data: generate synthetic patients with realistic volumes and reset scripts.
    • Step 4, script the journeys: model each client, including sign-in, token refresh, paging and retries.
    • Step 5, run a baseline: a low-load run that proves the scripts and monitoring work.
    • Step 6, run load, stress, soak and spike tests, changing one thing between runs.
    • Step 7, report: compare each result with the pass criteria and record fixes and reruns.

    Reading the results

    Read results per operation, not as one average across the API. A fast patient read can hide a slow search that times out for every clinician.

    Line up response times with database metrics, cache hit rates and application logs from the same minutes. Most FHIR slowdowns trace back to a missing index, an expensive include or a search parameter that forces a full scan. Fix the cause, rerun the same scenario and compare, rather than adding hardware and hoping.

    Keep the scripts, data generator and reports in version control. The same suite becomes the regression check for every later release that touches search or storage.

    What are the common mistakes with software performance testing?

    The common mistakes with software performance testing for FHIR APIs come from testing an easier system than the one going live.

    • Small, even data: every patient has a short history, so searches look fast until real records arrive.
    • First page only: scripts never follow next links, so deep-paging costs stay hidden.
    • Tokens skipped: tests use a fixed token and never load the authorization server.
    • Rate limits switched off: the run passes, but production clients start receiving 429 responses on day one.
    • Shared environment: other teams' work skews the numbers and nobody can repeat the run.

    What does performance testing mean for your build plan?

    Performance testing adds an environment, a data generator, scripts and time for fixes to the plan. Treat it as a stage with its own exit criteria, not a task squeezed in the week before launch.

    • Reserve a production-like environment early, since sizing and approvals can take time.
    • Build the synthetic data generator alongside the data model, not after it.
    • Plan at least one round of fixes and reruns before the launch date.
    • Keep the suite runnable in CI or on demand for later releases.

    How does Agnotic run performance testing for FHIR APIs?

    Agnotic Technologies plans the load model with your product and partner teams, builds synthetic data and scripts that follow real FHIR client behavior, runs load, stress, soak and spike tests and helps your engineers fix what the tests find. You keep the suite for future releases.

    Know how your FHIR API behaves before partners find out

    A tested API makes the launch decision a matter of evidence.

    Sources

    Frequently Asked Questions

    Any team launching or scaling a FHIR API that patient apps, clinicians or partner systems will depend on. It matters most when partners will sync large volumes or when a launch can bring many users at once.

    Talk to an engineer about your project

    Tell us which clients will call your FHIR API and when you plan to launch. We will propose a load model, test data plan and pass criteria.