Smile CDR v2023.05.PRE
On this page:


MegaScale is a new and experimental feature. It has a number of limitations and will not be suitable for many use cases. See Limitations below.

MegaScale is a mechanism for storing virtually unlimited amounts of data in a single FHIR server. It uses multiple database instances to create discrete pools of data which are logically separate, but are managed under a single Smile CDR FHIR Storage (RDBMS) module.

In its simplest terms, a MegaScale-enabled server can be thought of as a multitenant repository where each tenant is hosted in a separate database instance.

Using this strategy can be helpful in cases such as:

  • The total amount of data to be stored exceeds the natural limit of a single instance of the database technology being used
  • Data needs to be kept physically separate due to privacy or legal rules.



In MegaScale mode, a single FHIR Endpoint module is paired with a single FHIR Storage (RDBMS) module. Incoming FHIR requests include a tenant identifier which specifies the target database. This architecture is shown in the diagram below.

MegaScale Architecture



This section lists the known limitations on this feature.

Partition Styles

FHIR Interactions

The following FHIR interactions have been tested:

  • Create/Update
  • Search
  • $validate
  • $expunge – Expunge everything is verified to work, but will only expunge everything for a single MegaScale database at a time

No other features, operations, or interactions have been tested or are expected to work with MegaScale.

Cross-Partition References

If Cross-Partition References are enabled, it will be possible to create references that cross partition and database boundaries. In a MegaScale-enabled repository, these references rely on a soft-reference that is stored in the source partition that redirects the server to the target partition.

These references may be used for _include processing, but do not support chained searches or _revinclude processing.



To enable MegaScale mode, the following settings must be set.

On the FHIR Storage (RDBMS) module:

On the FHIR Endpoint module:

7.5.4Connection Provider Interceptor


MegaScale connection details are supplied using a Java Smile CDR Interceptor using the STORAGE_MEGASCALE_PROVIDE_DB_INFO pointcut.

See Example: MegaScale Connection Provider to see how this pointcut can be used. This example is also available in the Interceptor Starter Project.