Main Content

Isolate Deployable Archives in MATLAB Production Server

The component-isolation property in the main_config file of your MATLAB Production Server installation allows you to give any number of deployable archives their own exclusive pools of workers.

You select the deployable archives with an ECMAScript regular expression that matches the stem of the corresponding filename (for a file named myctf.ctf, the stem is myctf). For these isolated deployable archives, no other archive, whether isolated or non-isolated, will ever use this pool of workers. The server restarts workers in these isolated pools during a hot-deploy update of an existing deployable archive.

This property can be used to enable certain functionality.

  • Prevent a Deployable Archive from Consuming All Available Workers

    • If you want to separate longer-running archives to prevent them from consuming all available workers, you can use the component-isolation property to assign them their own pools of workers.

    • Example:

      Assuming deployable archives named long_running_1, long_running_2, short_running_1, short_running_2

      --component-isolation component-match=^long_running_;max-workers=3
      --component-isolation component-match=^short_running_;max-workers=1
      --component-isolation max-isolated-components=4
  • Separate Low-Priority and High-Priority Deployable Archives

    • If you want to prioritize the execution of certain components, you can use the component-isolation property to assign them their own pools of workers with a higher max-workers value than your lower-priority archives.

      Example:

      Assuming components named high_priority_1, high_priority_2, med_priority_1, med_priority_2, low_priority_3, low_priority_3

      --component-isolation component-match=^high_priority_;max-workers=3
      --component-isolation component-match=^med_priority_;max-workers=2
      --component-isolation component-match=^low_priority_;max-workers=1
      --component-isolation max-isolated-components=6

You can also use the component-isolation feature to avoid certain issues.

Examples:

  • Third-party software, such a MEX file, that is not same-process safe (e.g. python code loaded from 2 or more components in same process)

  • Third-party software that is not hot-deploy safe. In other words, software that does not destruct or reinitialize correctly when a deployable archive is hot-deployed after at least one prior usage by the worker. One example of this that can happen if the software within the component CTF file contains static file or class scope data within native code and does not properly utilize the native code for these conditions. This could occur through improper use (or non-use) of the following software, among others reasons:

    • Windows: LoadLibrary, FreeLibrary, DllMain

    • Linux : dlopen, dlcose, __attribute__((constructor))

Related Topics