Predix Cache

© 2020 General Electric Company Contents

Chapter 1: Overview 1 Overview of Predix Cloud Cache 2 Predix Cloud Cache Architecture 2

Chapter 2: Configuring Predix Cloud Cache Service 3 Configure Predix Cloud Cache Service 4 Create Predix Cloud Cache Service Instance 4 Bind the Application to the Predix Cloud Cache Service Instance 6 Update Predix Cloud Cache Service Instance 7 Unbind the Predix Cloud Cache Service Instance from the Cloud Foundry Application 7 Delete Predix Cloud Cache Service Instance 8

Chapter 3: Using Predix Cloud Cache Service 9 Connect to Predix Cloud Cache Clusters using Redis and Golang 10 Connect to Predix Cloud Cache Clusters using Redis and Java 12

Chapter 4: Backup and Restore 14 About Backing Up and Restoring Cached Data 15

Chapter 5: Migrating to New Subscription Plan 16 About New Subscription Plans 17 Migrate to a New Subscription Plan 17

Chapter 6: Security 18 About Predix Cloud Cache Security 19

Chapter 7: Reference 20 Performance Benchmarking 21

ii Predix Cloud Cache Chapter 8: Release Notes 22 Second Quarter of 2020 23

iii

Copyright GE Digital © 2020 General Electric Company. GE, the GE Monogram, and Predix are either registered trademarks or trademarks of General Electric Company. All other trademarks are the property of their respective owners. This document may contain Confidential/Proprietary information of General Electric Company and/or its suppliers or vendors. Distribution or reproduction is prohibited without permission. THIS DOCUMENT AND ITS CONTENTS ARE PROVIDED "AS IS," WITH NO REPRESENTATION OR WARRANTIES OF ANY KIND, WHETHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO WARRANTIES OF DESIGN, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. ALL OTHER LIABILITY ARISING FROM RELIANCE UPON ANY INFORMATION CONTAINED HEREIN IS EXPRESSLY DISCLAIMED. Access to and use of the software described in this document is conditioned on acceptance of the End User License Agreement and compliance with its terms.

iv © 2020 General Electric Company

Chapter 1 Overview Topics:

• Overview of Predix Cloud Cache • Predix Cloud Cache Architecture

© 2020 General Electric Company 1

Overview of Predix Cloud Cache Predix Cloud Cache is a fully managed in-memory data store and cache service. It improves the performance of web applications by retrieving information from managed in-memory caches, instead of relying entirely on slower disk-based databases. Predix Cloud Cache is backed by Amazon ElastiCache and helps you overcome the challenges, such as slow processing queries, scaling costs, simplified data access, and so on, faced while building distributed applications that require low latency and scalability. Predix Cloud Cache V2.0 supports the Redis (version 4.0 and higher) in-memory caching engine.

Predix Cloud Cache Architecture The following architecture diagram provides a high-level information on how a user application interacts with an Amazon ElastiCache (Redis) instance using the Predix Cloud Cache service.

The Predix Cloud Cache Broker facilitates the interaction between the user application and the Amazon ElastiCache service, and manages the lifecycle of the service instance. When the Predix Cloud Cache instance is created for the user, the user application interacts with the Amazon ElastiCache (Redis) instance through the host URL for the Predix Cloud Cache instance.

2 © 2020 General Electric Company

Chapter 2 Configuring Predix Cloud Cache Service Topics:

• Configure Predix Cloud Cache Service • Create Predix Cloud Cache Service Instance • Bind the Cloud Foundry Application to the Predix Cloud Cache Service Instance • Update Predix Cloud Cache Service Instance • Unbind the Predix Cloud Cache Service Instance from the Cloud Foundry Application • Delete Predix Cloud Cache Service Instance

© 2020 General Electric Company 3

Configure Predix Cloud Cache Service

About This Task You must create a service instance, and then bind the Cloud Foundry (CF) application to that instance to set up the Predix Cloud Cache service.

Procedure 1. Create the Predix Cloud Cache service instance. 2. Bind the CF application to the Predix Cloud Cache service instance.

Create Predix Cloud Cache Service Instance

About This Task You can create the Predix Cloud Cache service instance with the default parameters, or with customized Redis engine version and cluster configuration parameters.

