Moodle
  1. Moodle
  2. MDL-26026

Slow course subscribers access with DB enrol module

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.9.8
    • Fix Version/s: 2.0.1
    • Labels:
    • Environment:
      Linux Debian Stable (Lenny) with standard apache2, standard php5, mysql cluster from Mysql
      ==> MOODLE 1.9.5
    • Database:
      MySQL
    • Difficulty:
      Easy
    • Affected Branches:
      MOODLE_19_STABLE
    • Fixed Branches:
      MOODLE_20_STABLE
    • Rank:
      15545

      Description

      I know the 1.9.5 version is not supported, but I file this improvement after talking to Martin.

      WHAT HAPPENS:
      The more users log in and subscribe to meta courses via the database plugin, the process gets slower and slower.
      I saw this was due because for EVERY user that was logging in, the lib/moodlelib.php => sync_metacourse procedure was launched.
      This procedures resyncs ALL users and not only the one that triggered the action.

      This means that after 5.000 subscribers or so the DB was almost crashed and login took ages (more than 2 minutes)

      IMPROVEMENT:
      I modified 2 files:

      • FILE lib/moodlelib.php, function sync_metacourse ($Id: moodlelib.php,v 1.960.2.132 2009/05/15 07:22:23 skodak Exp $)
        2422 function sync_metacourse($course, $userid=0) {
        ...
        2481 // Get assignments of a user to a role that exist in the meta course, but
        2482 // not in any child courses. That is, get a list of the unassignments that need to be made.
        +++2483 if($userid) $roleexclusions.= " ra.userid=$userid AND ";
      • FILE lib/accesslib.php, function role_assign ($Id: accesslib.php,v 1.421.2.106 2009/05/23 20:07:12 skodak Exp $)
        2983 sync_metacourse($parent->parent_course, $userid); // added the $userid of the user that triggered the sync.

      After these modifications the login procedure with 11.000 users is taking less than 10 seconds.

      Still the cron job is synchronizing the whole metacourse as it is not sending the userid parameter.

        Activity

        Hide
        Petr Škoda added a comment -

        Hello,

        the 1.9.x stable branch is not getting only major security fixes, sorry. This issue should be finally fixed in 2.x, thanks for the report anyway.

        Petr

        Show
        Petr Škoda added a comment - Hello, the 1.9.x stable branch is not getting only major security fixes, sorry. This issue should be finally fixed in 2.x, thanks for the report anyway. Petr

          People

          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: