Quick start guide

Understand the financial benefits of CAST AI database optimization

This guide will walk you through the initial steps to set up and start using CAST AI DB Optimizer (DBO) for your database. Following these instructions, you can implement DBO and optimize your database performance quickly.

(Optional) Phase 1: Estimation

Follow the steps below to connect your database cloud provider and generate a cost savings and performance benefits estimation report.

Step 1: Connect your AWS RDS account

  1. Log in to the CAST AI console.
  2. Navigate to the Database optimization section.
  3. Click on Run estimation to begin connecting your AWS RDS account.
  1. Copy the provided script and run it in your AWS RDS cloud shell or terminal.

Step 2: Review instances and potential savings

Once connected, you'll be presented with the Instances dashboard, which will highlight the metrics from the Estimation phase. Analyze the provided insights to see the potential cost savings and performance benefits that CAST AI's DB Optimizer can deliver to your database instances.

This dashboard provides an overview of connected database instances and their optimization potential within the CAST AI platform. To delve deeper into the cost savings report, see Performance estimation & cost savings

Phase 2: Cache deployment

The next phase of leveraging CAST AI's DB Optimizer is moving beyond the reporting and into Phase 2, where you can deploy the cache and connect your applications.

Step 1: Deploy cache

Once your database instance is connected, you will be able to deploy the necessary dbo-cache component. The aforementioned component encompasses two containers:

  • Proxy: Intercepts database queries and routes them appropriately.
  • Query Processor: Manages the caching logic and data storage.

To begin the cache deployment, follow these steps:

  1. Select an instance from the list.
  1. Click on Deploy Cache to initiate the process of deploying the cache to your chosen instance. The cache is instance-wide. Therefore, it will work for all logical databases hosted on an instance.

  1. Copy the provided script and run it in your cloud shell or terminal to deploy the cache.

Step 2: Update your application's connection string

To start using DB Optimizer, you must update your application's database connection string to route to the proxy. Here's a general format:

Replace the placeholders with your specific details:

  • [dbo_proxy_host]: The hostname or IP of the DB Optimizer Proxy (provided in the CAST AI console)
  • [dbo_port]: The port for your database type (e.g., 5432 for PostgreSQL)
  • [cache_id]: The unique identifier for your cache (found in the CAST AI console):

Example for PostgreSQL:

postgresql://myuser:[email protected]:5432/mydb?application_name=cache-123456

Step 3: Verify Connection

To ensure DB Optimizer is working correctly:

  1. Run a few queries through your application
  2. Check the DB Optimizer dashboard in the CAST AI console
  3. You should see query statistics and cache performance metrics

Test the connection manually

The CLI examples below are provided as alternative ways to manually test the connection to the database through DB Optimizer:

psql -h psedge.global \
-p 5432 \
-U [dbuser] \
-d 'dbname=[dbname] application_name=[cache_id]'

The example above uses separate command-line arguments:

  • -h psedge.global: Specifies the host (DB Optimizer proxy)
  • -p 5432: Specifies the port
  • -U [dbuser]: Specifies the database user
  • -d 'dbname=[dbname] application_name=[cache_id]': Specifies the database name and cache ID.
psql "host=psedge.global \
sslmode=require \
port=5432 \
user='dbuser' \
dbname='dbname' \
application_name='cache_id'"

Example 2 uses a connection string format:

  • It includes additional parameters like sslmode=require for secure connection
  • All connection details are provided in a single-quoted string.