Forums | Mahara Community

Developers /
Textbox bottleneck?


anonymous profile picture
Account deleted
Posts: 131

17 October 2014, 4:37

Hi,

I've recently updated my Mahara site to 1.9

The textbox config form is very slow to open for creation or editing textboxes, taking many seconds (e.g 5, 6 or more seconds). 

My first tests suggest that it is the listing of other textboxes, shown by clicking on 'Use content from another text box' which is taking a long time to create, and to a lesser extent the listing of artefacts which can be attached to the textbox.

Is anyone else experiencing these slowdowns? It may be a quirk of my system.

Wouldn't it be better to lazy-load these form elements, pulling them in as required rather than every time a textbox is created or edited?

Mike

 

Aaron Wells's profile picture
Posts: 896

17 October 2014, 9:28

Hi Mike,

I haven't experienced that problem, but I probably don't have as much content in my portfolio as you do.

In Mahara 1.10 we're splitting the textbox block into two separate blocks: a "text" block that will just have a single, non-reusable text field, and a "note" block that will have all the functionality of the current textbox block. The upgrade script will convert all the existing text blocks to one or the other: if an old text block has attachments or is used in multiple places, it'll be converted into a "note" block; otherwise, it'll be converted into a simple text block.

So, that should help with the problem somewhat. It's kind of a human-driven way of making sure that the reuse and attachments parts aren't pulled in unless they're actually needed.

That said, if you want to push a patch to lazy-load those things, I'd welcome it. :) I think Mahara could use some smart lazy-loading of key things in order to make it more snappy.

Cheers,

Aaron

anonymous profile picture
Account deleted
Posts: 131

17 October 2014, 21:56

Hi Aaron,

OK, got you. I will do some more tests and might have a bash at coming up with a patch.

By the way, my inline images for TinyMCE seems to be working well in my installation here, so I will submit that to core and you can see if you think it's a reasonable approach.

Mike

Aaron Wells's profile picture
Posts: 896

20 October 2014, 10:39

That'd be great. We just had a meeting last week to discuss what our priorities are for Mahara 1.11, and I brought up the TinyMCE image button as something it would be good to get in.

Cheers,

Aaron

anonymous profile picture
Account deleted
Posts: 131

18 November 2014, 5:05

Hi Aaron,

I submitted a lazy-load patch to address this. So the config-form opens quickly now.

However, when users click on the link to open the list of other textboxes, the load-time is super slow here. On my account I timed it at 12 seconds, going up to 20 seconds at times.

The query is a big one:

SELECT a.*, (a.owner IS NOT NULL AND a.owner = ?) AS editable FROM {artefact} a 
            LEFT OUTER JOIN {artefact_parent_cache} apc ON (a.id = apc.artefact AND a.institution = 'mahara' AND apc.parent = ?) WHERE (
                a.owner = ?
                OR a.id IN (
                    SELECT aar.artefact
                    FROM {group_member} m
                        JOIN {artefact} aa ON m.group = aa.group
                        JOIN {artefact_access_role} aar ON aar.role = m.role AND aar.artefact = aa.id
                    WHERE m.member = ? AND aar.can_republish = 1
                )
                OR a.id IN (SELECT artefact FROM {artefact_access_usr} WHERE usr = ? AND can_republish = 1)
                OR a.institution IN (?)
            ) AND artefacttype IN(?)ORDER BY title ASC

 

I am wondering about removing the sub-clause to look in groups, if the user is not working on a group page. Do you think there are any other strategies which could speed this process up?

Aaron Wells's profile picture
Posts: 896

26 November 2014, 12:53

It does a left outer join to artefact_parent_cache, but then never actually accesses any columns from that table, which makes it pointless to do an outer join to it. So I would drop that for starters.

Another thing you could try is converting those "IN" subqueries to "EXISTS" subqueries. Sometimes that improves performance.

Cheers,

Aaron

anonymous profile picture
Account deleted
Posts: 131

27 November 2014, 2:29

Thanks for that Aaron, I'll take another look at it.

Bw,

Mike

Jason Bailey's profile picture
Posts: 3

29 April 2015, 4:39

Hi 

Martin at Catalyst Brighton spotted this for us and I was just wondering if this issue is fixed in 1.10

We're currently on 1.9.2 and the problem is quite noticeable in teaching sessions where a tutor might say to class of 20/30 people "now drag the text box onto your layout". When a large number of users do this then the text block can take over a minute to display. I'd assumed it was a max allowed connections type problem and a combination of the size of info coming back in the response to display the textbox editor.

We can replicate the issue with smaller numbers of people but is a problem for mahara training sessions.

 

Thanks

Jason 

Sarah Cotton's profile picture
Posts: 7

30 October 2015, 23:56

Can I just ask which version the patch is for? I've patched it to 1.9.2 but not all of the hunks were successfully applied.

Many thanks

Aaron Wells's profile picture
Posts: 896

02 November 2015, 16:09

Hi Sarah,

This patch? https://reviews.mahara.org/#/c/3982/

It was originally written for Mahara 15.04, but was eventually merged into 15.10. So it might take a little work to adapt it to 1.9.

Cheers,

Aaron

10 results