Blog

Matchbox 5: validation two to four times faster, HAPI FHIR 9 with the latest FHIR core libraries and new validation APIs

· Oliver Egger (@oliveregger)

  • Matchbox 5.0.0
  • release
  • performance
  • validation
  • docker

Matchbox 5.0.0 is the first major release since 4.0. It updates the whole platform under the HL7® FHIR® validator. The short version:

  • Validation is two to four times faster in our load tests: about 2.2× for ch-elm, and three to four times for small resources of other Swiss implementation guides.
  • New platform: Spring Boot 4, HAPI FHIR 9 and the latest FHIR core libraries (org.hl7.fhir.core 7), on Tomcat instead of Undertow.
  • Security: fixed vulnerabilities in Spring, Tomcat, Guava and the base image, and a Software Bill of Materials (SBOM) for the server, the Docker image and matchbox-engine.
  • New APIs: Matchbox offers the validation API of the HL7 validator, and, as a preview, the Interoperability Test Bed (ITB) can validate with Matchbox over REST.
  • New registry: the Docker image is now ghcr.io/ahdis/matchbox.

What changes for you

If you run the Docker image, coming from Matchbox 4.1:

  • Change the registry of the image. The images are published to the GitHub container registry only: ghcr.io/ahdis/matchbox instead of europe-west6-docker.pkg.dev/ahdis-ch/ahdis/matchbox (#659). Change it in your docker run commands, docker-compose files, Kubernetes manifests and the FROM line of your own images. The Google Artifact Registry keeps the images up to 4.1.21.
  • Remove the server.undertow.* settings. Matchbox runs on Tomcat, because Spring Boot 4 no longer supports Undertow. Matchbox doesn't limit the size of a request anymore: set the limit in your reverse proxy.
  • Migrate the database if you keep it. HAPI FHIR goes from 8.12.1 to 9.0.0, and its schema changes. With a database inside the container (the default) there is nothing to do. With a volume or PostgreSQL, run the migrate-database command of the HAPI FHIR CLI 9.0.0 before you start the new version.
  • Compare your validation results. org.hl7.fhir.core goes from 6.10.4 to 7.0.8, with new checks and changes in the terminology handling (see below). Validate your reference resources with both versions before you switch production.
bash
docker pull ghcr.io/ahdis/matchbox:v5.0.0

If you use matchbox-engine in your own Java application:

  • The API of MatchboxEngine uses the R6 model of org.hl7.fhir.core 7 (org.hl7.fhir.model.core) instead of org.hl7.fhir.r5.model. There are overloads for the HAPI R5 model, and R6Model converts between the two.
  • createSnapshot adds the snapshot to the StructureDefinition it is given instead of returning a new instance.
  • useTxCacheFolder(folder) and disableTxCache() replace initTxCache(folder), which is deprecated.
  • matchbox-engine 5.0.0 is on Maven Central, built with HAPI FHIR 9.0.0.

The upgrade guide has the steps in detail, including the schema migration and how to compare validation results.

Validation two to four times faster

In the ch-elm load test (8,000 validations of a lab report with ch-elm 1.15.6, 4 threads, two runs per version on the same machine), Matchbox 5.0.0 validates about 2.2× faster than 4.1.21, with the same OperationOutcome and no failed requests.

Matchbox 4.1.21 Matchbox 5.0.0
Validation, median / p95 67–68 / 78–80 ms 30–31 / 46–49 ms
Load test duration 2.5 min 1.3–1.4 min
Single thread (2,000 validations), median / p95 47 / 51 ms 28 / 30 ms
Server ready after 19–21 s 17–18 s
Live heap after the test 664 MiB 746–749 MiB
Container memory after the test 3.0–3.1 GiB 3.3–3.4 GiB

In this test, 5.0.0 keeps about 85 MiB more live heap than 4.1.21.

The invariants of ch-elm resolve ConceptMaps with resolve(), 14 times per validation. Matchbox converted the resource for every call, which took 45% of the CPU time. Each engine now keeps the last 100 resources it converted (matchbox.fhir.context.fetchCacheSize, 0 to keep none). The suppressed warning patterns are also compiled once, and the OID registry is loaded once instead of for every validation.

Several implementation guides

The gain isn't limited to ch-elm. A second test starts a server with 12 Swiss implementation guides, lets 4 parallel threads create their engines and then validates examples of each (400 validations, two runs per version):

Matchbox 4.1.21 Matchbox 5.0.0
Validation once the engines exist, median / p95 20–22 / 34–39 ms 6 / 13 ms
ch-core practitioner, 4 parallel clients, median 11–15 ms 2.5 ms
Creating the 12 engines, total 24–25 s 19–22 s
Slowest engine (ch-atc) 6.6–7.3 s 5.0–5.9 s
Server ready after 15 s 12.5 s
Live heap after the test 1.32–1.38 GB 1.33–1.34 GB

Here validation is three to four times faster, the engines are created faster, and the live heap is the same.

The platform: Spring Boot 4, HAPI FHIR 9 and the latest FHIR core libraries

  • Spring Boot 4.0.9 and Spring Framework 7.0.10, with Hibernate ORM 7.2, Jakarta EE 11 and Jackson 3.
  • HAPI FHIR 9.0.0 from Maven Central.
  • org.hl7.fhir.core 7.0.8, the latest FHIR core libraries: the validator, the FHIR mapping language and the worker context are based on the versionless R6 modules instead of org.hl7.fhir.r5.
  • Bundled packages: hl7.terminology 7.5.0 and hl7.fhir.uv.extensions 5.4.1.

The new core brings checks that can change your results, for example:

  • Observations that don't fit the properties of their LOINC code (units, time aspect, scale).
  • SNOMED CT codes that don't fit where they are used, e.g. an error for a medication code that isn't a medication.
  • A coding without a version for a code system with versionNeeded, and an empty JSON array of a primitive element.
  • A value set that lists codes which a complete code system doesn't have is reported as not valid (since 7.0.7). Matchbox doesn't apply this to urn:ietf:rfc:3986, where every URI is a code, as in the IHE format codes.

On the terminology side, an unknown code system is asked for once per run, $subsumes answers are cached, and the validator recovers when the terminology server lost its cache.

Security

  • Spring: 4.0.9 fixes spring-webmvc CVE-2026-47884.
  • Tomcat 11.0.27 fixes the authentication and security constraint bypasses CVE-2026-65182, CVE-2026-65905 and CVE-2026-68525.
  • Guava 33.7.2 fixes CVE-2026-102554. graphql-java, which shades an older Guava, is excluded: GraphQL isn't enabled in Matchbox. (#669)
  • Docker image: the base image is the latest Java 25 JRE, with the mitigation of CVE-2026-114938 ("Java4Shell"), the fix of CVE-2026-109518 in apt and the fix of CVE-2025-6020 in libpam.
  • OpenTelemetry 1.68.0 fixes CVE-2026-118259 (quadratic CPU consumption when parsing the W3C tracestate header).
  • SBOM: the server provides its Software Bill of Materials (CycloneDX) at /actuator/sbom/application. It is also attached to the GitHub release, the Docker images have an SBOM attestation, and matchbox-engine is published with its SBOM.

ITB services (preview)

The Interoperability Test Bed (ITB) of the European Commission can call Matchbox directly (ITB 1.30.0 or later, with handlerApiType="REST"). This is a preview functionality: we are doing the first demonstrations with it, and the services can still change.

Service Root What it does
FHIRValidator [server]/itb/fhir Validates a FHIR resource and returns a TAR report
FHIRPathProcessor [server]/itb/fhirPath Evaluates a FHIRPath expression on a resource
IGManager [server]/itb/igManager Confirms an installed package, or installs it

The services follow the contract of the ITB services of the HL7 validator (hapifhir/org.hl7.fhir.core#2615), so test suites written for it, such as the EU Health Data API tests, can call Matchbox (#589, #681). There is one deviation: an invalid request, such as a missing required input, is answered with HTTP 200 and a FAILURE report that says what is wrong, because ITB only keeps the status code of an answer that is not 2xx.

We showed this setup in the FHIR testing tutorial at the HL7 Europe Working Group Meeting in Málaga, described in the ahdis blog: FHIR testing tutorial. A separate article on the ITB integration will follow; until then, see Integrate with ITB.

The validation API of the HL7 validator

Matchbox also answers POST [server]/core/validate, with the ValidationRequest and ValidationResponse of org.hl7.fhir.core, as validator.fhir.org does. A client of the HL7 validator can use Matchbox with only the address changed (#702). The requests and answers are described in the HL7 validator API reference.

$validate, the Gazelle API, the ITB API and this API now share one validation service: they select the profile, get the engine, validate and report in the same way. Two things follow from this:

  • Implementation guides on demand: an implementation guide given with the ig parameter (id#version) that isn't installed is installed from the package registry before the validation, unless the server is read-only (httpReadOnly). If it cannot be installed, the request gets an error instead of a validation without it.
  • Statistics and metrics: the validations of the Gazelle API and the ITB API are saved in the validation statistics too, and the reported duration is the duration of the validation, without the time to create the engine.

Thanks

Matchbox builds on the FHIR core libraries (org.hl7.fhir.core) and on HAPI FHIR. A big thank you to everyone who contributes to these two projects, and to everyone who gives feedback on Matchbox, reports issues and sends pull requests.

All posts