Procedure 1. In the Cloud Foundry Command Line Interface, run the following command to access the list of Predix Cloud Cache plans that are available for subscription:

cf m -s predix-cloud-cache-r2.0

Note: For more information on the Predix Cloud Cache plans, refer to the documentation on the new subscription plans. 2. Depending on whether you want to use the default or customized parameters, perform one of the following tasks: • Create the instance with the default parameters. • Create the instance with customized parameters.

Create Service Instance with Default Parameters

Procedure 1. Access the Cloud Foundry (CF) Command Line Interface. 2. Run the following command to create the Predix Cloud Cache service instance:

cf create-service predix-cloud-cache-r2.0

Note: • The angle brackets (< >) in the command indicate placeholder text. You must replace the placeholder text with an appropriate value before running the command. • By default, the Predix Cloud Cache service supports Redis version 4.0.10.

4 © 2020 General Electric Company

Example: The following command will create a service instance named MyDb based on the Predix Cloud Cache plan named Dedicated-2node-6gb:

cf create-service predix-cloud-cache-r2.0 Dedicated-2node-6gb MyDb

Next Steps Bind the CF application to the Predix Cloud Cache service instance.

Create Service Instance with Customized Parameters

About This Task You can create the Predix Cloud Cache service instance with customized Redis engine version and cluster configuration parameters. You can add the updated parameter values in a .json file, and then use this file to pass the customized values during the create service call. The content of the .json file must be in the following format:

{ "CreateReplicationGroup": { "EngineVersion": "" }, "ParameterNameValues": [{ "ParameterName": "", "ParameterValue": "" }] }

Important: • In this task, angle brackets (< >) indicate placeholder text. If such placeholder text is part of a command, you must replace it with an appropriate value before running the command. • For more information on the parameters that are supported by your Redis engine, refer to the Amazon ElastiCache documentation.

Procedure 1. Access the Cloud Foundry (CF) Command Line Interface. 2. Run one of the following commands to create the Predix Cloud Cache service instance:

• cf create-service predix-cloud-cache-r2.0 -c .json

• cf create-service predix-cloud-cache-r2.0 -c .json>

Example: The following command will create a service instance named MyDb based on the Predix Cloud Cache plan named Dedicated-2node-6gb, and the value of the parameter named activedefrag will be set to yes:

cf create-service predix-cloud-cache-r2.0 Dedicated-2node-6gb MyDb - c ‘{ "CreateReplicationGroup": { "EngineVersion": "5.0.0" }, "ParameterNameValues": [{ "ParameterName": "activedefrag","ParameterValue": "yes"}]}'

© 2020 General Electric Company 5

Note: • The Predix Cloud Cache service supports Redis version 4.0.10 and higher. • You can specify a maximum of 10 customized parameters in a create request.

Next Steps Bind the CF application to the Predix Cloud Cache service instance.

Bind the Cloud Foundry Application to the Predix Cloud Cache Service Instance

Procedure 1. Access the Cloud Foundry (CF) Command Line Interface. 2. Run the following command to bind the CF application to the Predix Cloud Cache service instance:

cf bind-service

Important: The angle brackets (< >) in the command indicate placeholder text. You must replace it with an appropriate value before running the command. Example: The following command will bind the CF application named MyApp to the service instance named MyDb:

cf bind-service MyApp MyDb 3. Run the following command to access the list of all environment variables of the CF application:

cf env 4. In the list of environment variables, verify the parameter values defined for the service instance are correctly appearing for the VCAP_SERVICES variable. Example:

