Skip to main content

Caching data in memory

Note: Caching data in memory is available only for servers running on Windows.

You can create a memory cache configuration file to optimize the performance of your system. When you implement this feature, the system optimizes queries and submissions in the following ways:

  • Queries resolve from memory.
  • Submissions update the data loaded in memory and write through to the database.

The memory cache configuration file is specific to the Data Server and is a list containing database data tables and allocated memory blocks of specified sizes. The specified memory blocks are allocated into shared memory when the Data Server starts.

Note: You must select the Use Memory Cache configuration parameter to cache data in memory. For more information, see Use Memory Cache.

By caching the specified data in shared memory, all services across your Longview product that perform queries and submissions can interact with the data quickly. This means you can perform faster queries; however, the following should be considered before you set up the memory cache configuration file:

  • Initial server startup time increases while the servers generate the shared memory block files.
  • Additional memory is required.
  • The maximum size of specified data tables is predetermined.

Due to these considerations, Longview recommends caching data in memory only after implementing the following performance strategies:

  • Determining the source of possible performance loss is based on server-side queries and not submissions or restatements.
  • Creating a strong virtual parent strategy. For more information, see the Longview Application Administrator Guide.
  • Partitioning. For more information, see the Longview Application Administrator Guide.

If you are unsure whether to implement this feature, contact Longview Support.

Understanding the memory cache configuration file

The memory cache configuration file contains, per line, a comma-delimited list of database data table name, memory block size, and number of blocks. The memory cache configuration file must reside in the config folder of the data server’s custom file path location.

For example, in C:\Longview\CustomFiles\Longview\config.

Once you have created and saved the memory cache configuration file, you do not need to modify or maintain the file unless you decide to add or remove tables or increase the number or size of memory blocks.

When the Data Server starts, the system creates one file for every memory block specified in the memory cache configuration file. These files are stored in the location specified by the Memory Cache Files Location configuration parameter.

If you do not specify a location for the Memory Cache Files Location configuration parameter, the files are stored in the Memory Cache folder in the Data Server working directory at the same level as the lvsrvr.cfg and the memory cache configuration file.

For more information, see Memory Cache Files Location.

The block files are created with the naming convention

LVIM_<LID>_<TableName>_<block#>.

For example, LVIM_LVCPM_KLX_ACN_P000_CELLS_1. These files are used as part of the shared memory caching process.

Caution: Do not modify the block files.

If you modify the memory cache configuration file, the system makes the following changes when the server starts:

If...

The system...

you change the block size of an already-specified block.

regenerates the block file with the appropriate block size.

you change the number of blocks for a specified table.

deletes the previously existing block files and then regenerates the appropriate number of block files.

you add a table.

adds the corresponding block file.

you remove a table.

removes the corresponding block file.

the Data Server shuts down due to unexpected external factors such as a power outage.

regenerates all block files using the data written to the database.

Memory cache configuration file syntax

TableName,BlockSize,Number

where:

  • TableName is the name of the database data table to put into the shared memory. You can include each database data table only once. For a list of database data tables, see “Data tables” in the Longview Installation Guide.
  • BlockSize is the size of the memory block for the specified data table, in bytes, and can be a number between 1024000 and 2147483648.
  • Number is the number of blocks for each data table. This allows you to use more than two gigabytes of memory for a single data table. For example, to specify three blocks for one data table, type 3. You cannot include more than 32767 blocks per data table.

Example

KLX_ULN_P000_CELLS,1024000000,1

KLX_ULS_P000_CELLS,1024000000,1

KLX_ULN_P001_CELLS,1024000000,1

KLX_ULN_P002_CELLS,2000000000,2

Creating the memory cache configuration file

You can create the memory cache configuration file using your preferred text editor. The memory cache configuration file must reside in the config folder of the data server’s custom file path location. For example, in C:\Longview\CustomFiles\Longview\config.

Caution: You must allocate sufficient space for the memory cache before you create the memory cache configuration file. Failure to allocate space sufficiently may cause the system to run out of space during the submission of new data. If the system runs out of space during a submission, the data may be committed to the database but will not be visible to users until you increase the memory cache size and stop and restart the server.

To create the memory cache configuration file:

  1. In the config folder of the custom files location directory (for example, <CustomFilesLocation>\config), create a file named MemoryCacheSizes.cfg.

  2. On each line, specify TableName,BlockSize,Number, separating parameters with commas. where:
    • TableName is the name of the database data table to put into the shared memory. You can include each database data table only once. For a list of database data tables, see “Data tables” in the Longview Installation Guide.
    • BlockSize is the size of the memory block for the specified data table, in bytes, and can be a number between 1024000 and 2147483648.
    • Number is the number of blocks for each data table. This allows you to use more than two gigabytes of memory for a single data table. For example, to specify three blocks for one data table, type 3. You cannot include more than 32767 blocks per data table.
  3. Save and close the file.
  4. Stop, and then restart, your Longview server.

Was this article helpful?

We're sorry to hear that.