Main Content

Execute MATLAB Functions on MATLAB Production Server (BYOL)

Client applications for MATLAB® Production Server™ bring your own license (BYOL) are different from those for on-premises server instances in several ways. To execute MATLAB functions deployed on MATLAB Production Server (BYOL), you must use the MATLAB execution endpoint URL specified in the cloud console. Depending on the implementation of your client program, you might have to update your code to use the Azure® application gateway self-signed SSL certificate and cookie-based session affinity.

Similar to client applications for on-premises server installations, you must use the MATLAB Production Server client libraries for client applications that you write using Java®, .NET, C, and Python®.

Use MATLAB Execution Endpoint URL

After your MATLAB Production Server (BYOL) deployment to Azure is complete, log in to the dashboard to retrieve the MATLAB execution endpoint. The Overview tab in the dashboard specifies the MATLAB Execution Endpoint. For information on accessing the dashboard, see Connect to Dashboard.

This endpoint is an HTTPS URL that client programs use to make requests to the server and execute MATLAB functions deployed to the server. For example, if the MATLAB execution endpoint for your server is https://mpst4ezclcdtlcay.eastus.cloudapp.azure.com, to use the MATLAB Production Server RESTful API to execute a MATLAB function mymagic located in a deployed application myapp, specify the URL https://mpst4ezclcdtlcay.eastus.cloudapp.azure.com/myapp/mymagic.

Download Client Libraries

If you want to write client programs in Java, .NET, C, and Python for invoking MATLAB functions deployed on the server, you must use the MATLAB Production Server client libraries. Download the client libraries from MATLAB Production Server Client Libraries.

Work with Self-Signed Certificate

The Azure application gateway in the deployment requires an SSL certificate. The application gateway provides the MATLAB execution endpoint, which is an HTTPS URL that client programs use to send requests to the server. IT is recommended that the application gateway uses an SSL certificate signed by a certificate authority. However, if your application gateway uses a self-signed certificate, your client programs might require some modifications.

Client programs might require disabling host name verification to avoid encountering an exception caused by a failure in host name verification. The verification can fail due to a mismatch between the host names in the HTTPS URL for MATLAB function execution and the common name (CN) of the self-signed certificate. For example, the host name for the MATLAB execution endpoint can have the value <uniqueID>.<location>.cloudapp.azure.com, but the CN of your self-signed certificate can have the value azure.com.

Depending on the implementation of your client program, you might also have to retrieve the self-signed certificate that the application gateway uses and add the certificate to your local truststore. For more information on configuring the client environment, see Handle Exceptions for a Java client and Handle Exceptions for a .NET client.

Manage HTTP Cookie

The Azure application gateway provides cookie-based session affinity, where it uses cookies to keep a user session on the same server. On receiving a request from a client program, the application gateway sets the Set-Cookie HTTP response header with information about the server virtual machine (VM) that processes the request.

Asynchronous Request Execution

A client program that uses asynchronous requests to execute a MATLAB function deployed to the server must set the Cookie HTTP request header with the value of the Set-Cookie header for all subsequent requests. This ensures that same server VM that processes the first request processes all subsequent requests for that session.

Synchronous Request Execution

A client program that uses synchronous requests to execute a MATLAB function deployed to the server must not set the Cookie HTTP request header with the value of the Set-Cookie header, and must clear the value of the Cookie header if it has been previously set. This ensures that the synchronous requests are load balanced and the same server VM does not process them.

The default property in a Java client that uses MWHttpClient sets HTTP cookies. For information about disabling cookies, see Configure Client-Server Connection. The Java client API that uses protobuf and the .NET client API do not set HTTP cookies by default.

Related Topics