Configure Persistent Storage Using Dashboard
In the MATLAB® Production Server™ on-premises dashboard, persistence provides a mechanism to cache data between calls to MATLAB code running on a server instance. A persistence service runs separately from the server instance and can be started and stopped manually. A connection name links a server instance to a persistence service. A persistence service uses a persistence provider to store data. Currently, Redis™ is the only supported persistence provider. The connection name is used in MATLAB application code to create a data cache in the linked persistence service.
Create Persistence Service
You can either create a local persistence service or create a connection to a remote persistence service.
Create Local Service
Select Persistence from the left navigation tree.
Click the down arrow next to the + Create button.
Select Local Service.
Enter details in the Create Local Persistence Service dialog box.
Provider — The persistence provider defaults to Redis, which is the only supported provider.
Note
If your MATLAB Production Server instance runs on a Windows® machine, then you must install Windows Subsystem for Linux (WSL) and run Redis in WSL.
For details on installing WSL, see the Microsoft documentation.
If the MATLAB Production Server software is installed on a network drive, you must mount that drive in WSL.
Port — Enter a port number that you want the service to use. Only non-SSL ports are supported.
Persistence Configuration File (optional) — Enter the persistence provider configuration file only if you want to override any of the default settings of the persistence provider. For Redis, the configuration file is called
redis.conf
and on Windows can be found inC:\Program Files\MATLAB\MATLAB Production Server\R2024b\bin\win64
.
Click Create.
Create Connection to Remote Service
To use this option, you must already have a previously created remote persistence service.
Select Persistence from the left navigation tree.
Click the down arrow next to the + Create button.
Select Remote Service.
Enter details in the Create Remote Persistence Service dialog box.
Provider — The persistence provider defaults to Redis, which is the only supported provider.
Host — Type the remote host name. For example:
persistence.mathworks.com
.Port — Enter a port number that you want the service to use. Only non-SSL ports are supported.
Access Key — Access key string to connect to an Azure® Redis Cache instance obtained from the Azure portal.
Click Create.
Tip
To retrieve an access key to connect to an Azure Redis Cache instance:
Log in to your Azure portal and select your Azure Redis Cache instance.
Select Overview and under Keys click Show access keys.
In the resulting blade, copy the access key string listed under Primary.
Manage Persistence Service
From the Persistence page, you can start, stop, restart and delete persistence services.
Select Persistence from the left navigation tree.
Locate the service in the table. For example, this figure shows a table with a sample persistence service.
Perform one of these actions to manage the service.
Action Procedure Start a persistence service. In the Control column, click the green arrow start button.
Stop a persistence service. In the Control column, click the orange square stop button.
Restart a persistence service. In the Control column, click the dark gray circle restart button.
Delete a persistence service. In the Manage column, click the trash can button.
Add Persistence Service to Server Instance
You can add a persistence service to a server instance from either the persistence overview or server instance page.
Add Persistence Service from Persistence Overview Page
Select Persistence from the left navigation tree.
Click the service in the list you want to add to a server instance
Click the green + button.
In the Add Connection dialog box, from the drop-down menu, select the server instance to which you want to add the persistence service.
Specify a connection name. A valid connection name starts with a letter, followed by letters, digits, or underscores. MATLAB is case sensitive, so
A
anda
are not the same variable. The maximum length is 63 characters.
Add Persistence Service from Server Instance Page
Select the server instance from the navigation pane.
Select the Persistence tab.
Click the + Add button.
Select a persistence service to add to the server instance.
Specify a connection name. A valid connection name starts with a letter, followed by letters, digits, or underscores. MATLAB is case sensitive, so
A
anda
are not the same variable. The maximum length is 63 characters.
Note
A persistence service is connected to a server instance using a connection name. This connection name is used in MATLAB code to create data caches for a particular server instance. It can either be hard coded within MATLAB code or passed in as a parameter by a client application.
Connect Persistence Service to Server Instance
Start the persistence service. See Manage Persistence Service.
Select the server instance from the navigation pane.
Select the Persistence tab.
Locate the connection name that you want to use to connect the persistence service to the server instance.
Click the paperclip button in the Actions column to attach the connection to the server instance and enable the connection.
Disconnect Persistence Service from Server Instance
Select the running server instance from the navigation pane.
Select the Persistence tab.
Locate the connection name that you want to use to disconnect the persistence service from the server instance.
Click the scissors button in the Actions column to detach the connection from the server instance and disable the connection.
Edit Persistence Service Configuration
If the service is running, stop the service. Otherwise, you cannot edit its configuration. See Manage Persistence Service.
Select Persistence from the left navigation tree.
Locate the service in the list whose configuration you want to edit.
Click the pencil button in the Manage column to edit the configuration.