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

Message page taking long time to load

    XMLWordPrintable

    Details

    • Database:
      MySQL
    • Testing Instructions:
      Hide

      Set up

      1. Create a site with more than 20 users
      2. Send some messages between each user
        1. You can use the create_messages.php script from MDL-57370, if you like. It will send a bunch of messages from each user to each other user. You'll need to edit the script and set the amount of messages you'd like to send.
      3. Create a bunch of notifications for each user (more than 20 per user).
        1. You can use the attached create_notifications.php script from MDL-57370. Just edit it to change the number of notifications you'd like to create and enable assign notifications for web.

      Notifications popover

      1. Log in with one of the users
      2. Open the notifications popover in the nav bar
      3. Confirm the notifications load
      4. Scroll down in the popover and confirm that it loads the next set of notifications

      Messages popover

      1. Log in with one of the users
      2. Open the messages popover in the nav bar
      3. Confirm the conversations load in a timely manner (should only be a couple of seconds at most (definitely not 10 seconds))
      4. Scroll to the bottom of the popover
      5. Confirm that the next set of conversations is loaded (it shouldn't load duplicates)
      6. Click one of the conversations and confirm it takes you to that conversation in the messages page

      Messages page

      1. Log in with one of the users
      2. Navigate to their messages (user menu > messages)
      3. Open the messages popover and confirm that the conversations are loaded in the same order as the messages page
      4. In the messages page, scroll down in the list of conversations and confirm that the next set of conversations is loaded
      5. Select the conversation second from the top and send that user a message
        1. Take note of which conversation was the first one
        2. If it's slow to load a ticket has already created MDL-57482 to address that
      6. Navigate to a different page
      7. Open the messages popover and confirm that the user you just sent a message to is now first in the conversations list and the previous first conversation is now second
      Show
      Set up Create a site with more than 20 users Send some messages between each user You can use the create_messages.php script from MDL-57370 , if you like. It will send a bunch of messages from each user to each other user. You'll need to edit the script and set the amount of messages you'd like to send. Create a bunch of notifications for each user (more than 20 per user). You can use the attached create_notifications.php script from MDL-57370 . Just edit it to change the number of notifications you'd like to create and enable assign notifications for web. Notifications popover Log in with one of the users Open the notifications popover in the nav bar Confirm the notifications load Scroll down in the popover and confirm that it loads the next set of notifications Messages popover Log in with one of the users Open the messages popover in the nav bar Confirm the conversations load in a timely manner (should only be a couple of seconds at most (definitely not 10 seconds)) Scroll to the bottom of the popover Confirm that the next set of conversations is loaded (it shouldn't load duplicates) Click one of the conversations and confirm it takes you to that conversation in the messages page Messages page Log in with one of the users Navigate to their messages (user menu > messages) Open the messages popover and confirm that the conversations are loaded in the same order as the messages page In the messages page, scroll down in the list of conversations and confirm that the next set of conversations is loaded Select the conversation second from the top and send that user a message Take note of which conversation was the first one If it's slow to load a ticket has already created MDL-57482 to address that Navigate to a different page Open the messages popover and confirm that the user you just sent a message to is now first in the conversations list and the previous first conversation is now second
    • Affected Branches:
      MOODLE_32_STABLE
    • Fixed Branches:
      MOODLE_32_STABLE, MOODLE_33_STABLE
    • Pull from Repository:
    • Pull Master Branch:

      Description

      On our Moodle test environment the messages page is taking several minutes to open for all users.

      It looks as though MDL-57370 has not fixed the issues with slowness for our installation.

      I have found that queries in the \core_message\api::get_conversations() method are running really slowly for us for example running the first query for the admin takes 88 seconds and returns 8 results

      SELECT
      	id, useridfrom, useridto, subject, fullmessage, fullmessageformat,
      	fullmessagehtml, smallmessage, notification, contexturl,
      	contexturlname, timecreated, timeuserfromdeleted, timeusertodeleted,
      	component, eventtype, 0 as timeread
      FROM mdl_message
      WHERE
      	(useridto = 2 AND timeusertodeleted = 0 AND notification = 0)
      	OR
      	(useridfrom = 2 AND timeuserfromdeleted = 0 AND notification = 0)
      UNION ALL
      SELECT
      	id, useridfrom, useridto, subject, fullmessage, fullmessageformat,
      	fullmessagehtml, smallmessage, notification, contexturl,
      	contexturlname, timecreated, timeuserfromdeleted, timeusertodeleted,
      	component, eventtype, timeread
      FROM mdl_message_read
      WHERE
      	(useridto = 2 AND timeusertodeleted = 0 AND notification = 0)
      	OR
      	(useridfrom = 2 AND timeuserfromdeleted = 0 AND notification = 0)

      The explain is:

      id select_type table type possible_keys key key_len ref rows Extra
      1 PRIMARY mdl_message index_merge mdl_mess_useusetimtim_ix,mdl_mess_usetimnot_ix,mdl_mess_usetimnot2_ix mdl_mess_usetimnot2_ix,mdl_mess_usetimnot_ix 18,18 NULL 3 Using union(mdl_mess_usetimnot2_ix,mdl_mess_usetimnot_ix); Using where
      2 UNION mdl_message_read ref mdl_messread_useusetimtim_ix,mdl_messread_nottim_ix,mdl_messread_usetimnot_ix,mdl_messread_usetimnot2_ix mdl_messread_nottim_ix 2 const 636313 Using where
      NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL Using temporary

      We are using MySQL 5.6

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                2 Vote for this issue
                Watchers:
                8 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  11/Sep/17