How can I configure and verify the number of concurrent workers in a microservice generated with compiler.package.microserviceDockerImage
5 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I’m using MATLAB R2024b with the following workflow:
I create a microservice archive:
result = compiler.build.productionServerArchive(stages, 'ArchiveName', archiveName);
Then I build the Docker image:
compiler.package.microserviceDockerImage(result, 'ImageName', imageName, 'AdditionalInstructions', additionalInstructions);
After running the container, I see in the logs something like:
[worker:1] Worker ready - protocol v2
Only one worker is ever mentioned, and other requests seem to be queued, waiting for that worker to become free. I want to allow multiple concurrent requests (workers) to be handled in parallel.
❓ My questions:
- How many workers are created by default in a microservice built with compiler.package.microserviceDockerImage?
- How can I increase the number of workers?
- Is there a recommended way to configure this, for example:
- via Dockerfile?
- modifying ENTRYPOINT?
- setting an environment variable?
- Can I check the active number of workers at runtime?
So far I’ve tried modifying the Dockerfile manually to append "--workers", "4" to the ENTRYPOINT, but it didn't work.
0 Commenti
Risposte (1)
Jacob Mathew
il 9 Giu 2025
Hey Aritz,
The reference to "Workers ready" is probably from the Parallel Computing Toolbox or MATLAB Parallel Server. Since you have started a single instance of MATLAB, there will be one worker running to handle the commands. If you want to increase the number of workers, you will probably have to setup the environment variable MAX_LINUX_WORKERS or MAX_WINDOWS_WORKERS that falls under the MATLAB Parallel Server and then run the Docker image. You can read more about these environment variables at the link below:
A thorough way to do this would be follow the guide below which goes into details of deploying a MATLAB Parallel Server and Job Scheduler using Kubernetes:
However, do note that the above discussion centers on a single MATLAB image and is not the same as running multiple MATLAB image instances using Docker.
0 Commenti
Vedere anche
Categorie
Scopri di più su MATLAB Parallel Server Licensing in the Cloud in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!