By Rohit Kumar, Alibaba Cloud Solutions Architect
In this document, we will attempt to set up a MATLAB Production Server on Alibaba Cloud using Elastic Compute Service (ECS) instances. We will be provisioning necessary instances, getting MATLAB Production Server License from MathWorks website and then activating the license server. We then connect the worker machine to access license from License Server as per the MathWorks specification to test run a small application.
MATLAB Production Server is one of the flagship products for MathWorks and is used by many organizations and research institutions for custom analytics into the web, database and enterprise applications running on dedicated servers. User can create algorithms in MATLAB, package them using MATLAB compiler and then deploy them into MATLAB Production Server (MPS) without recoding or creating custom infrastructure. MATLAB Production Server can manage multiple MATLAB Runtime version simultaneously and so algorithm developed in different versions of MATLAB can be incorporated in your application simultaneously.
While many of our competitors have a partnership with MATLAB for deploying an MPS environment in the cloud, Alibaba Cloud does not have a solution for installing MPS on the cloud. Moreover, as the software is attached to MAC address of the machine on which it is used and needs to have a MathWorks, it can be a mammoth task for end-user to use MPS on Alibaba Cloud.
The server runs on multiprocessor and multicore computers, providing low-latency processing of concurrent work requests. You can deploy the server on additional computing nodes to scale capacity and provide redundancy. For our case, both the license server and worker server will be deployed on Alibaba Cloud ®C Elastic Compute Service (ECS), which is great for these applications as the cloud instances can provide fast and dedicated CPU performance for MATLAB applications. Alibaba Cloud's networking configurations can also provide a good way to keep license server and worker machine access to each other while still secured in different security groups.
1. Provision a Windows 2012R2 ECS instance from Alibaba Cloud which would act as MPS License Server.
Follow the instructions in this article to create an Alibaba Cloud ECS instance.
Please take note of the Internet IP Address and private IP address of the MPS License server (in this case 47.254.184.123 and 192.168.0.100 respectively). We will be connecting to the server using Remote Desktop Connection with the Internet IP Address.
Create another Windows 2012R2 ECS instance for the MPS worker node which would be running the MATLAB application and accessing the license from the license server. Keep both the machine in the same VPC.
2. Configure the Security Groups
Make sure the Security Group that the Server instance belongs to accepts incoming port 3389(RDP), 27000(License Manager port for MPS) on both the machine and port 50987 on the license server for accepting incoming connections from worker node for license access.
1. Apply for trial license
MATLAB Production Server license can be obtained from MathWorks website on a trial basis by opening an account on MathWorks website from the below link. MPS license is issued for a machine and is supplied based on the Host ID (MAC address) of the machine.
Once you have registered an account on MathWorks website, you need to provide the mac address details of the intended license server machine. After that you MathWorks will send you your license activation email. The email would contain a license.lic file which would be required for the license server activation.
2. Activate the license on MathWorks website
1. Download the License Manager from MathWorks website.
2. Setup license Manager on the License Server node
Copy the downloaded file in step 3 to a folder MPS_LM in C Drive of the License Server. Also copy/download the license.lic file received in the email (Section 3, step 1) to this directory. We would need this when we set up license server access from the worker node.
1. Download MPS from the MathWorks website.
2. Install the MPS on the worker node. Double click on the downloaded MPS file downloaded in step 1. It will ask you to provide MathWorks account credentials or File Installation key. Select 'Login with a MathWorks Account' and click next to accept the agreement and enter your login credentials.
3. Once the login credentials are accepted, select install, click next and then select the available license from the screen. Click next and select the installation directory and click next. The default directory is C:Program FilesMATLABMATLAB Production ServerR2018a.
4. On the next screen, select only MPS Server as we have already installed a License Server on a different node and click next.
5. Download the license.lic file received in the email (Section 3, step 1) and provide the path of the directory on the next screen of installation. This will start the MPS installation.
6. Add the $MPS_INSTALLscript folder to your system PATH environment variable.
$MPS_INSTALL represents your MATLAB Production Server installation folder.
1. On the License Server, go to C:MPS_LM directory and open the licnese.lic file and add the following lines to it.
SERVER $Hostname $HostID 27000
DAEMON MLM "C:\MPS_LM\mlm.exe"
In the above code, $Hostname is the server's hostname, $HostID is the MAC address (without hyphen) that you used to activate the license.
2. On the License Server, go to C:MPS_LM directory and double click on lmtools. Keep 'Configuration using services' option selected.
3. Go to 'Config Services' tab and edit the following entries (if not already)
1. On the worker node, move to the folder where you want to create your server. In our case, it is a 'tmp' folder in our C drive.
C:\>cd C:\tmp
2. Start a server instance using the mps-new command
C:\> mps-new prod_server_1 -v
3. Verify the output.
4. To configure the server instance, run the mps-setup command and follow the directions to specify which MATLAB Runtime this instance would use. Once confirmed, you will see the message below that MPS server is successfully installed.
5. Move to the config directory of newly created server instance and open the main_config file. For us, it is located in C:tmpprod_server_1config.
6. Search for '®Clicense' option in the main_config file and replace it with the below line. IP_address_of_license_server can be private IP address if public IP address does not work.
--license 27000@IP_address_of_license_server
Search for '--cors-allowed-origins' option in the main_config file and replace it with the below line. It is the list of origins that are allowed to access MPS and can also be a list if all origins (*) is a security concern.
--cors-allowed-origins *
1. Run the mps-start command.
mps-start -C C:\tmp\prod_server_1
2. Verify the server instance has started using the mps-status command.
mps-status -C C:\tmp\prod_server_1
MATLAB Production Server applications are just MATLAB functions with a RESTful API. For the convenience of testing if client and server can talk to each and MPS is ready to run applications, I have attached a readymade application. This example uses a webpage with JavaScript to call MPS functions. To test the example, please follow the steps below.
MATLAB Production Server is a high-level analytics software and is used by various research institutes and engineering companies and used for various AI/ML applications. It is usually quite time consuming and tough to deploy MPS on Alibaba Cloud. A user still needs to open a MathWorks account and do necessary security group configurations (port opening) for license server and worker node communication for license access. Though License Server and MPS worker both can be on the same node, but it helps to have a license server separately when we need more than one worker nodes. Above steps can be easily replicated to deploy a single license server and multiple worker nodes accessing license information from it.
As many of our competitor offer IaaC scripts to deploy MPS on the cloud, I would cover that in a different document on how to create a ROS script, generic license server and worker node machine images, which does not require license information at the time of MPS deployment, and how to activate license information once the deployment is ready.
Create a Multi-CIDR Block VPN with IKEv1 in a Multi-Network CEN in Alibaba Cloud
Automatically Extract Metadata with Function Compute and Mediainfo and Store in Table Store
3 posts | 0 followers
FollowAlibaba Clouder - March 29, 2019
Alibaba Cloud Community - February 2, 2022
Alibaba Cloud Community - December 4, 2023
Alibaba Clouder - September 27, 2019
GhulamQadir - January 1, 2020
Alibaba Cloud Project Hub - November 19, 2021
3 posts | 0 followers
FollowElastic and secure virtual cloud servers to cater all your cloud hosting needs.
Learn MoreAlibaba Cloud Function Compute is a fully-managed event-driven compute service. It allows you to focus on writing and uploading code without the need to manage infrastructure such as servers.
Learn MoreHigh Performance Computing (HPC) and AI technology helps scientific research institutions to perform viral gene sequencing, conduct new drug research and development, and shorten the research and development cycle.
Learn MoreA HPCaaS cloud platform providing an all-in-one high-performance public computing service
Learn More
'"><SVg> May 14, 2020 at 1:43 pm
11111">