Instance sessions

更新时间:
复制 MD 格式

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

  1. Log on to the DAS console.

  2. In the left-side navigation pane, choose Intelligent O&M Center > Instance Monitoring.

  3. Find the target instance and click the instance ID.

  4. 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:

  1. 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

  2. Identify problematic sessions. In the Instance Sessions section, locate sessions with long execution times or missing index usage.

  3. Take action. End or throttle problematic sessions as described below.

  4. 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

  1. Connect to the ApsaraDB for MongoDB instance.

  2. Run the following commands to create an account in the admin database with the required roles:

    Note Replace the username das_test and the password password with 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

  1. Log on to the DAS console.

  2. In the left-side navigation pane, choose Intelligent O&M Center > Instance Monitoring.

  3. Find the target instance and choose Actions > Authorization.

  4. In the Authorization dialog box, enter the Database Account and Password, and click Authorize.

  5. When the Access Status column shows Connected, click OK.