Redpoint Interaction v7.x Documentation
Breadcrumbs

Admin: Realtime cache setup

Overview

To use RPI Realtime decisions, a caching mechanism must be available and configured to ensure that the RPI Realtime application can make use of it.

Setup of each cache technology is beyond the scope of this documentation. 

In values.yaml, set realtimeapi.cacheProvider.enabled to true, and set the provider to one of the supported options (azureredis, googlebigtable, inMemorySql, mongodb, redis). Then update only the fields relevant to your chosen provider and leave the others unchanged.

The following sections describe how to configure RPI Realtime to use each of these.

Azure Redis cache configuration

This section describes how to configure the RPI Realtime website to use the Windows Azure Redis caching mechanism.

Configure the following in realtimeapi.cacheProvider.azureredis:

YAML
# Provide the Azure Redis server host URL.
connectionstring: redis://<my-redis-name>.redis.cache.windows.net:6380?ssl=true&password=<my-access-key>

Google Bigtable cache configuration

This section describes how to configure the RPI Realtime website to use the Google Bigtable caching mechanism.

Configure the following in realtimeapi.cacheProvider.googlebigtable:

YAML
projectId: <my-bigtable-project-id>
instanceId: <my-bigtable-instance-id>

In-Memory SQL cache configuration 

When using the RPI SQL Server native cache provider, scripts to set up SQL Server in-memory cache tables are available in the Configuration Service’s Downloads page, by downloading the SQL Script Library, within which can be found the following script:

UsefulSQLScripts\SQLServer\Realtime\In Memory Cache Setup.sql

Notes are provided therein, which should be read before executing the scripts. 

This section describes how to configure the RPI Realtime website to use the In-Memory SQL caching mechanism.

Configure the following in realtimeapi.cacheProvider.inMemorySql:

YAML
# Hostname or IP address of the cache database server
server_host: <my-cache-database-server-host>
# Name of the in-memory SQL database
database_name: <my-cache-database-name>
# Credentials for database access
username: <my-cache-database-username>
password: <my-cache-database-password>

MongoDB cache configuration

This section describes how to configure the RPI Realtime website to use the MongoDB caching mechanism.

Configure the following in realtimeapi.cacheProvider.mongodb:

YAML
# Provide the MongoDB connection string.
connectionString: mongodb://<my_username>:<my_password>@myserver.mongodb.net:27017/Pulse?authSource=admin&ssl=true
databaseName: <my-realtime-cache-db>
collectionName: <my-realtime-cache-collection>

Redis cache configuration

This section describes how to configure the RPI Realtime website to use the Redis caching mechanism.

Configure the following in realtimeapi.cacheProvider.redis:

YAML
# Set to true to deploy an internal Redis container.
# Set to false if using an external (BYO) Redis instance.
internal: false
replicas: 1
# Redis connection string used when 'internal' is false.
# Format: <hostname>:<port>,ssl=<true|false>,abortConnect=<true|false>,user=<username>,password=<password>
connectionstring: <my-redis-hostname>:6379,ssl=True,abortConnect=false,user=<my-username>,password=<my-username>
resources:
  enabled: true
  requests:
    cpu: 500m
    memory: 1Gi
  limits:
#   cpu: 2
    memory: 1Gi

The resources.limits.cpu setting is commented out for clients that don't want to enforce CPU limits (K8s best practice). However, if you do need to enforce CPU limits, simply uncomment. 

Deprecated cache provider configuration

The cache providers in this section have been deprecated, and their configuration is not available in the Helm chart.

Cassandra cache configuration 

Support for this connector has been deprecated and will be removed in a future release. Refer to the Connector deprecation plan for details.

In the RPI Realtime appsettings.json file’s CacheSettings section, add the following: 

JSON
{
  "Name": "Default",
  "Assembly": "Redpoint.Resonance.CassandraCachehe",
  "Class": "Redpoint.CassandraCache.CassandraCacheHandler",
  "Settings": [
    {
      "Key": "Keyspace",
      "Value": "rpi",
      "Values": null
    },
    {
      "Key": "ContactPoints",
      "Value": "server1,server2",
      "Values": null
    },
    {
      "Key": "Username",
      "Value": "CassandraUser",
      "Values": null
    },
    {
      "Key": "Password",
      "Value": "Password",
      "Values": null
    }
  ]
}

CosmosDB cache configuration

Support for this connector has been deprecated and will be removed in a future release. Refer to the Connector deprecation plan for details.

An example CosmosDB cache configuration section from appsettings.json is provided below:

JSON
{
    "Name": "AzureCosmosDB",
    "Assembly": "RedPoint.Resonance.DocumentDBCache",
    "Class": "RedPoint.Resonance.DocumentDbCache.DocumentDBCacheHandler",
    "Settings": [
        {
            "Key": "DatabaseId",
            "Value": "<DATABASE ID HERE>"
        },
        {
            "Key": "ConnectionString",
            "Value": "<CONNECTIONSTRING HERE>"
        },
        {
            "Key": "ContainerName",
            "Value": "<NAME>"
        }
    ]
}

The ContainerName setting will be used as the table name to be created in CosmosDB. Its id column will be used as the PartitionKey (indicated by a prefix '/' in the Azure portal).