Pre-load validation resources at FHIR server startup

74 views
Skip to first unread message

Brad Solomon

unread,
Aug 21, 2023, 11:13:10 AM8/21/23
to HAPI FHIR
How can we pre-load validation resources at FHIR server startup time rather than dynamically at runtime?

We are noticing that this loading into memory takes a long time (19 seconds) when it is performed by DefaultProfileValidationSupportNpmStrategy. The issue with this is that the loading occurs the first time our code raises a ResourceNotFoundException on the Read endpoint for ResearchStudy. This eventually generates the expected 404 response, but is not an acceptable page response time for users.

2023-08-21 09:57:05.095  INFO 19974 --- [nio-8080-exec-9] faultProfileValidationSupportNpmStrategy : Loading R5 Core+Extension packages into memory
2023-08-21 09:57:24.388  INFO 19974 --- [nio-8080-exec-9] faultProfileValidationSupportNpmStrategy : Loaded 34377 Core+Extension resources in 00:00:19.293

We see that this emanates from hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/support/DefaultProfileValidationSupportNpmStrategy.java.

So, how can we pre-load the resources at server startup?

Brad Solomon

unread,
Aug 21, 2023, 11:25:21 AM8/21/23
to HAPI FHIR
We were able to accomplish this simply by using:

    import ca.uhn.fhir.context.support.DefaultProfileValidationSupport;
    ...
    new DefaultProfileValidationSupport(FhirContext.forR5Cached());

within our FHIR RestfulServer.initialize() method override.

Curious to know if this is the condoned way to accomplish this.

Reply all
Reply to author
Forward
0 new messages