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

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

Github user sudhansu7 commented on the pull request:

    https://github.com/apache/cloudstack/pull/897#issuecomment-152273822
  
    @remibergsma  @runseb 
    I have below performance analysis, which I did some time back. I trying to 
find out the dbdump to do a real test. But below analysis will may help to 
understand the issue and the solution.
    
    Clicking 'Network' tab invokes 3 api as mentioned below.
     
    
http://localhost:8080/client/api?command=listZones&response=json&sessionkey=1ddeSxQjc604bdnHJegYqkM6EgA%3D&networktype=Advanced&_=1436356355027
 -- 371ms
    this is to enable vpc, vpnCustomerGateway menu option.
     
    
http://localhost:8080/client/api?command=listNetworks&response=json&sessionkey=1ddeSxQjc604bdnHJegYqkM6EgA%3D&supportedServices=SecurityGroup&listAll=true&details=min&_=1436356355424
 -- 18.97s
    this is to enable securityGroups menu option. 
    
    
    
http://localhost:8080/client/api?command=listNetworks&response=json&sessionkey=1ddeSxQjc604bdnHJegYqkM6EgA%3D&listAll=true&page=1&pagesize=20&_=1436356374437
 -- 1.54s
    to list networks
     
    Second API call is taking 90% of the total response time.This api fetches 
all networks and interates over each network and for each network it makes an 
db call to fetch the services associated with the network. This is an expensive 
operation. 
     
    Solution: 
    
![image006](https://cloud.githubusercontent.com/assets/1062642/10827976/dbc6e066-7e97-11e5-8aec-09e0a84c1dc2.png)
    We can fetch listZones of type basic, if present then we can enable 
securityGroups menu option. For advanced zone with securitygroup service we can 
reuse first api call and can check "securitygroupsenabled" attribute in 
response. If present we will enable securityGroups menu option.
     
    
http://localhost:8080/client/api?command=listZones&response=json&sessionkey=JwxpVL74Wk6ZS7MvzSw0u6%2FA9eU%3D&networktype=Advanced&_=1436357831259
 --256ms
     
    
http://localhost:8080/client/api?command=listZones&response=json&sessionkey=JwxpVL74Wk6ZS7MvzSw0u6%2FA9eU%3D&networktype=Basic&_=1436357831901
 --11ms
     
    
http://localhost:8080/client/api?command=listNetworks&response=json&sessionkey=JwxpVL74Wk6ZS7MvzSw0u6%2FA9eU%3D&listAll=true&page=1&pagesize=20&_=1436357831968
 --868s
     
    total : 1.19s
    
    



> Slow UI response while loading the list of networks in network tab.
> -------------------------------------------------------------------
>
>                 Key: CLOUDSTACK-8919
>                 URL: https://issues.apache.org/jira/browse/CLOUDSTACK-8919
>             Project: CloudStack
>          Issue Type: Bug
>      Security Level: Public(Anyone can view this level - this is the 
> default.) 
>          Components: UI
>            Reporter: Nitin Kumar Maharana
>
> Root cause of this Issue: Invokes 3 APIs, the 2nd API to check whether any 
> network is having security group service, this consumes 90% of the time. API 
> fetches network list and for each network calls DB to get services associated.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to