- Starting the Java Virtual Machine (JVM) and running Java code during startup uses a lot of memory. This could account for more than 300MB.
- Number of products loaded for the worker. For any MATLAB process, the more products installed on top of base MATLAB, the more memory the process will consume as it starts up. By default, MATLAB Runtime includes all products and toolboxes.
- During worker startup, the MATLAB process needs to load many shared libraries and cached content, including any libraries required by the prewarming CTF. This feature comes with some upfront memory overhead.
- Reduce prewarming. At startup, the MATLAB Web App Server prewarms several workers for each runtime configured on the server. This helps to reduce startup time for apps, but these prewarmed workers consume additional memory on top of running sessions. To customize the number of prewarmed workers for your server, see Why is MATLAB Web App Server's memory consumption high even when no apps are running?
- Run workers with -nojvm. If the JVM is not required for your apps, you can configure workers to run without the JVM in R2024a or later by editing the WorkerRuntimeOptions tag in webapps.config to match the following: <WorkerRuntimeOptions>-nojvm -webui<WorkerRuntimeOptions/>
- Use containerized workers. On Linux, if you are using the product version of MATLAB Web App Server with containerization, you can use the webapps-containers command to limit the maximum amount of memory (RAM) a worker can use: sudo ./webapps-containers.sh config set memory "1g"