Main Content

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

  1. Select Persistence from the left navigation tree.

  2. Click the down arrow next to the + Create button.

  3. Select Local Service.

  4. 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 in C:\Program Files\MATLAB\MATLAB Production Server\R2024b\bin\win64.

  5. Click Create.

Create Connection to Remote Service

To use this option, you must already have a previously created remote persistence service.

  1. Select Persistence from the left navigation tree.

  2. Click the down arrow next to the + Create button.

  3. Select Remote Service.

  4. 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.

  5. 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.

  1. Select Persistence from the left navigation tree.

  2. Locate the service in the table. For example, this figure shows a table with a sample persistence service.

    Persistence service table

  3. Perform one of these actions to manage the service.

    ActionProcedure
    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

  1. Select Persistence from the left navigation tree.

  2. Click the service in the list you want to add to a server instance

  3. Click the green + button.

  4. In the Add Connection dialog box, from the drop-down menu, select the server instance to which you want to add the persistence service.

  5. Specify a connection name. A valid connection name starts with a letter, followed by letters, digits, or underscores. MATLAB is case sensitive, so A and a are not the same variable. The maximum length is 63 characters.

Add Persistence Service from Server Instance Page

  1. Select the server instance from the navigation pane.

  2. Select the Persistence tab.

  3. Click the + Add button.

  4. Select a persistence service to add to the server instance.

  5. Specify a connection name. A valid connection name starts with a letter, followed by letters, digits, or underscores. MATLAB is case sensitive, so A and a 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

  1. Start the persistence service. See Manage Persistence Service.

  2. Select the server instance from the navigation pane.

  3. Select the Persistence tab.

  4. Locate the connection name that you want to use to connect the persistence service to the server instance.

  5. 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

  1. Select the running server instance from the navigation pane.

  2. Select the Persistence tab.

  3. Locate the connection name that you want to use to disconnect the persistence service from the server instance.

  4. Click the scissors button in the Actions column to detach the connection from the server instance and disable the connection.

Edit Persistence Service Configuration

  1. If the service is running, stop the service. Otherwise, you cannot edit its configuration. See Manage Persistence Service.

  2. Select Persistence from the left navigation tree.

  3. Locate the service in the list whose configuration you want to edit.

  4. Click the pencil button in the Manage column to edit the configuration.

Related Topics