Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-62972

Huge number of mysql connections for external logstore

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Reopened
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 3.3.7, 3.4.4, 3.5.1
    • Fix Version/s: None
    • Labels:
    • Environment:
      CentOS, MariaDB

      Description

      Description

      Mysql connections to external logstore are not reused/cached, so the amount of mysql connections is increasing.
      This can best be seen during automated course backup. Every database reading creates a new database connection. This connections are terminated when backup process is finished.

      Suggested solution

      Use a global variable $DBEXT like $DB, where the external mysql connection is cached.

      Reproduction

      Setup external database

      1. Create a database other than your Moodle database.
      2. Create a table in the above database identical to the logstore_standard in your Moodle database.

      Configuration of external database

      1. Go to Site administration ► Plugins ► Logging ► Manage log stores
      2. Enable External database log
      3. Go to settings for the external logstore
      4. Enter your external database and table details and save
      5. Click on "Test connection" and make sure you can successfully connect to the database table.

      Configuration of automated backups

      1. Go to Site administration ► Courses ► Backups ► Automated backup setup
      2. Set backup_auto_active to "Enabled"
      3. Set backup_auto_logs to "Yes"

      Observe mysql process while backup is running

      1. Perform an automated backup on cli: php admin/cli/automated_backups.php
      2. While backup is running, observer the processes on Mysql console / PHPMyAdmin: show processlist;

       

        Attachments

          Activity

            People

            • Votes:
              1 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

              • Created:
                Updated: