Control Worker Restarts

Restart Workers Based on Up Time

As worker processes evaluate MATLAB® functions, the MATLAB workspace accumulates saved state and other data. This accumulated data can occasionally cause a worker process to fail. One way to avoid random worker failures is to configure the server instances to restart worker processes when they have been running for set period.

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

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

    The configuration file is at instanceRoot/config/main_config.

  3. Locate the entry for the worker-restart-interval property.

    --worker-restart-interval 12:00:00
  4. Change the value to the desired restart interval.

    For example, restart workers at intervals of 1 hour, 29 minutes, 5 seconds.

    --worker-restart-interval 1:29:05
  5. Restart the server instance.

Restart Workers Based on Amount of Memory in Use

As worker processes evaluate MATLAB functions, the MATLAB workspace accumulates saved state and other data. This accumulated data can occasionally cause a worker process to fail. One way to avoid random worker failures is to configure the server instances to restart worker processes when they begin consuming a predefined amount of memory.

This is done by adjusting three configuration properties:

  • worker-memory-check-interval — Interval at which workers are polled for memory usage

  • worker-restart-memory-limit — Size threshold at which to consider restarting a worker

  • worker-restart-memory-limit-interval — Interval for which a worker can exceed its memory limit before restart

To adjust memory-based restart thresholds:

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

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

    The configuration file is at instanceRoot/config/main_config.

  3. Locate the entry for the worker-memory-check-interval property.

    --worker-memory-check-interval 0:00:30
  4. Change the value to the desired restart interval.

    For example, restart workers at intervals of 1 hour, 29 minutes, 5 seconds.

    --worker-memory-check-interval 1:29:05
  5. Add an entry for the worker-restart-memory-limit property.

    For example, consider restarting workers when they consume 1 GB of memory.

    --worker-restart-memory-limit 1GB
  6. Add an entry for the worker-restart-memory-limit-interval property.

    For example, restart workers when they exceed the memory limit for 1 hour.

    worker-restart-memory-limit-interval 1:00:00
  7. Restart the server instance.

Was this topic helpful?