Download PDF
Download page How to Improve and Optimize Controller Database Performance.
How to Improve and Optimize Controller Database Performance
The following procedure only applies to Controllers that have been upgraded from version 4.2.8 or earlier, to a later version. In such cases, after you upgrade to later version, you may experience performance issues with the Controller database. However, for all new Controller installations using version 4.2.9 or later, the metric data tables are optimized.
To improve database performance when querying metrics, the primary key used by the metric data tables is read optimized. As a result, the primary key changes as follows:
From | To |
---|---|
ts_min, node/tier/app, metric_id | metric_id, node/tier/app, ts_min |
How to Run Database Optimization
You can use the Enterprise Console to run a database optimization job to optimize your database performance. To use this feature:
Upgrade your Enterprise Console to the latest version.
- Upgrade your Controller to the latest version.
After the upgrade has completed, for any database table that can be optimized, you can run the database optimization job from the Enterprise Console.
No downtime is required and the database optimization job runs automatically.
Select Start Database Optimization from the Controller page to start a process that runs in the background on your primary Controller host.
The process performs several pre-checks to determine if there is enough disk space, and if any other database optimization process is running. The amount of disk space required is determined by the size of the tables to optimize. Based on the amount of Controller data, the database optimization job may take several hours to several days to complete.Once all of the tables have been optimized successfully, the database optimization process completes and no longer displays on the page. To verify that all tables have been optimized, enter and run the following query:
cd <controller_home>/bin directory ./controller.sh login-db mysql>SELECT table_name FROM information_schema.key_column_usage WHERE table_name LIKE 'metricdata%' AND table_name != 'metricdata_min' AND table_name != 'metricdata_min_agg' AND column_name = 'ts_min' AND ordinal_position = 1;
CODEIf the query returns any results, then those tables have not been optimized.
If the query returns zero records, then all of the tables were optimized successfully.
The database optimization job is supported on Linux OS only.
How to Run Database Optimization on a High Availability (HA) Controller Pair
Before you run database optimization on a HA Controller pair, you must ensure that the Controller database replication is in a healthy state.
- If both of the Controllers are onboarded into Enterprise Console, review the Controller page and note the following fields:
If one of the Controllers is managed by HA toolkit (HATK):
Log in to the primary Controller host and enter:
cd <controller_home>/bin directory
CODELog in to the secondary Controller database and enter:
./controller.sh login-db
CODEEnter:
SHOW SLAVE STATUS\G;
CODEThis results in the following output:
Seconds_Behind_Master: $Number_Of_Seconds_Behind_Master
CODEIf a non-zero number displays the output for this test, wait until the number changes to zero.
After you ensure that replication is working as expected, you can run the database optimization job from the Enterprise Console. Select Start Database Optimization from the Controller page to start a process that runs in the background on your primary Controller host.
The process performs several pre-checks to determine if there is enough disk space, and if any other database optimization process is running. The amount of disk space required is determined by the size of the tables to optimize. Based on the amount of Controller data, the database optimization job may take several hours to several days to complete.Once all of the tables have been optimized successfully, the database optimization process completes and no longer displays on the page. To verify that all tables have been optimized, enter and run the following query:
cd <controller_home>/bin directory ./controller.sh login-db mysql>SELECT table_name FROM information_schema.key_column_usage WHERE table_name LIKE 'metricdata%' AND table_name != 'metricdata_min' AND table_name != 'metricdata_min_agg' AND column_name = 'ts_min' AND ordinal_position = 1;
CODEIf the query returns any results, then those tables have not been optimized.
If the query returns zero records, then all of the tables were optimized successfully.
How to Stop Database Optimization
After the database optimization job has completed successfully, you can stop the process. From the Enterprise Console, select Stop Database Optimization from the Controller page:
You may need to stop the database optimization process if it is using too many resources and you notice a performance impact on the Controller, or if you decide to reschedule the process to run at a later date.
Troubleshooting Database Optimization
The following table describes possible conditions that may cause errors to occur and actions to take to mitigate them:
Errors or Conditions | User Action |
---|---|
Job failed; Database replication is broken message displays. | Re-establish database replication incrementally, then finalize replication. |
Ran out of disk space while the database optimization job was running, and job stops processing. | Free up disk space and restart database optimization job. |