MATLAB Engine API for Python: Persistent Session vs. Per-Call Startup for Low-Traffic Workloads
0 reputation · 07 Jun 2024, 14:09 UTC
Integration Boundary
The MATLAB Engine API for Python connects a Python client process with a MATLAB runtime session. For workloads that invoke MATLAB functions infrequently, the session lifecycle becomes a design decision at this boundary.
Goal and Constraints
Determine whether to maintain a single persistent MATLAB Engine session across sparse calls or to start and terminate a session for each call. MATLAB desktop licensing is user- and core-based, not traffic-based, so cost reduction does not come from session count. However, an idle Engine session retains a MATLAB process, holding memory and CPU resources. Conversely, repeated cold starts add latency (typically several seconds) and may increase license checkout frequency.
Open Questions
- What is the measured cold-start latency for
matlab.engine.start_matlabin the target MATLAB release and Python version? - How much resident memory does an idle Engine session consume on the deployment platform?
- Does the licensing model in use impose any per-session checkout limits that would affect high-frequency teardown?