You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ambari.apache.org by Sid Wagle <sw...@hortonworks.com> on 2014/03/10 21:54:47 UTC

Review Request 18981: API call to get host status takes 30 seconds

-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/18981/
-----------------------------------------------------------

Review request for Ambari, Sumit Mohanty and Tom Beerbower.


Bugs: AMBARI-5005
    https://issues.apache.org/jira/browse/AMBARI-5005


Repository: ambari


Description
-------

[root@perf800-large1 ~]# time curl -u admin:admin 'http://<server-ip>:8080/api/v1/clusters/c1/hosts?fields=Hosts/host_status,Hosts/maintenance_state,host_components/HostRoles/state,host_components/HostRoles/maintenance_state,alerts/summary&minimal_response=true&_=1393982657484' > /dev/null
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  739k    0  739k    0     0  40120      0 --:--:--  0:00:18 --:--:--  191k

real	0m18.878s
user	0m0.020s
sys	0m0.000s


Diffs
-----

  ambari-server/src/main/java/org/apache/ambari/server/agent/HeartBeatHandler.java b0258a4 
  ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java 69b58f7 
  ambari-server/src/main/java/org/apache/ambari/server/controller/MaintenanceStateHelper.java 2b30b9f 
  ambari-server/src/main/java/org/apache/ambari/server/state/ServiceComponentImpl.java 9226cf1 
  ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClustersImpl.java 24e5b1a 
  ambari-server/src/main/java/org/apache/ambari/server/state/host/HostImpl.java d151e8b 
  ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerImplTest.java c99bfa1 
  ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java 3c1632c 
  ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ComponentResourceProviderTest.java 2cc1165 
  ambari-server/src/test/java/org/apache/ambari/server/controller/internal/HostResourceProviderTest.java 049af58 

Diff: https://reviews.apache.org/r/18981/diff/


Testing
-------

Results :

Tests run: 1480, Failures: 0, Errors: 0, Skipped: 9


Thanks,

Sid Wagle


Re: Review Request 18981: API call to get host status takes 30 seconds

Posted by Tom Beerbower <tb...@hortonworks.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/18981/#review36723
-----------------------------------------------------------

Ship it!


Ship It!

- Tom Beerbower


On March 10, 2014, 8:54 p.m., Sid Wagle wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/18981/
> -----------------------------------------------------------
> 
> (Updated March 10, 2014, 8:54 p.m.)
> 
> 
> Review request for Ambari, Sumit Mohanty and Tom Beerbower.
> 
> 
> Bugs: AMBARI-5005
>     https://issues.apache.org/jira/browse/AMBARI-5005
> 
> 
> Repository: ambari
> 
> 
> Description
> -------
> 
> [root@perf800-large1 ~]# time curl -u admin:admin 'http://<server-ip>:8080/api/v1/clusters/c1/hosts?fields=Hosts/host_status,Hosts/maintenance_state,host_components/HostRoles/state,host_components/HostRoles/maintenance_state,alerts/summary&minimal_response=true&_=1393982657484' > /dev/null
>   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
>                                  Dload  Upload   Total   Spent    Left  Speed
> 100  739k    0  739k    0     0  40120      0 --:--:--  0:00:18 --:--:--  191k
> 
> real	0m18.878s
> user	0m0.020s
> sys	0m0.000s
> 
> 
> Diffs
> -----
> 
>   ambari-server/src/main/java/org/apache/ambari/server/agent/HeartBeatHandler.java b0258a4 
>   ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java 69b58f7 
>   ambari-server/src/main/java/org/apache/ambari/server/controller/MaintenanceStateHelper.java 2b30b9f 
>   ambari-server/src/main/java/org/apache/ambari/server/state/ServiceComponentImpl.java 9226cf1 
>   ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClustersImpl.java 24e5b1a 
>   ambari-server/src/main/java/org/apache/ambari/server/state/host/HostImpl.java d151e8b 
>   ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerImplTest.java c99bfa1 
>   ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java 3c1632c 
>   ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ComponentResourceProviderTest.java 2cc1165 
>   ambari-server/src/test/java/org/apache/ambari/server/controller/internal/HostResourceProviderTest.java 049af58 
> 
> Diff: https://reviews.apache.org/r/18981/diff/
> 
> 
> Testing
> -------
> 
> Results :
> 
> Tests run: 1480, Failures: 0, Errors: 0, Skipped: 9
> 
> 
> Thanks,
> 
> Sid Wagle
> 
>


Re: Review Request 18981: API call to get host status takes 30 seconds

Posted by Sid Wagle <sw...@hortonworks.com>.

> On March 10, 2014, 10:09 p.m., Tom Beerbower wrote:
> > Quick question.  It's not clear to me where the issue was and what the fix is.  Could you summarize the fix? 
> >

1. clusters.getHostsForCluster() was called inside the loop, essentially for every HostComponent and result in several lock acquisitions. (MaintenanceStateHelper.getEffectiveState(Sch) was the callee).

2. sc.getHostComponent(hostname) calls which also needed locking calls, were reduced with one call to get Map and do a lookup on it.

