cloudstack-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CLOUDSTACK-10104) Optimize database transactions in ListDomain API to improve performance
Date Fri, 05 Jan 2018 09:24:00 GMT

    [ https://issues.apache.org/jira/browse/CLOUDSTACK-10104?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16312758#comment-16312758
] 

ASF GitHub Bot commented on CLOUDSTACK-10104:
---------------------------------------------

yvsubhash commented on a change in pull request #2282: CLOUDSTACK-10104:Optimize database
transactions in ListDomain API to improve performance
URL: https://github.com/apache/cloudstack/pull/2282#discussion_r159397903
 
 

 ##########
 File path: server/src/com/cloud/api/query/ViewResponseHelper.java
 ##########
 @@ -375,14 +380,164 @@ else if (vr.getFormat() == ImageFormat.OVA){
         return new ArrayList<StoragePoolResponse>(vrDataList.values());
     }
 
-    public static List<DomainResponse> createDomainResponse(ResponseView view, EnumSet<DomainDetails>
details, DomainJoinVO... domains) {
+    public static List<DomainResponse> createDomainResponse(ResponseView view, EnumSet<DomainDetails>
details, List<DomainJoinVO> domains) {
         List<DomainResponse> respList = new ArrayList<DomainResponse>();
-        for (DomainJoinVO vt : domains){
-            respList.add(ApiDBUtils.newDomainResponse(view, details, vt));
+        //-- Coping the list to keep original order
+        List<DomainJoinVO> domainsCopy = new ArrayList<>(domains);
+        Collections.sort(domainsCopy, DomainJoinVO.domainIdComparator);
+        for (DomainJoinVO domainJoinVO : domains){
+            //-- Set parent information
+            DomainJoinVO parentDomainJoinVO = searchParentDomainUsingBinary(domainsCopy,
domainJoinVO);
+            if(parentDomainJoinVO == null && domainJoinVO.getParent() != null) {
 
 Review comment:
   @PranaliM  What is the scenario we go in to this case?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


> Optimize database transactions in ListDomain API to improve performance
> -----------------------------------------------------------------------
>
>                 Key: CLOUDSTACK-10104
>                 URL: https://issues.apache.org/jira/browse/CLOUDSTACK-10104
>             Project: CloudStack
>          Issue Type: Bug
>      Security Level: Public(Anyone can view this level - this is the default.) 
>          Components: API
>            Reporter: Pranali Mande
>
> While creating the response object for the 'listDomain' API, several database calls are
triggered to fetch details like parent domain, project limit, IP limit, etc. These database
calls are triggered for each record found for in the main fetch query, which is causing the
response to slow down. The database transactions could be optimized to reduce the response
time of the Listdomain API



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message