Improve Cloud Director Database Performance by reducing the size of the audit_trail table.
search cancel

Improve Cloud Director Database Performance by reducing the size of the audit_trail table.

book

Article ID: 320412

calendar_today

Updated On:

Products

VMware Cloud Director

Issue/Introduction

Symptoms:
  • The Cloud Director UI is slow to load.
  • Tasks will finish relatively quickly, but loading information is slow.
  • When accessing Cloud Director UI notice pages are loading increasingly longer.

 


Cause

Slow UI performance can usually be attributed to a large growth of the audit_trail table in the database.

The audit_trail table will capture activity ongoing within the environment and will capture additional information should Cloud Director be integrated with other Products such as Container Service Extension (CSE) or Aria Operations.

Resolution

To properly manage the audit_event, you will need to review your environment and do one or both of the below:

  1. Reduce the current size of the audit_event and clear some data.
  2. Set Cloud Director to automatically remove activities after a period of time.



Reduce the current size of the audit_event and clear some data.

NOTE: The following will require services to be stopped on all Cells, and Data to be removed from the Database.

1. Stop the services on all cells:
/opt/vmware/vcloud-director/bin/cell-management-tool cell -i $(service vmware-vcd pid cell) -s

2. Take a backup of VCD DB:
/opt/vmware/appliance/bin/create-backup.sh

3. Connect to the DB:
sudo -i -u postgres psql vcloud

4. Run the below commands to clear the data in the audit_trail table:
truncate table audit_trail;

5. Start the VCD services:
systemctl start vmware-vcd

6. Repeat step 5 above once the first Cell has come up.

Set Cloud Director to automatically remove activities after a period of time.
You can use the Cell-Management-Tool, present on all Cloud Director Cells to configure the application and set the number of days you wish to retain events for.

The following command will update the Audit Trail configuration to keep 10 Days only.

/opt/vmware/vcloud-director/bin/cell-management-tool manage-config -n com.vmware.vcloud.audittrail.history.days -v 10


NOTE: There are instances where the ActivityLogCleanerJob is not running and will require a cleaning of the Scheduled Activity Jobs tables to run correctly and allow Cloud Director to clean the audit_trail table.

1. Stop the services on all cells:
/opt/vmware/vcloud-director/bin/cell-management-tool cell -i $(service vmware-vcd pid cell) -s

2. Take a backup of VCD DB:
/opt/vmware/appliance/bin/create-backup.sh

3. Connect to the DB:
sudo -i -u postgres psql vcloud

4. Run the below commands to clear the data in the audit_trail table:
delete from activity;
delete from scheduled_activity_jobs;
delete from activity_pc_queue;
delete from activity_pc_event_queue;
delete from fifo_activity_queue;
delete from task_activity_queue;
delete from vc_activity_queue;


5. Start the VCD services:
systemctl start vmware-vcd

6. Repeat step 5 above once the first Cell has come up.

 


Additional Information

Impact/Risks:

Depending on the ending configuration, backups of Cloud Director Database may need to be restored to review past activities performed by the System or End Users.