3. HostImpl.getHostName() again unnecessary locking here.

4. MantenanceStateHelper.getEffectiveState() was overloaded to wrok with the above changes.


- Sid


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/18981/#review36714
-----------------------------------------------------------


On March 10, 2014, 8:54 p.m., Sid Wagle wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/18981/
> -----------------------------------------------------------
> 
> (Updated March 10, 2014, 8:54 p.m.)
> 
> 
> Review request for Ambari, Sumit Mohanty and Tom Beerbower.
> 
> 
> Bugs: AMBARI-5005
>     https://issues.apache.org/jira/browse/AMBARI-5005
> 
> 
> Repository: ambari
> 
> 
> Description
> -------
> 
> [root@perf800-large1 ~]# time curl -u admin:admin 'http://<server-ip>:8080/api/v1/clusters/c1/hosts?fields=Hosts/host_status,Hosts/maintenance_state,host_components/HostRoles/state,host_components/HostRoles/maintenance_state,alerts/summary&minimal_response=true&_=1393982657484' > /dev/null
>   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
>                                  Dload  Upload   Total   Spent    Left  Speed
> 100  739k    0  739k    0     0  40120      0 --:--:--  0:00:18 --:--:--  191k
> 
> real	0m18.878s
> user	0m0.020s
> sys	0m0.000s
> 
> 
> Diffs
> -----
> 
>   ambari-server/src/main/java/org/apache/ambari/server/agent/HeartBeatHandler.java b0258a4 
>   ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java 69b58f7 
>   ambari-server/src/main/java/org/apache/ambari/server/controller/MaintenanceStateHelper.java 2b30b9f 
>   ambari-server/src/main/java/org/apache/ambari/server/state/ServiceComponentImpl.java 9226cf1 
>   ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClustersImpl.java 24e5b1a 
>   ambari-server/src/main/java/org/apache/ambari/server/state/host/HostImpl.java d151e8b 
>   ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerImplTest.java c99bfa1 
>   ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java 3c1632c 
>   ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ComponentResourceProviderTest.java 2cc1165 
>   ambari-server/src/test/java/org/apache/ambari/server/controller/internal/HostResourceProviderTest.java 049af58 
> 
> Diff: https://reviews.apache.org/r/18981/diff/
> 
> 
> Testing
> -------
> 
> Results :
> 
> Tests run: 1480, Failures: 0, Errors: 0, Skipped: 9
> 
> 
> Thanks,
> 
> Sid Wagle
> 
>


Re: Review Request 18981: API call to get host status takes 30 seconds

Posted by Tom Beerbower <tb...@hortonworks.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/18981/#review36714
-----------------------------------------------------------


Quick question.  It's not clear to me where the issue was and what the fix is.  Could you summarize the fix? 


- Tom Beerbower


On March 10, 2014, 8:54 p.m., Sid Wagle wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/18981/
> -----------------------------------------------------------
> 
> (Updated March 10, 2014, 8:54 p.m.)
> 
> 
> Review request for Ambari, Sumit Mohanty and Tom Beerbower.
> 
> 
> Bugs: AMBARI-5005
>     https://issues.apache.org/jira/browse/AMBARI-5005
> 
> 
> Repository: ambari
> 
> 
> Description
> -------
> 
> [root@perf800-large1 ~]# time curl -u admin:admin 'http://<server-ip>:8080/api/v1/clusters/c1/hosts?fields=Hosts/host_status,Hosts/maintenance_state,host_components/HostRoles/state,host_components/HostRoles/maintenance_state,alerts/summary&minimal_response=true&_=1393982657484' > /dev/null
>   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
>                                  Dload  Upload   Total   Spent    Left  Speed
> 100  739k    0  739k    0     0  40120      0 --:--:--  0:00:18 --:--:--  191k
> 
> real	0m18.878s
> user	0m0.020s
> sys	0m0.000s
> 
> 
> Diffs
> -----
> 
>   ambari-server/src/main/java/org/apache/ambari/server/agent/HeartBeatHandler.java b0258a4 
>   ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java 69b58f7 
>   ambari-server/src/main/java/org/apache/ambari/server/controller/MaintenanceStateHelper.java 2b30b9f 
>   ambari-server/src/main/java/org/apache/ambari/server/state/ServiceComponentImpl.java 9226cf1 
>   ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClustersImpl.java 24e5b1a 
>   ambari-server/src/main/java/org/apache/ambari/server/state/host/HostImpl.java d151e8b 
>   ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerImplTest.java c99bfa1 
>   ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java 3c1632c 
>   ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ComponentResourceProviderTest.java 2cc1165 
>   ambari-server/src/test/java/org/apache/ambari/server/controller/internal/HostResourceProviderTest.java 049af58 
> 
> Diff: https://reviews.apache.org/r/18981/diff/
> 
> 
> Testing
> -------
> 
> Results :
> 
> Tests run: 1480, Failures: 0, Errors: 0, Skipped: 9
> 
> 
> Thanks,
> 
> Sid Wagle
> 
>