Main Content

Execute MATLAB Functions on MATLAB Production Server

Client applications for MATLAB® Production Server™ are different from those for on-premises server instances in several ways. To execute MATLAB functions deployed on MATLAB Production Server, you must use the MATLAB execution endpoint URL specified in the dashboard. Depending on the implementation of your client program, you might have to update your code to use the sticky session or session affinity feature of the elastic load balancer.

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 deployment to AWS® 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 Manage MATLAB Production Server Using the 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://payg-mps-1n8k9DNJ8NJAH-1476423457.us-east-1.elb.amazonaws.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://payg-mps-1n8k9DNJ8NJAH-1476423457.us-east-1.elb.amazonaws.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 SSL Certificate

If your deployment uses a self-signed SSL certificate, you might have to manually override the default security behavior of the client application or add a new HTTPS endpoint to the application gateway.

You can update the client application to disable hostname verification when sending HTTPS requests to the server to avoid encountering an exception caused by a failure in host name verification. Depending on the implementation of your client program, you might also have to retrieve the self-signed certificate that the load balancer 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 elastic load balancer uses sticky sessions, 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 the HTTP cookie. 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 the HTTP cookie by default.

Related Topics