Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stupidly slow saving with 1100 usergroups #19804

Open
tonypartridge opened this issue Mar 1, 2018 · 14 comments
Open

Stupidly slow saving with 1100 usergroups #19804

tonypartridge opened this issue Mar 1, 2018 · 14 comments

Comments

@tonypartridge
Copy link
Contributor

tonypartridge commented Mar 1, 2018

So a client has a site which has 1,100 usergroups. This is used for course management they restrict access to courses based on user groups and they have 3-6 users groups per client of theirs.

this means when saving a page it takes around 3-4minutes to finish processing in the browser whilst it does it's user group checks from what I can gather, Javascript is not my forte. This makes managing the site very hard and tiresome.

Can we disable validating usergroups via JS? Maybe as a global config option? Since we can handle this serverside and surely we already do as a fall back should anyone has JS disabled as an example.

@GCLW
Copy link

GCLW commented Mar 2, 2018

I'm guessing it is more because you have a category with 100,000+ articles in it and when you save a new article every single one of those articles has to get its "ordering" field incremented by 1 so the new article will display first.

@tonypartridge
Copy link
Contributor Author

tonypartridge commented Mar 2, 2018 via email

@ggppdk
Copy link
Contributor

ggppdk commented Mar 3, 2018

@tonypartridge

hhmm
there is no validation for ACL rule fields (you have 12 of every usergroup)
the above is because the 'select' field of the rules have 'novalidate' CSS class (i also remember discussion when this was suggested and added)

so it must be something else

I tested global config using 1020 groups,

after global config form is saved
-- the page reloads

at that point (but also when i first open global config form) i see very slow page load time (browser trying to execute JS and render HTML)

is the above the issue for you ?

@ggppdk
Copy link
Contributor

ggppdk commented Mar 3, 2018

To create about 1000 usergroups with some nesting try adding a new task inside groups controller
/administrator/components/com_users/controllers/groups.php

then open URL:
/administrator/index.php?option=com_users&task=groups.creategroups

public function creategroups()
{
	$db = JFactory::getDbo();
	$vals = array();
	$n = 1000;

	for ($i = 0; $i < 10; $i++)
	{
		$parent_id = !$i ? 1 : 1000 + $i - 1;
		$query = 'INSERT INTO #__usergroups '
				. ' (id, title, parent_id)'
				. ' VALUES (' . (1000 + $i) . ', ' . $db->q('Test group ' . uniqid()) . ', ' . $parent_id . ')';
		$db->setQuery($query)->execute();
	}

	for ($i = 0; $i < $n; $i++)
	{
		//$vals[] = '(0, ' . $db->q('Test group ' . uniqid()) . ', ' . (1000 + (int) ($i % 10)) . ')';
		$vals[] = '(0, ' . $db->q('Test group ' . uniqid()) . ', 1009)';
	}

	$query = 'INSERT INTO #__usergroups '
			. ' (id, title, parent_id)'
			. ' VALUES ' . implode($vals, ',');
	$db->setQuery($query)->execute();

	$table = JTable::getInstance('Usergroup', 'JTable', array());
	$table->rebuild();

	JFactory::getApplication()->enqueueMessage('Added 10 + ' . $n . ' usergroups', 'notice');
}

@Fedik
Copy link
Member

Fedik commented Mar 3, 2018

Can we disable validating usergroups via JS?

As @ggppdk noted It is disabled, at least should be.
There can be 100 other script which tried to do something with inputs in the form.

@tonypartridge
Copy link
Contributor Author

tonypartridge commented Mar 3, 2018 via email

@Fedik
Copy link
Member

Fedik commented Mar 3, 2018

@tonypartridge please add more detail:

  • which component?
  • which form?
  • whether there any non-core plugins involved?

@Fedik
Copy link
Member

Fedik commented Mar 4, 2018

I have made test on Article form (with 1000 user groups), and validation took only ~40ms, however whole submit ~400ms, but still not 3-4 minutes:

screen 2018-03-04 13 09 55 461x326

But the initial rendering take a loooot, mainly because choosen.js.
And Global Configuration form become inaccessible due slow rendering.

Anyway.
Only good solution is to detach the rule field from the main form, make editing in the modal or in another window. Otherwise this issue will stay forever 😉

@tonypartridge
Copy link
Contributor Author

tonypartridge commented Mar 4, 2018 via email

@Fedik
Copy link
Member

Fedik commented Mar 4, 2018

Try it with access levels of 1000 one to every group too?

nope, I missed this part sorry 😉
but, it not affected by validation,
Can be due:
jQuery("#permissions-sliders select").attr("disabled", "disabled"); and permissions.js

Anyway there only one good solution, I already wrote.
if someone brave enough to do it, that would be cool 😉

@dgrammatiko
Copy link
Contributor

@Fedik let's do that in J4, also making this modal means one less tab which is also another win (simplification)! 👍

@tonypartridge
Copy link
Contributor Author

tonypartridge commented Mar 4, 2018 via email

@coolcat-creations
Copy link
Contributor

is this a duplicate of #30101 ?

@brianteeman
Copy link
Contributor

ooks like they are the same although this one is the oldest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Still Relevant, Needs Attention
Development

No branches or pull requests