Main Content

Customize Startup Parameters

The MATLAB® Parallel Server™ scripts run using several default parameters. You can customize the scripts, as described in this section.

Define Script Defaults

The scripts for the server services require values for several parameters. These parameters set the process name, the user name, log file location, ports, etc. Some of these can be set using flags on the command lines, but the full set of user-configurable parameters are in the mjs_def file.


The startup script flags take precedence over the settings in the mjs_def file.

The default parameters used by the server service scripts are defined in the file:

  • matlabroot\toolbox\parallel\bin\mjs_def.bat (on Microsoft® Windows® operating systems)

  • matlabroot/toolbox/parallel/bin/ (on Linux® or Macintosh operating systems)

To set the default parameters, edit this file before installing or starting the mjs service.

The mjs_def file is self-documented, and includes explanations of all its parameters.


If you want to run more than one job manager on the same machine, they must all have unique names. Specify the names using flags with the startup commands.

Set the User

By default, the job manager and worker services run as the user who starts them. You can run the services as a different user with the following settings in the mjs_def file.




Set this parameter to run the mjs services as a user different from the user who starts the service. On a UNIX® operating system, set the value before starting the service; on a Windows operating system, set it before installing the service.


On a Windows operating system, set this parameter to specify the password for the user identified in the MJSUSER parameter; otherwise, the system prompts you for the password when the service is installed.

On UNIX operating systems, MJSUSER requires that the current machine has the sudo utility installed, and that the current user be allowed to use sudo to execute commands as the user identified by MJSUSER. For further information, refer to your system documentation on the sudo and sudoers utilities (for example, man sudo and man sudoers).

The MJSUSER is granted these permissions on Windows systems:

PrivilegePurposeLocal Security Settings Policy
SeServiceLogonRightRequired to log on using the service logon type.Log on as a service
SeAssignPrimaryTokenPrivilegeRequired to start a process under a different user account.Replace a process level token
SeIncreaseQuotaPrivilegeRequired to start a process under a different user account.Adjust memory quotas for a process

To modify or remove these privileges,

  1. Select the Windows menu Start > Settings > Control Panel.

  2. Double-click Administrative Tools, then Local Security Policy.

  3. In the tree, select Local Policies > User Rights Assignment.

The table above indicates which policies are affected by MJSUSER. Double-click any of the listed policies in the Local Security Settings GUI to alter its setting or remove a user from that policy.

Override Script Defaults

Specify an Alternative Defaults File

The default parameters used by the mjs service, job managers, and workers are defined in the file:

  • matlabroot\toolbox\parallel\bin\mjs_def.bat (on Windows operating systems)

  • matlabroot/toolbox/parallel/bin/ (on Linux or Macintosh operating systems)

Before installing and starting the mjs service, you can edit this file to set the default parameters with values you require.

Alternatively, you can make a copy of this file, modify the copy, and specify that this copy be used for the default parameters.

On Linux or Macintosh operating systems, enter the command

mjs start -mjsdef

On Windows operating systems, enter the command

mjs install -mjsdef my_mjs_def.bat
mjs start -mjsdef my_mjs_def.bat

If you specify a new mjs_def file instead of the default file for the service on one computer, the new file is not automatically used by the mjs service on other computers. If you want to use the same alternative file for all your mjs services, you must specify it for each mjs service you install or start.

For more information, see Define Script Defaults.


The startup script flags take precedence over the settings in the mjs_def file.

Start in a Clean State

When a job manager or worker starts up, it normally resumes its session from the past. This way, a job queue is not destroyed or lost if the job manager machine crashes or if the job manager is inadvertently shut down. To start up a job manager or worker from a clean state, with all history deleted, use the -clean flag on the start command:

startjobmanager -clean -name MyJobManager
startworker -clean -jobmanager MyJobManager

Increase Heap Memory

An mjs service can use up to 4000 workers across a collection of nodes. When you scale up the number of workers or tasks in your cluster, you must increase the heap memory available to the job manager. To do so, set the JOB_MANAGER_MAXIMUM_MEMORY parameter in the mjs_def file based on the following recommendations.

  • Use a minimum value of 1000m (1000 MiB).

  • Use 1000m for every 1000 workers.

  • Add 1000m for every 100,000 tasks expected to be queued at peak load.

For example, for a cluster with 4000 workers and a peak queue size of 200,000 tasks, set JOB_MANAGER_MAXIMUM_MEMORY to 6000m.