Support Multiple MATLAB Versions

MATLAB® Production Server™ instances can host deployable archives compiled using multiple versions of MATLAB Compiler SDK™. You configure a server instance to do this by adding multiple mcr-root properties to the configuration file for the instance:

  1. Install the required versions of the MATLAB Runtime.

      Note:  

      • A server instance should only be configured to use MATLAB Runtime roots on a local file system. Otherwise, a network partition may cause worker processes to fail.

      • All values for mcr-root must be for the same OS/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.

    --mcr-root mCRuNsETtOKEN
  5. For each version of the MATLAB Runtime the instance supports, add an instance of the mcr_root property.

    For example, to configure the instance to use the v81 and v82 versions of the MATLAB Runtime.

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

How the Server Instance Selects the Runtime to Use

Once the server instance is configured to use multiple versions of MATLAB Runtime, it scans the list of provided MATLAB Runtime installations in order from first to last and chooses the first MATLAB Runtime installation capable of processing the request. An 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.

    Note:   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 also changes how the server instance manages the workers used to process requests.

When using a single MATLAB Runtime installation, the server instance starts workers as needed until num-workers workers are running. Once running, workers maybe restarted in response to 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 worker is returned to the pool, it can be allocated to process new requests using any of the configured MATLAB Runtime versions.

Was this topic helpful?