Tim Choo, MathWorks
Learn how to get MATLAB® Production Server™ up and running in Azure with the help of a reference architecture. This reference architecture provides templates that use preconfigured AMIs to create the necessary MATLAB Production Server and license server virtual machines, helping you get running in less time. Incorporate MATLAB analytics into enterprise, web, and mobile applications with MATLAB Production Server. The elasticity of the Azure infrastructure combined with MATLAB Production Server enables your application to support many users simultaneously.
In this video I will show you how to run MATLAB® Production Server™ on Microsoft® Azure using the MATLAB Production Server reference architecture.
This is one of several reference architectures to help you get up and running with MATLAB on the cloud.
This reference architecture contains all the components necessary to run MATLAB Production Server on Azure:
The ARM (or Azure Resource Manager) template deploys:
We’ll get started by navigating to the Github repository for the MATLAB Production Server reference architecture. This page has the detailed instructions that are used for this video. Before getting started, make sure you have the following:
Once you have these, we can get started. Click the “Deploy to Azure” button to begin the process. Note that you have the choice to deploy either to Windows or Linux VMs.
Sign in to your Azure account if prompted.
You will be taken to a page in the Azure Portal where you can customize your deployment parameters:
Azure will begin deploying your resources. This will take about 30 minutes, so be patient.
Once the deployment has successfully completed, obtain the cloud console IP address from the servermachine-public-ip resource and enter that IP address into your browser. You may receive a warning message from your browser about visiting an unsecure site. This is due to the use of a self-signed certificate. You can change the self-signed certificate to a CA-signed certificate to eliminate this error. Details on how to do so are found in the GitHub repository.
Log in using the username and password credentials you specified earlier.
The cloud console shows you the current status of your Production Server deployment. We specified two VM instances earlier; each one of those instances is running four MATLAB workers, giving us a total of eight workers. A typical Production Server license contains 24 workers, so you can scale up to six VM instances.
The URL endpoint to call the functions from your client application is displayed prominently on the cloud console.
The first thing we need to do is get the Host ID or MAC address of the license server. We will need this to generate our license. At the cloud console, go to the Administration tab and choose ”Manage Licenses.” Provide the License Server Host ID to your sales rep if you are obtaining a trial license. Otherwise, provide the HostID to your license administrator, who has access to the MathWorks License Center to generate a license file.
Once you receive the license file (usually with a .lic extension), select the file from the File Open dialog and then upload the file.
The license log file should show that two instances of MATLAB Production Server are checked out, each with four worker licenses like we specified.
You are now ready to upload a Production Server application. We will go to the Applications tab and click on “Upload Application.” Production Server applications are packaged using MATLAB Compiler SDK in a .ctf file. Let’s upload a BondTools .ctf from the \for_redistribution folder of the project.
Once the application has been uploaded, you can call its functions from your front-end client. In this example we have a web-based front-end client app that is calling the Bond tools function we just uploaded to get the price of the bond. The web front-end client app captures the input data in the fields, packages it into JSON payload, and makes a REST call to the Production Server endpoint. The endpoint is found on the Home page of the cloud console. Append your ctf name and function name to form the URL to call.
You can manage Production Server configuration from the cloud console by going to Administration -> Manage Server configurations and modifying the configuration flags.
If you need to support additional users, you can scale up the number of virtual machines by either manually increasing the scale set size or enabling autoscaling.
If you no longer need to run MATLAB Production Server in Azure, delete the entire resource group, which will remove your all the components in your deployment.
Be sure to check out the Github repository for more detailed instructions.
To learn more about using MathWorks on the cloud, go to mathworks.com/cloud.