Issue Details (XML | Word | Printable)

Key: JRA-7423
Type: Improvement Improvement
Status: Resolved Resolved
Resolution: Fixed
Priority: Critical Critical
Assignee: Scott Farquhar [Atlassian]
Reporter: Nick Minutello
Votes: 0
Watchers: 0
Operations

Add/Edit UI Mockup to this issue
If you were logged in you would be able to see more operations.
JIRA

Permission Schemes page unusably slow

Created: 23/Jul/05 02:53 PM   Updated: 09/Aug/07 09:01 PM
Component/s: Performance
Affects Version/s: 3.2.3
Fix Version/s: 3.3

Time Tracking:
Not Specified

File Attachments: 1. Java Archive File atlassian-ofbiz-0.2.5.jar (29 kB)

Issue Links:
Reference
 

Participants: Nick Minutello and Scott Farquhar [Atlassian]
Since last comment: 3 years, 18 weeks, 5 days ago
Resolution Date: 26/Jul/05 09:08 PM
Labels:


 Description  « Hide
There isnt much information in the pofiling.... I will add more as soon as I can....

[70964ms] - /secure/admin/ViewPermissionSchemes.jspa

RESULT GROUP: PERMISSIONS
4:0ms 0-nminutello [0,0,0,0]
1:0ms 10-nminutello-Project [0]
5:0ms 11-nminutello-Project [0,0,0,0,0]
PERMISSIONS: 10 keys (3 unique) took 0ms/70964ms : 0.0% 0ms/query avg.

PROFILED : 10 keys (3 unique) took 0ms/70964ms : 0.0% 0ms/query avg.



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Nick Minutello added a comment - 23/Jul/05 07:53 PM
Finger is pointing strongly at inefficient database access....

To render this page we are doing 433 jdbc queries on the databse (ouch)

277 queries on the project table (find by id - we have 277 projects)
156 queries on the nodeassociation table ( - we have 156 permission schemes...)

basically, the WW iterator is iterating over the schemes (loaded in one query)
And for each permission scheme, it is doing a query to find out what projects it has.
Then its doing a query per project to load its information....
Ouchy

This will undoubtedly also be the cause of JRA-7424 - and will affect all View XXX Schemes pages...


Scott Farquhar [Atlassian] added a comment - 26/Jul/05 09:08 PM
This is fixed in 3.3 final

Scott Farquhar [Atlassian] added a comment - 26/Jul/05 09:11 PM
To patch JIRA - use this new atlassian-ofbiz jar, and then change the class 'AbstractSchemeManager' to look like:

public List getProjects(GenericValue scheme) throws GenericEntityException
{
List projectIds = CoreFactory.getAssociationManager().getSourceIdsFromSink(scheme, "Project", getAssociationType());

// it is faster to go the project manager (which is presumably cached) than to load it via association manager
// if we every do database joins, then we may be able to remove this
List projects = new ArrayList();
for (Iterator iterator = projectIds.iterator(); iterator.hasNext()

{ Long projectId = (Long) iterator.next(); projects.add(projectManager.getProject(projectId)); }

Collections.sort(projects, OfBizComparators.NAME_COMPARATOR);
return projects;
}


Nick Minutello added a comment - 26/Jul/05 09:35 PM
Scott, thanks for the quick fix!
Much appreciated. Will apply it tomorrow.