Main Content

Support Multiple MATLAB Runtime Versions

MATLAB® Production Server™ instances can host deployable archives compiled using multiple versions of MATLAB Compiler SDK™. To do so, add multiple mcr-root properties to the configuration file for on-premise server instances. For a server environment deployed in the Cloud, the deployment sets the mcr-root property to support multiple MATLAB Runtime versions.

  1. If you do not have a MATLAB Runtime installation on your on-premise server, you must install it first. For more information on the MATLAB Runtime, see


    • Configure a server instance to use MATLAB Runtime roots on a local file system. Otherwise, a network partition might cause worker processes to fail.

    • All values for mcr-root must be for the same operating system and hardware combination.

  2. If the server instance is running, stop it.

  3. Open the configuration file for the instance in a text editor.

    The configuration file is at instanceRoot/config/main_config.

  4. Locate the entry for the mcr-root property in the configuration file.

    --mcr-root mCRuNsETtOKEN
  5. For each version of MATLAB Runtime that the instance supports, add an instance of the mcr-root property. Order the versions from the latest to the oldest.

    For example, to configure the instance to use the v98 and v97 versions of the MATLAB Runtime, specify the following.

    --mcr-root C:\Program Files\MATLAB\MATLAB Runtime\v98
    --mcr-root C:\Program Files\MATLAB\MATLAB Compiler Runtime\v97
  6. Restart the server instance.

How the Server Instance Selects the MATLAB Runtime to Use

After you configure the server instance to use multiple versions of MATLAB Runtime, to process a server request, the server scans the list of MATLAB Runtime versions in the configuration file in order from first to last, and chooses the first MATLAB Runtime installation capable of processing the request. A MATLAB Runtime installation can process a request if it is compatible with the version of MATLAB used to create the deployable archive containing the function being evaluated.


Since the server instance always chooses the first compatible version of MATLAB Runtime, configuring the server instance with multiple instances of the same MATLAB Runtime version has no effect on performance.

Changes to Worker Management

Configuring a server instance to use multiple MATLAB Runtime versions changes management of the workers that process requests.

When using a single MATLAB Runtime installation, the server instance starts the workers as needed until a number of workers specified by the num-workers property are running. Once running, workers can restart depending on the worker-restart-interval property or the worker-restart-memory-limit property. Workers are never fully stopped.

Once a server instance starts using multiple MATLAB Runtime versions, it dynamically manages the worker pool. The server instance starts new workers as needed until num-workers workers are running. The worker instances are spread out over the different MATLAB Runtime versions. Once num-workers workers are running, the server instance returns workers to the pool of available workers based on the worker-memory-trigger property and the queue-time-trigger property. Once a worker returns to the pool, the server can allocate it to process new requests using any of the configured MATLAB Runtime versions.

Related Topics