Orchard Roles Slow

Topics: Core
Apr 4, 2014 at 7:03 PM
So, I have about 3000 users and about 2 dozen roles defined in my Orchard application, as well as a handful of custom defined permissions.

The site runs pretty well most of the time. Although, if I turn on shape tracing it all goes to hell. But I noticed that whenever I click a role to modify it. Lets say just to add or take away a permission, it's like gone. It'll sit there for 10min? Maybe. Maybe more. And the CPU goes berserk. Like from nothing to pegged. It took long enough for me to actually get up and go to lunch.... but when I came back it was up lol. And it's just the roles. Everything else runs pretty well.

I realize this is not a lot of info and pretty vague. But has anyone experienced anything like this and could at least point me in a general direction? This could turn into a deal breaker for my company's Orchard use.
Apr 4, 2014 at 7:05 PM
Please complete the repro:
  • Create 3000 users (or more)
  • Add a permission to one of the user
Result: the page is very slow to display
Apr 4, 2014 at 7:15 PM
So you're saying that's the way it is then? Orchard is not meant to be used with that many users?
Apr 4, 2014 at 7:21 PM
Edited Apr 4, 2014 at 7:22 PM
And I'll add it's not really unusable slow doing anything else inside users. i.e. creating a new one, paging between them, adding a role, etc. It's literally only clicking on a role or adding a new role. The page that lists the roles loads fine. But you pick any one of the roles and it's done.
Apr 4, 2014 at 7:32 PM
No I am just asking for repro steps so I can identify the scenario, reproduce, and ensure it's fixed.
Apr 4, 2014 at 7:45 PM
Ohhh. Ok. Gotcha.

Those steps would be correct. But I also added a handful of permissions in code.

I have just under 40 roles defined, including the core ones (admin, editor, contributor, etc.).

Also, I don't know if it's related, and I don't know how long it's been happening but, no matter what I do, I can't get my breakpoints to load inside the Roles module. Says that the copy in Orchard.Core is different than the source I'm debugging. Which makes no sense. I've cleaned, rebuilt, deleted temporary asp.net files, manually deleted obj folders, restarted IIS, the app pool. I don't know what else I could do.

Anyways, that's all the info i have.
Apr 7, 2014 at 3:07 PM
So I was able to dig a little deeper.

Although, I am unable to directly debug the Roles module, I was able to copy the code out into my own module and debug from there.

The problem is in the GetInstalledPermissions() method. Specifically the permissionProvider.GetPermissions() method but ONLY for the Orchard.CustomForms module. I put a conditional breakpoint looking for that module and it takes about 10-15 min to come back. It does come back. But it takes that long, and there's only 4 permissions that are being returned. If I put an if block around weeding out that module, it runs very fast.
Apr 7, 2014 at 3:35 PM
More specifically, this line:
var formTypes = _contentManager.Query<CustomFormPart>().List().Select(x => x.ContentType).Distinct();

...in the Orchard.CustomForms permission provider is the culprit.