"VCAP_SERVICES": { "predix-cloud-cache-r2.0": [ { "credentials": { "custom_parameters": { "ParameterNameValues": [ { "ParameterName": "active-defrag-cycle-max", "ParameterValue": "50" } ] }, "engineversion": "4.0.10", "host": "sample.cache.amazonaws.com", "password": "samplepassword", "port": 6379 },

6 © 2020 General Electric Company

Update Predix Cloud Cache Service Instance

About This Task You can update the Predix Cloud Cache service instance by updating the parameter values of the instance. However, you cannot modify the values of the following parameters and attributes of the service instance: • Version of the Redis engine • Parameters that need a reboot of the cluster after modification • Parameters that cannot be modified in Amazon ElastiCache Redis. For more information on the supported parameters, refer to the Amazon ElastiCache documentation. You can add the updated parameter values in a .json file, and then use this file to pass the modified parameter values during the update service call. The content of the .json file must be in the following format:

{ "ParameterNameValues": [{ "ParameterName": "", "ParameterValue": "" }] }

Important: In this task, angle brackets (< >) indicate placeholder text. If such placeholder text is part of a command, you must replace it with an appropriate value before running the command.

Procedure 1. Access the Cloud Foundry Command Line Interface. 2. Run one of the following commands to create the Predix Cloud Cache service instance:

• cf update-service -c ’.json’

• cf update-service - c ’.json>’

Example: The following command will update the value of the parameter named activedefrag of the service instance named MyDb to yes:

cf update-service MyDb -c '{ "ParameterNameValues": [{"ParameterName": "activedefrag", "ParameterValue": "yes" }]}'

Note: You can update a maximum of 10 parameters in an update request.

Unbind the Predix Cloud Cache Service Instance from the Cloud Foundry Application

About This Task You can unbind the Predix Cloud Cache service instance to dissociate it from the Cloud Foundry (CF) application.

© 2020 General Electric Company 7

Procedure 1. Access the CF Command Line Interface. 2. Run the following command to unbind the Predix Cloud Cache service instance from the CF application:

cf unbind-service

Important: The angle brackets (< >) in the command indicate placeholder text. You must replace it with an appropriate value before running the command. Example: The following command will unbind the service instance named MyDb from the CF application named MyApp:

cf unbind-service MyApp MyDb

Delete Predix Cloud Cache Service Instance

Procedure 1. Access the Cloud Foundry Command Line Interface. 2. Run the following command to delete the Predix Cloud Cache service instance:

cf delete-service

Important: The angle brackets (< >) in the command indicate placeholder text. You must replace it with an appropriate value before running the command. Example: The following command will delete the service instance named MyDb:

cf delete-service MyDb

8 © 2020 General Electric Company

Chapter 3 Using Predix Cloud Cache Service Topics:

• Connect to Predix Cloud Cache Clusters using Redis and Golang • Connect to Predix Cloud Cache Clusters using Redis and Java

© 2020 General Electric Company 9

Connect to Predix Cloud Cache Clusters using Redis and Golang

Before You Begin • Download the Redis client from the Golang Library for Redis that you want to use for connecting the Predix Cloud Cache clusters to the applications. • Ensure that the Redis client supports Transport Level Security (TLS) and is set to nil.

About This Task The Predix Cloud Cache clusters are enabled with at-rest and in-transit encryptions. To access data from Predix Cloud Cache enabled with these encryptions, you can use a Redis client that is supported with TLS. Using the Redis client with TLS, you can secure the connections between the Predix Cloud Cache clusters and the user applications.

Code Example for Connecting to Predix Cloud Cache Clusters using Redis and Golang The following code example connects the Predix Cloud Cache clusters to the user applications using Redis and Golang.

package main

import ( "crypto/tls" "fmt" "log" "net/http" "os"

"github.com/go-redis/redis" )

func main() {

var port string port = os.Getenv("PORT") if port == "" { port = "8080" } client := newClient()

err := ping(client) if err != nil { fmt.Println(err) } err = set(client) if err != nil { fmt.Println(err) }

err = get(client) if err != nil { fmt.Println(err) }

10 © 2020 General Electric Company

fmt.Println("Starting Test HTTP Server...... ") err = http.ListenAndServe(":"+port, nil) if err != nil { log.Fatal(err) }

}

//return redis client

func newClient() *redis.Client { client := redis.NewClient(&redis.Options{ Addr: "host:port", Password: "password", // no password set - TLSConfig: &tls.Config{}, //for at transit encryption })

return client }

// ping tests connectivity for redis (PONG should be returned) func ping(client *redis.Client) error { fmt.Println("executing Ping Pong....") pong, err := client.Ping().Result() if err != nil { return err } fmt.Println(pong, err) // Output: PONG fmt.Println("PING PONG operation is done") return nil }

// set executes the redis Set command func set(client *redis.Client) error { err := client.Set("key", "value", 0).Err() if err != nil { return err } return nil }

func get(client *redis.Client) error { val, err := client.Get("key").Result() if err != nil { return (err) } fmt.Println("key", val)

val2, err := client.Get("key2").Result() if err == redis.Nil { fmt.Println("key2 does not exist") } else if err != nil { panic(err) } else { fmt.Println("key2", val2) } // Output: key value // key2 does not exist

© 2020 General Electric Company 11

return nil }

func helloHandler(w http.ResponseWriter, r *http.Request) { fmt.Fprintf(w, "Hello, %s!", r.URL.Path[1:]) }

Connect to Predix Cloud Cache Clusters using Redis and Java

Before You Begin • Ensure that Java is installed and configured in your system. • Ensure that a Java Redis client (for example, Jedis) is installed for connecting the Predix Cloud Cache clusters to the applications. • In the project directory, modify the pom.xml file as follows to include the Java Redis client (for example, Jedis) as a Mavcen dependency.

redis.clients jedis 3.0.1

About This Task The Predix Cloud Cache clusters are enabled with at-rest and in-transit encryptions. To access data from Predix Cloud Cache enabled with these encryptions, you can use a Java Redis client that is supported with TLS. Using Jedis, you can secure the connections between the Predix Cloud Cache clusters and the user applications.

Code Example for Connecting to Predix Cloud Cache Clusters using Redis and Java The following code example connects the Predix Cloud Cache clusters to the user applications using Redis and Java.

...

import redis.clients.jedis.Jedis;

public class CloudCacheSample {

public static String HOST_URL = ; public static String PASSWORD = ; public static int PORT = 6379;

...

public void redisSample() {

12 © 2020 General Electric Company

/* prefix 'rediss://' instructs jedis to open a SSL/ TLS connection */

URI jedisHostURI = URI.create("rediss://"+HOST_URL +":"+PORT); System.out.println("URI: "+jedisHostURI);

/* Creating new jedis client for connecting with redis instance */ Jedis jedisClient = new Jedis(jedisHostURI); jedisClient.auth(PASSWORD); System.out.println("Connection Made Successfully");

/* Pinging Instance to verify its healthy */ System.out.println("Server is running: " + jedisClient.ping());

/* Reading and writing to redis instance*/ jedisClient.lpush("SampleKey", "Sample Data1"); jedisClient.lpush("SampleKey", "Sample Data2");

List list = jedisClient.lrange("SampleKey", 0, 1);

for(int i=0; i

/* Closing and exiting gracefully */ jedisClient.disconnect(); jedisClient.close();

}

...

}

© 2020 General Electric Company 13

Chapter 4 Backup and Restore Topics:

• About Backing Up and Restoring Cached Data

14 © 2020 General Electric Company

About Backing Up and Restoring Cached Data The Predix Cloud Cache clusters use Amazon ElastiCache to create a backup of cached data. The clusters are enabled to create automated backups that are retained for a maximum of seven days. If you want to restore your data for a cluster, you must contact GE Digital Customer Support. For more information on how to back up data using Amazon ElastiCache, refer to the Amazon ElastiCache documentation.

© 2020 General Electric Company 15

Chapter 5 Migrating to New Subscription Plan Topics:

• About New Subscription Plans • Migrate to a New Subscription Plan

16 © 2020 General Electric Company

About New Subscription Plans GE Digital has introduced a new set of Predix Cloud Cache plans for subscription. The old Predix Cloud Cache plans will be deprecated by September 30, 2020. Therefore, as per the latest security guidelines, you must migrate to a new plan by September 30, 2020. In Predix Cloud Cache V2.0, all new service instances must be created using the new plans. For more information on the Predix Cloud Cache plans available for subscription, visit the Predix website. Important: To use the predix-cloud-cache service in the Cloud Foundry (CF) marketplace, you can subscribe to the old Predix Cloud Cache plans (namely 2-3GB, 2-6GB, and 2-28GB) through CF Command Line Interface till September 30, 2020. However, the old Predix Cloud Cache plans will be available for subscription using the predix.io console till May 15, 2020.

Migrate to a New Subscription Plan

About This Task Predix Cloud Cache V2.0 enables at-rest and in-transit encryptions, and Redis authentication for all the service instances.

Procedure 1. Verify your Redis client library supports Redis version 4.0.10 and higher. 2. Verify your Redis client supports Secure Sockets Layer (SSL)/Transport Layer Security (TLS). 3. Update the code to enable the SSL/TLS handshake and Redis authentication.

© 2020 General Electric Company 17

Chapter 6 Security Topics:

• About Predix Cloud Cache Security

18 © 2020 General Electric Company

About Predix Cloud Cache Security The Predix Cloud Cache service supports basic authentication using a unique user name and password for each service instance. After binding the service to the Clound Foundry (CF) application, you can obtain the user name and password from the VCAP_SERVICES environment variable. Additionally, at the Infrastructure (IaaS) level, all the Predix Cloud Cache instances are provisioned within private subnets and are not accessible directly over the . You can only access it through applications on the CF platform.

© 2020 General Electric Company 19

Chapter 7 Reference Topics:

• Performance Benchmarking

20 © 2020 General Electric Company

Performance Benchmarking The Predix Cloud Cache V2.0 service uses the Redis benchmarking tool to evaluate the performance of the Redis instances.

Example: Performance Benchmarking for Subscription Plans The following tables list the results of the performance benchmarking that is performed on a Redis instance for each subscription plan.

Table 1: Scenario 1: Number of Parallel Connections: 50

Plan Number of Size of Request SET Rate (per sec) LPUSH Rate (per GET Rate (per sec) Requests sec)

Dedicated-2nod 100000 3 bytes 93371 86957 92764 e-6gb 1000000 3 bytes 94065 87108 93906

10000000 3 bytes 93939 85977 93603

Dedicated-2nod 100000 3 bytes 113507 53191 116959 e-12gb 1000000 3 bytes 117633 94251 115088

10000000 3 bytes 114879 93694 113845

Dedicated-2nod 100000 3 bytes 87336 121951 87566 e-26gb 1000000 3 bytes 86670 115607 87199

10000000 3 bytes 87072 110988 87517

Table 2: Scenario 2: Number of Parallel Connections: 1020

Plan Number of Size of Request SET Rate (per sec) LPUSH Rate (per GET Rate (per sec) Requests sec)

Dedicated-2nod 100000 3 bytes 93458 98039 99010 e-6gb 1000000 3 bytes 103199 102145 104384

10000000 3 bytes 102638 101348 102365

Dedicated-2nod 100000 3 bytes 100000 100000 95238 e-12gb 1000000 3 bytes 100200 95420 104932

10000000 3 bytes 101854 104145 106815

Dedicated-2nod 100000 3 bytes 96154 91743 99010 e-26gb 1000000 3 bytes 102987 101937 104384

10000000 3 bytes 104123 103520 102365

© 2020 General Electric Company 21

Chapter 8 Release Notes Topics:

• Second Quarter of 2020

22 © 2020 General Electric Company

Second Quarter of 2020

V2.0 This topic provides a list of product changes released for this service in this version.

Table 3: Enhancements and New Features

The following enhancements and new features have been added.

Description Tracking ID

The following enhancements have been made to the Predix Cloud Cache service in this version: F52192 • Predix Cloud Cache now supports only Redis V4.0 and higher for new service instances with default version being Redis 4.0. • Predix Cloud Cache now supports user-defined configuration for the Predix Cloud Cache broker. This enhancement provides you full control over the broker configuration. In addition to this, you can upgrade the existing instances to support user-defined configuration. • GE Digital has introduced a new set of Predix Cloud Cache plans for subscription. For more information on these plans, visit the Predix website. • Predix Cloud Cache now supports at-rest and in-transit encryptions for all new instances. Additionally, the new subscription plans are based upon latest generation Amazon EC2 M5 instances for improved security and performance.

Table 4: Obsolete Features

The following features are no longer available.

Description Tracking ID

The existing Predix Cloud Cache subscription plans (namely, 2-3GB, 2-6GB, 2-28GB) will no longer NA be available after September 30, 2020. You must migrate to a new subscription plan before September 30, 2020. For more information on the subscription plans, visit the Predix website.

Important: To use the predix-cloud-cache service in the Cloud Foundry (CF) marketplace, you can subscribe to the old Predix Cloud Cache plans (namely 2-3GB, 2-6GB, and 2-28GB) through CF Command Line Interface till September 30, 2020. However, the old Predix Cloud Cache plans will be available for subscription using the predix.io console till May 15, 2020.

© 2020 General Electric Company 23