The Instance Sessions page shows real-time session data for a database instance. Use it to identify performance issues, end problematic sessions, and export session data.
Prerequisites
Ensure the following:
-
A database instance connected to DAS with its Accessed State set to Normal Access
-
For ApsaraDB for MongoDB standalone instances, required permissions granted to the database account. Set up a MongoDB standalone instance
Open the Instance Sessions page
-
Log on to the DAS console.
-
In the left-side navigation pane, choose Intelligent O&M Center > Instance Monitoring.
-
Find the target instance and click the instance ID.
-
In the left-side navigation pane, click Instance Sessions.
The page contains three sections: Instance Sessions, Session Statistics, and Connections.
View and analyze sessions
To diagnose session-related issues:
-
Check session statistics. Review the session overview, which includes:
-
Total number of sessions
-
Active sessions
-
Longest execution time
-
Sessions running longer than 3 seconds
-
Queries that do not use an index
-
-
Identify problematic sessions. In the Instance Sessions section, locate sessions with long execution times or missing index usage.
-
Take action. End or throttle problematic sessions as described below.
-
Verify resolution. Confirm that session statistics return to normal.
End sessions
Select one or more sessions in the Instance Sessions section and click Kill Selected.
Throttle sessions
Set concurrency limits for find, insert, update, and delete operations on a specified collection. MongoDB session throttling.
View connection statistics
The Connections section shows total and active connection counts for the instance.
Export session statistics
Export session statistics grouped by summary, client, or namespace.
Set up a MongoDB standalone instance
To monitor an ApsaraDB for MongoDB standalone instance, grant the required permissions to the database account.
Stage 1: Create a database account with the required roles
-
Run the following commands to create an account in the
admindatabase with the required roles:Note Replace the username
das_testand the passwordpasswordwith your own values.use admin; db.createUser({user:'das_test',pwd:'password',roles:[{role:'readAnyDatabase', db:'admin'}, {role:'clusterMonitor', db:'admin'}, {role: 'hostManager', db: 'admin'},{db: 'local', role: 'dbAdmin'},{db: 'config', role: 'dbAdmin'},{db: 'admin', role: 'dbAdminAnyDatabase'}]});
Stage 2: Authorize the account in DAS
-
Log on to the DAS console.
-
In the left-side navigation pane, choose Intelligent O&M Center > Instance Monitoring.
-
Find the target instance and choose Actions > Authorization.
-
In the Authorization dialog box, enter the Database Account and Password, and click Authorize.
-
When the Access Status column shows Connected, click OK.