<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.expertiza.ncsu.edu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Rpsingh3</id>
	<title>Expertiza_Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.expertiza.ncsu.edu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Rpsingh3"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Rpsingh3"/>
	<updated>2026-08-20T13:27:33Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_A1550_Web_Socket_Implementation_in_Apache_Ambari&amp;diff=99926</id>
		<title>CSC/ECE 517 Fall 2015 A1550 Web Socket Implementation in Apache Ambari</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_A1550_Web_Socket_Implementation_in_Apache_Ambari&amp;diff=99926"/>
		<updated>2015-11-14T04:41:52Z</updated>

		<summary type="html">&lt;p&gt;Rpsingh3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction'''==&lt;br /&gt;
&lt;br /&gt;
Apache Ambari is a software project of the [https://en.wikipedia.org/wiki/Apache_Software_Foundation Apache Software Foundation], aimed at making [https://en.wikipedia.org/wiki/Apache_Hadoop Hadoop] management simpler by developing software for provisioning, managing, and monitoring Apache Hadoop clusters. Ambari provides an intuitive, easy-to-use [https://en.wikipedia.org/wiki/Apache_Hadoop Hadoop] management web UI backed by its [https://en.wikipedia.org/wiki/Representational_state_transfer RESTful] APIs. Ambari was a sub-project of [https://en.wikipedia.org/wiki/Apache_Hadoop Hadoop] but is now a [https://en.wikipedia.org/wiki/Apache_Software_Foundation#Projects top-level] project in its own right.&lt;br /&gt;
&lt;br /&gt;
An Apache Hadoop cluster consists on a group or nodes/machines. Each node acts as an Ambari Agent that runs various service components (e.g. DataNode for HDFS). One of the agents acts as an Ambari Server that takes care of the task allocation, management, gathering information about the services status and other information from the agents and giving the information to Ambari UI for display. More information about Agent-Server-Web flow is available in the following sections.&lt;br /&gt;
&lt;br /&gt;
Ambari-Web uses simple ajax polling mechanism to fetch data from Ambari-Server. Constant polling is done to show current service status, alerts, service graphs, etc on Ambari-Web. With this mechanism, the performance of Ambari-Server can be affected on a large size cluster with multiple active browser sessions due to continuous heavy requests being made. &lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/WebSocket WebSocket] is a protocol providing full-duplex communication channels over a single TCP connection. Implementing Web-Socket between Ambari-Web and Ambari-Server will be helpful to address this scenario.&lt;br /&gt;
&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;font color = &amp;quot;red&amp;quot;&amp;gt; Note: This is continuation of our OSS project &amp;lt;/font&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==='''Project Goals'''===&lt;br /&gt;
&amp;lt;p&amp;gt;1. Understand architecture of Ambari-Server and Ambari-Web&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;2. Replace the current [https://en.wikipedia.org/wiki/Polling_(computer_science) polling mechanism] with the push-based mechanism via Web-Socket&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;3. Write test cases for the Web Socket implementation to test the functionalities of WebSocket Client and WebSocket Server&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==='''Project Design'''===&lt;br /&gt;
Ambari is a multi-module Maven project. The relevant modules for our project from an implementation perspective are Ambari Web and Ambari Server. Ambari Agent is another module, important functionally.&lt;br /&gt;
&lt;br /&gt;
===='''Major Components'''====&lt;br /&gt;
&amp;lt;b&amp;gt;Ambari Agent &amp;lt;/b&amp;gt; is a component that resides on every node of the cluster. Its responsibility is to collect the node's overall health which comprises of the health metrics of all the different services running on that node. Ambari Agent sends these statuses to the Ambari Server in the form of periodic messages which is termed as 'Heartbeat' in the Ambari nomenclature. In return, Ambari agents receive Heartbeat responses from Ambari Server. Hearbeat responses could contain commands for the agent to perform.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Ambari Web &amp;lt;/b&amp;gt; presents a user interface to monitor and manage a Hadoop cluster. Web module is written in JavaScript using Ember.js framework. During our code study, we observed this module following the [https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller MVC] design methodology. The whole motivation of this module is to make it convenient to the end-user to manage the concerned Hadoop cluster.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Ambari Server &amp;lt;/b&amp;gt; is the most central component of an Ambari ecosystem. Ambari Server exposes [https://en.wikipedia.org/wiki/Application_programming_interface APIs]] to its clients such as Ambari Web, which monitors health of a cluster. Ambari Server clients can query for node health statuses. Ambari Server persists the nodes' statuses in a [https://en.wikipedia.org/wiki/PostgreSQL PostgreSQL] database in the backend. Internally, Ambari Server has several components which help it to manage its responsibilities. Ambari Server's important responsibilities are as follows:&lt;br /&gt;
&amp;lt;p&amp;gt; 1. Collect health statuses ( Heartbeats ) from Ambari agents. Process their statuses and send Heartbeat responses to Ambari agents. &amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt; 2. Handle requests from Ambari Server's clients: One such use case is installing a new service on an Ambari agent. This request could be received from Ambari Web and it is the server's responsibility to send appropriate instructions to the particular agent to get the new service up and running on the agent. &amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===='''Architectural design of WebSocket client-server in Apache Ambari'''====&lt;br /&gt;
[[File:Ambari-WebServerClient.png]]&lt;br /&gt;
&lt;br /&gt;
===='''Flow Diagram'''====&lt;br /&gt;
[[File:Ambari-Flow.png]]&lt;br /&gt;
&lt;br /&gt;
==='''Implementation'''===&lt;br /&gt;
===='''Design Pattern'''====&lt;br /&gt;
We have observed that Ambari project adopts various design patterns like [https://en.wikipedia.org/wiki/Singleton_pattern Singleton Pattern] in the Data Access Object Classes. For this project, we will be using [https://en.wikipedia.org/wiki/Request%E2%80%93response request-response], one of the [https://en.wikipedia.org/wiki/Messaging_pattern Messaging Pattern].&lt;br /&gt;
&lt;br /&gt;
Request–response is a message exchange pattern in which a requestor sends a request message to a replier system which receives and processes the request, ultimately returning a message in response. This is a simple, but powerful messaging pattern which allows two applications to have a two-way conversation with one another over a channel. In our project, Ambari-Server's HeartBeat handler acts as a requestor which sends the message to Ambari UI via WebSocket protocol. In response, Ambari UI acknowledges the received information and sends new requests if any to the Ambari-Server. Moreover, same messaging pattern is followed for bidirectional communication between Ambari-Agent and Ambari-Server.&lt;br /&gt;
&lt;br /&gt;
===='''UML Diagrams'''====&lt;br /&gt;
====='''Class Diagram'''=====&lt;br /&gt;
[[File:Ambari-UML.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;1. New class is added for both Web Socket client and Server.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;2. One method is added in the existing class &amp;quot;HeartBeatHandler&amp;quot; &amp;lt;/p&amp;gt;&lt;br /&gt;
'''WebSocketClient'''&lt;br /&gt;
&amp;lt;p&amp;gt;'''1. onOpen''': An event listener to be called when connection to server is established.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;'''2. onClose''': An event listener to be called when connection to server is closed.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;'''3. onText''': An event listener to be called when message is received from server.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;'''4. getLatch''':&amp;lt;/p&amp;gt; Method to get the CountDownLatch.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;'''5. sendMessage''': Method to send message to server&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''WebSocketServer'''&lt;br /&gt;
&amp;lt;p&amp;gt;'''1. onOpen''': An event listener to be called when connection has been opened.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;'''2. onClose''': An event listener to be called when connection has been closed&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;'''3. onMessage''': An event listener to be called when message is received .&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''HeartBeatHandler'''&lt;br /&gt;
&amp;lt;p&amp;gt;'''1. sendMessage''': Method to instantiate a WebSocketClient to send message to server.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Testing Framework'''==&lt;br /&gt;
&lt;br /&gt;
A popular mocking framework, [https://en.wikipedia.org/wiki/Mockito Mockito] is used to mock responses from dependent downstream services. A whole prototype of an in-memory cluster is also mocked using Mockito. Mocking frameworks let us have our test cases fast and independent, which is very well depicted in this project. &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Only the results/responses obtained from controller methods are asserted. We do not find any significant &amp;quot;verify / expect&amp;quot; calls. (&amp;quot;verify/expect&amp;quot; calls are used to assert if a given method was invoked during the test method execution). Hence, tests are implemented in a result-oriented way and are not bound to the method implementation in anyway.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==='''Test cases'''===&lt;br /&gt;
Following is a brief overview of the test cases that we look to add in the Ambari project to test out our functionality:&lt;br /&gt;
&lt;br /&gt;
1. Testing if the websocket response to Ambari Web is triggered when a Heartbeat is received and persisted in the backend PostgreSQL DB.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
2. Mocking an agent Heartbeat and asserting that the same status is reflected on the front-end Ambari Web.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
3. Verifying the correctness of websocket behavior for agent Heartbeats received with different contents. We could have Heartbeats having a variety of data such as node status, component's status on a node, volume of requests processed over a past time period on a node etc.&lt;br /&gt;
&lt;br /&gt;
=='''Steps to build and test Ambari-WebSocket'''==&lt;br /&gt;
1. Clone the repository to your local system&amp;lt;br&amp;gt;&lt;br /&gt;
   git clone https://github.com/nisarg64/ambari&lt;br /&gt;
&lt;br /&gt;
2. Got to ambari directory and checkout the branch &amp;quot;migration&amp;quot; using below command&amp;lt;br&amp;gt;&lt;br /&gt;
   git checkout migration&lt;br /&gt;
&lt;br /&gt;
3. You will need nodeJs, maven etc to build the ambari. Check the requirements as described in [https://cwiki.apache.org/confluence/display/AMBARI/Ambari+Development Ambari PreConfigs]&lt;br /&gt;
&lt;br /&gt;
4. After having the required configurations, run below command to build &amp;lt;br&amp;gt;&lt;br /&gt;
   mvn clean package -DskipTests -Drat.ignoreErrors=true&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Project Benefits and Challenges'''==&lt;br /&gt;
'''Benefits:'''&lt;br /&gt;
&amp;lt;p&amp;gt;1. Web Socket will allow Ambari-Server to perform robustly in a large cluster setup with multiple browser sessions and when continuous heavy requests are being made&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Challenges:'''&lt;br /&gt;
&amp;lt;p&amp;gt;1. Ambari server uses [https://en.wikipedia.org/wiki/Jetty_%28web_server%29 Jetty] 8.x version, while support for Web Socket was made available after [https://en.wikipedia.org/wiki/Jetty_%28web_server%29 Jetty] 9.x&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;2. Ambari has a huge codebase with multiple modules and multiple frameworks and design patterns adopted. Understanding the flow of the project and taking care of dependencies is a huge challenge.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;3. For testing the code requires a cluster of around 3 nodes. Running 3 virtual machines requires a high performance machine.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Learning Outcomes'''==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;1. We also noticed in one of the classes called HeartBeatHandler, that it obeys the [https://en.wikipedia.org/wiki/Law_of_Demeter Law of Demeter].&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;2. For testing, project using the [https://en.wikipedia.org/wiki/Mockito Mockito] framework to mock the heartbeat and cluster functionality.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;3. For configuration management, [https://en.wikipedia.org/wiki/Puppet_%28software%29 Puppet] configuration management tool is used.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;4. Ambari-Web is implemented in [https://en.wikipedia.org/wiki/Ember.js Ember.js] which is an open-source Javascript framework that follows [https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller MVC] pattern similar to Rails framework.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;5. Ambari-server uses [https://en.wikipedia.org/wiki/Jetty_%28web_server%29 Jetty] which is a web-server to handle all the HTTP requests made onto the ambari-server from the UI.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Github Location'''==&lt;br /&gt;
 [https://github.com/apache/ambari Ambari Project]&lt;br /&gt;
&lt;br /&gt;
Forked Repository:&lt;br /&gt;
 [https://github.com/nisarg64/ambari Forked Repo]&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;p&amp;gt;https://ambari.apache.org/&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;https://en.wikipedia.org/wiki/Apache_Ambari&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;https://cwiki.apache.org/confluence/display/AMBARI/Ambari&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;https://issues.apache.org/jira/secure/attachment/12559939/Ambari_Architecture.pdf&amp;lt;/p&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rpsingh3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_A1550_Web_Socket_Implementation_in_Apache_Ambari&amp;diff=99903</id>
		<title>CSC/ECE 517 Fall 2015 A1550 Web Socket Implementation in Apache Ambari</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_A1550_Web_Socket_Implementation_in_Apache_Ambari&amp;diff=99903"/>
		<updated>2015-11-14T04:17:20Z</updated>

		<summary type="html">&lt;p&gt;Rpsingh3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction'''==&lt;br /&gt;
&lt;br /&gt;
Apache Ambari is a software project of the [https://en.wikipedia.org/wiki/Apache_Software_Foundation Apache Software Foundation], aimed at making [https://en.wikipedia.org/wiki/Apache_Hadoop Hadoop] management simpler by developing software for provisioning, managing, and monitoring Apache Hadoop clusters. Ambari provides an intuitive, easy-to-use [https://en.wikipedia.org/wiki/Apache_Hadoop Hadoop] management web UI backed by its [https://en.wikipedia.org/wiki/Representational_state_transfer RESTful] APIs. Ambari was a sub-project of [https://en.wikipedia.org/wiki/Apache_Hadoop Hadoop] but is now a [https://en.wikipedia.org/wiki/Apache_Software_Foundation#Projects top-level] project in its own right.&lt;br /&gt;
&lt;br /&gt;
An Apache Hadoop cluster consists on a group or nodes/machines. Each node acts as an Ambari Agent that runs various service components (e.g. DataNode for HDFS). One of the agents acts as an Ambari Server that takes care of the task allocation, management, gathering information about the services status and other information from the agents and giving the information to Ambari UI for display. More information about Agent-Server-Web flow is available in the following sections.&lt;br /&gt;
&lt;br /&gt;
Ambari-Web uses simple ajax polling mechanism to fetch data from Ambari-Server. Constant polling is done to show current service status, alerts, service graphs, etc on Ambari-Web. With this mechanism, the performance of Ambari-Server can be affected on a large size cluster with multiple active browser sessions due to continuous heavy requests being made. &lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/WebSocket WebSocket] is a protocol providing full-duplex communication channels over a single TCP connection. Implementing Web-Socket between Ambari-Web and Ambari-Server will be helpful to address this scenario.&lt;br /&gt;
&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;font color = &amp;quot;red&amp;quot;&amp;gt; Note: This is continuation of our OSS project &amp;lt;/font&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==='''Project Goals'''===&lt;br /&gt;
&amp;lt;p&amp;gt;1. Understand architecture of Ambari-Server and Ambari-Web&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;2. Replace the current [https://en.wikipedia.org/wiki/Polling_(computer_science) polling mechanism] with the push-based mechanism via Web-Socket&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;3. Write test cases for the Web Socket implementation to test the functionalities of WebSocket Client and WebSocket Server&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==='''Project Design'''===&lt;br /&gt;
Ambari is a multi-module Maven project. The relevant modules for our project from an implementation perspective are Ambari Web and Ambari Server. Ambari Agent is another module, important functionally.&lt;br /&gt;
&lt;br /&gt;
===='''Major Components'''====&lt;br /&gt;
&amp;lt;b&amp;gt;Ambari Agent &amp;lt;/b&amp;gt; is a component that resides on every node of the cluster. Its responsibility is to collect the node's overall health which comprises of the health metrics of all the different services running on that node. Ambari Agent sends these statuses to the Ambari Server in the form of periodic messages which is termed as 'Heartbeat' in the Ambari nomenclature. In return, Ambari agents receive Heartbeat responses from Ambari Server. Hearbeat responses could contain commands for the agent to perform.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Ambari Web &amp;lt;/b&amp;gt; presents a user interface to monitor and manage a Hadoop cluster. Web module is written in JavaScript using Ember.js framework. During our code study, we observed this module following the [https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller MVC] design methodology. The whole motivation of this module is to make it convenient to the end-user to manage the concerned Hadoop cluster.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Ambari Server &amp;lt;/b&amp;gt; is the most central component of an Ambari ecosystem. Ambari Server exposes [https://en.wikipedia.org/wiki/Application_programming_interface APIs]] to its clients such as Ambari Web, which monitors health of a cluster. Ambari Server clients can query for node health statuses. Ambari Server persists the nodes' statuses in a [https://en.wikipedia.org/wiki/PostgreSQL PostgreSQL] database in the backend. Internally, Ambari Server has several components which help it to manage its responsibilities. Ambari Server's important responsibilities are as follows:&lt;br /&gt;
&amp;lt;p&amp;gt; 1. Collect health statuses ( Heartbeats ) from Ambari agents. Process their statuses and send Heartbeat responses to Ambari agents. &amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt; 2. Handle requests from Ambari Server's clients: One such use case is installing a new service on an Ambari agent. This request could be received from Ambari Web and it is the server's responsibility to send appropriate instructions to the particular agent to get the new service up and running on the agent. &amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===='''Architectural design of WebSocket client-server in Apache Ambari'''====&lt;br /&gt;
[[File:Ambari-WebServerClient.png]]&lt;br /&gt;
&lt;br /&gt;
===='''Flow Diagram'''====&lt;br /&gt;
[[File:Ambari-Flow.png]]&lt;br /&gt;
&lt;br /&gt;
==='''Implementation'''===&lt;br /&gt;
===='''Design Pattern'''====&lt;br /&gt;
We have observed that Ambari project adopts various design patterns like [https://en.wikipedia.org/wiki/Singleton_pattern Singleton Pattern] in the Data Access Object Classes. For this project, we will be using [https://en.wikipedia.org/wiki/Request%E2%80%93response request-response], one of the [https://en.wikipedia.org/wiki/Messaging_pattern Messaging Pattern].&lt;br /&gt;
&lt;br /&gt;
Request–response is a message exchange pattern in which a requestor sends a request message to a replier system which receives and processes the request, ultimately returning a message in response. This is a simple, but powerful messaging pattern which allows two applications to have a two-way conversation with one another over a channel. In our project, Ambari-Server's HeartBeat handler acts as a requestor which sends the message to Ambari UI via WebSocket protocol. In response, Ambari UI acknowledges the received information and sends new requests if any to the Ambari-Server. Moreover, same messaging pattern is followed for bidirectional communication between Ambari-Agent and Ambari-Server.&lt;br /&gt;
&lt;br /&gt;
===='''UML Diagrams'''====&lt;br /&gt;
====='''Class Diagram'''=====&lt;br /&gt;
[[File:Ambari-UML.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;1. New class is added for both Web Socket client and Server.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;2. One method is added in the existing class &amp;quot;HeartBeatHandler&amp;quot; &amp;lt;/p&amp;gt;&lt;br /&gt;
'''WebSocketClient'''&lt;br /&gt;
&amp;lt;p&amp;gt;'''1. onOpen''': An event listener to be called when connection to server is established.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;'''2. onClose''': An event listener to be called when connection to server is closed.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;'''3. onText''': An event listener to be called when message is received from server.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;'''4. getLatch''':&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;'''5. sendMessage''': Method to send message to server&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''WebSocketServer'''&lt;br /&gt;
&amp;lt;p&amp;gt;'''1. onOpen''': An event listener to be called when connection has been opened.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;'''2. onClose''': An event listener to be called when connection has been closed&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;'''3. onMessage''': An event listener to be called when message is received .&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''HeartBeatHandler'''&lt;br /&gt;
&amp;lt;p&amp;gt;'''1. sendMessage''': Method to instantiate a WebSocketClient to send message to server.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Testing Framework'''==&lt;br /&gt;
&lt;br /&gt;
A popular mocking framework, [https://en.wikipedia.org/wiki/Mockito Mockito] is used to mock responses from dependent downstream services. A whole prototype of an in-memory cluster is also mocked using Mockito. Mocking frameworks let us have our test cases fast and independent, which is very well depicted in this project. &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Only the results/responses obtained from controller methods are asserted. We do not find any significant &amp;quot;verify / expect&amp;quot; calls. (&amp;quot;verify/expect&amp;quot; calls are used to assert if a given method was invoked during the test method execution). Hence, tests are implemented in a result-oriented way and are not bound to the method implementation in anyway.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==='''Test cases'''===&lt;br /&gt;
Following is a brief overview of the test cases that we look to add in the Ambari project to test out our functionality:&lt;br /&gt;
&lt;br /&gt;
1. Testing if the websocket response to Ambari Web is triggered when a Heartbeat is received and persisted in the backend PostgreSQL DB.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
2. Mocking an agent Heartbeat and asserting that the same status is reflected on the front-end Ambari Web.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
3. Verifying the correctness of websocket behavior for agent Heartbeats received with different contents. We could have Heartbeats having a variety of data such as node status, component's status on a node, volume of requests processed over a past time period on a node etc.&lt;br /&gt;
&lt;br /&gt;
=='''Steps to build and test Ambari-WebSocket'''==&lt;br /&gt;
1. Clone the repository to your local system&amp;lt;br&amp;gt;&lt;br /&gt;
   git clone https://github.com/nisarg64/ambari&lt;br /&gt;
&lt;br /&gt;
2. Got to ambari directory and checkout the branch &amp;quot;migration&amp;quot; using below command&amp;lt;br&amp;gt;&lt;br /&gt;
   git checkout migration&lt;br /&gt;
&lt;br /&gt;
3. You will need nodeJs, maven etc to build the ambari. Check the requirements as described in [https://cwiki.apache.org/confluence/display/AMBARI/Ambari+Development Ambari PreConfigs]&lt;br /&gt;
&lt;br /&gt;
4. After having the required configurations, run below command to build &amp;lt;br&amp;gt;&lt;br /&gt;
   mvn clean package -DskipTests -Drat.ignoreErrors=true&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Project Benefits and Challenges'''==&lt;br /&gt;
'''Benefits:'''&lt;br /&gt;
&amp;lt;p&amp;gt;1. Web Socket will allow Ambari-Server to perform robustly in a large cluster setup with multiple browser sessions and when continuous heavy requests are being made&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Challenges:'''&lt;br /&gt;
&amp;lt;p&amp;gt;1. Ambari server uses [https://en.wikipedia.org/wiki/Jetty_%28web_server%29 Jetty] 8.x version, while support for Web Socket was made available after [https://en.wikipedia.org/wiki/Jetty_%28web_server%29 Jetty] 9.x&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;2. Ambari has a huge codebase with multiple modules and multiple frameworks and design patterns adopted. Understanding the flow of the project and taking care of dependencies is a huge challenge.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;3. For testing the code requires a cluster of around 3 nodes. Running 3 virtual machines requires a high performance machine.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Learning Outcomes'''==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;1. We also noticed in one of the classes called HeartBeatHandler, that it obeys the [https://en.wikipedia.org/wiki/Law_of_Demeter Law of Demeter].&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;2. For testing, project using the [https://en.wikipedia.org/wiki/Mockito Mockito] framework to mock the heartbeat and cluster functionality.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;3. For configuration management, [https://en.wikipedia.org/wiki/Puppet_%28software%29 Puppet] configuration management tool is used.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;4. Ambari-Web is implemented in [https://en.wikipedia.org/wiki/Ember.js Ember.js] which is an open-source Javascript framework that follows [https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller MVC] pattern similar to Rails framework.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;5. Ambari-server uses [https://en.wikipedia.org/wiki/Jetty_%28web_server%29 Jetty] which is a web-server to handle all the HTTP requests made onto the ambari-server from the UI.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Github Location'''==&lt;br /&gt;
 [https://github.com/apache/ambari Ambari Project]&lt;br /&gt;
&lt;br /&gt;
Forked Repository:&lt;br /&gt;
 [https://github.com/nisarg64/ambari Forked Repo]&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;p&amp;gt;https://ambari.apache.org/&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;https://en.wikipedia.org/wiki/Apache_Ambari&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;https://cwiki.apache.org/confluence/display/AMBARI/Ambari&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;https://issues.apache.org/jira/secure/attachment/12559939/Ambari_Architecture.pdf&amp;lt;/p&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rpsingh3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_A1550_Web_Socket_Implementation_in_Apache_Ambari&amp;diff=99901</id>
		<title>CSC/ECE 517 Fall 2015 A1550 Web Socket Implementation in Apache Ambari</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_A1550_Web_Socket_Implementation_in_Apache_Ambari&amp;diff=99901"/>
		<updated>2015-11-14T04:15:25Z</updated>

		<summary type="html">&lt;p&gt;Rpsingh3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction'''==&lt;br /&gt;
&lt;br /&gt;
Apache Ambari is a software project of the [https://en.wikipedia.org/wiki/Apache_Software_Foundation Apache Software Foundation], aimed at making [https://en.wikipedia.org/wiki/Apache_Hadoop Hadoop] management simpler by developing software for provisioning, managing, and monitoring Apache Hadoop clusters. Ambari provides an intuitive, easy-to-use [https://en.wikipedia.org/wiki/Apache_Hadoop Hadoop] management web UI backed by its [https://en.wikipedia.org/wiki/Representational_state_transfer RESTful] APIs. Ambari was a sub-project of [https://en.wikipedia.org/wiki/Apache_Hadoop Hadoop] but is now a [https://en.wikipedia.org/wiki/Apache_Software_Foundation#Projects top-level] project in its own right.&lt;br /&gt;
&lt;br /&gt;
An Apache Hadoop cluster consists on a group or nodes/machines. Each node acts as an Ambari Agent that runs various service components (e.g. datanode for HDFS). One of the agents acts as an Ambari Server that takes care of the task allocation, management, gathering information about the services status and other information from the agents and giving the information to Ambari UI for display. More information about Agent-Server-Web flow is available in the following sections.&lt;br /&gt;
&lt;br /&gt;
Ambari-Web uses simple ajax polling mechanism to fetch data from Ambari-Server. Constant polling is done to show current service status, alerts, service graphs, etc on Ambari-Web. With this mechanism, the performance of Ambari-Server can be affected on a large size cluster with multiple active browser sessions due to continuous heavy requests being made. &lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/WebSocket WebSocket] is a protocol providing full-duplex communication channels over a single TCP connection. Implementing Web-Socket between Ambari-Web and Ambari-Server will be helpful to address this scenario.&lt;br /&gt;
&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;font color = &amp;quot;red&amp;quot;&amp;gt; Note: This is continuation of our OSS project &amp;lt;/font&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==='''Project Goals'''===&lt;br /&gt;
&amp;lt;p&amp;gt;1. Understand architecture of Ambari-Server and Ambari-Web&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;2. Replace the current [https://en.wikipedia.org/wiki/Polling_(computer_science) polling mechanism] with the push-based mechanism via Web-Socket&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;3. Write test cases for the Web Socket implementation to test the functionalities of WebSocket Client and WebSocket Server&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==='''Project Design'''===&lt;br /&gt;
Ambari is a multi-module Maven project. The relevant modules for our project from an implementation perspective are Ambari Web and Ambari Server. Ambari Agent is another module, important functionally.&lt;br /&gt;
&lt;br /&gt;
===='''Major Components'''====&lt;br /&gt;
&amp;lt;b&amp;gt;Ambari Agent &amp;lt;/b&amp;gt; is a component that resides on every node of the cluster. Its responsibility is to collect the node's overall health which comprises of the health metrics of all the different services running on that node. Ambari Agent sends these statuses to the Ambari Server in the form of periodic messages which is termed as 'Heartbeat' in the Ambari nomenclature. In return, Ambari agents receive Heartbeat responses from Ambari Server. Hearbeat responses could contain commands for the agent to perform.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Ambari Web &amp;lt;/b&amp;gt; presents a user interface to monitor and manage a Hadoop cluster. Web module is written in JavaScript using Ember.js framework. During our code study, we observed this module following the [https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller MVC] design methodology. The whole motivation of this module is to make it convenient to the end-user to manage the concerned Hadoop cluster.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Ambari Server &amp;lt;/b&amp;gt; is the most central component of an Ambari ecosystem. Ambari Server exposes [https://en.wikipedia.org/wiki/Application_programming_interface APIs]] to its clients such as Ambari Web, which monitors health of a cluster. Ambari Server clients can query for node health statuses. Ambari Server persists the nodes' statuses in a [https://en.wikipedia.org/wiki/PostgreSQL PostgreSQL] database in the backend. Internally, Ambari Server has several components which help it to manage its responsibilities. Ambari Server's important responsibilities are as follows:&lt;br /&gt;
&amp;lt;p&amp;gt; 1. Collect health statuses ( Heartbeats ) from Ambari agents. Process their statuses and send Heartbeat responses to Ambari agents. &amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt; 2. Handle requests from Ambari Server's clients: One such use case is installing a new service on an Ambari agent. This request could be received from Ambari Web and it is the server's responsibility to send appropriate instructions to the particular agent to get the new service up and running on the agent. &amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===='''Architectural design of WebSocket client-server in Apache Ambari'''====&lt;br /&gt;
[[File:Ambari-WebServerClient.png]]&lt;br /&gt;
&lt;br /&gt;
===='''Flow Diagram'''====&lt;br /&gt;
[[File:Ambari-Flow.png]]&lt;br /&gt;
&lt;br /&gt;
==='''Implementation'''===&lt;br /&gt;
===='''Design Pattern'''====&lt;br /&gt;
We have observed that Ambari project adopts various design patterns like [https://en.wikipedia.org/wiki/Singleton_pattern Singleton Pattern] in the Data Access Object Classes. For this project, we will be using [https://en.wikipedia.org/wiki/Request%E2%80%93response request-response], one of the [https://en.wikipedia.org/wiki/Messaging_pattern Messaging Pattern].&lt;br /&gt;
&lt;br /&gt;
Request–response is a message exchange pattern in which a requestor sends a request message to a replier system which receives and processes the request, ultimately returning a message in response. This is a simple, but powerful messaging pattern which allows two applications to have a two-way conversation with one another over a channel. In our project, Ambari-Server's HeartBeat handler acts as a requestor which sends the message to Ambari UI via WebSocket protocol. In response, Ambari UI acknowledges the received information and sends new requests if any to the Ambari-Server. Moreover, same messaging pattern is followed for bidirectional communication between Ambari-Agent and Ambari-Server.&lt;br /&gt;
&lt;br /&gt;
===='''UML Diagrams'''====&lt;br /&gt;
====='''Class Diagram'''=====&lt;br /&gt;
[[File:Ambari-UML.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;1. New class is added for both Web Socket client and Server.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;2. One method is added in the existing class &amp;quot;HeartBeatHandler&amp;quot; &amp;lt;/p&amp;gt;&lt;br /&gt;
'''WebSocketClient'''&lt;br /&gt;
&amp;lt;p&amp;gt;'''1. onOpen''': An event listener to be called when connection to server is established.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;'''2. onClose''': An event listener to be called when connection to server is closed.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;'''3. onText''': An event listener to be called when message is received from server.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;'''4. getLatch''':&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;'''5. sendMessage''': Method to send message to server&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''WebSocketServer'''&lt;br /&gt;
&amp;lt;p&amp;gt;'''1. onOpen''': An event listener to be called when connection has been opened.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;'''2. onClose''': An event listener to be called when connection has been closed&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;'''3. onMessage''': An event listener to be called when message is received .&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''HeartBeatHandler'''&lt;br /&gt;
&amp;lt;p&amp;gt;'''1. sendMessage''': Method to instantiate a WebSocketClient to send message to server.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Testing Framework'''==&lt;br /&gt;
&lt;br /&gt;
A popular mocking framework, [https://en.wikipedia.org/wiki/Mockito Mockito] is used to mock responses from dependent downstream services. A whole prototype of an in-memory cluster is also mocked using Mockito. Mocking frameworks let us have our test cases fast and independent, which is very well depicted in this project. &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Only the results/responses obtained from controller methods are asserted. We do not find any significant &amp;quot;verify / expect&amp;quot; calls. (&amp;quot;verify/expect&amp;quot; calls are used to assert if a given method was invoked during the test method execution). Hence, tests are implemented in a result-oriented way and are not bound to the method implementation in anyway.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==='''Test cases'''===&lt;br /&gt;
Following is a brief overview of the test cases that we look to add in the Ambari project to test out our functionality:&lt;br /&gt;
&lt;br /&gt;
1. Testing if the websocket response to Ambari Web is triggered when a Heartbeat is received and persisted in the backend PostgreSQL DB.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
2. Mocking an agent Heartbeat and asserting that the same status is reflected on the front-end Ambari Web.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
3. Verifying the correctness of websocket behavior for agent Heartbeats received with different contents. We could have Heartbeats having a variety of data such as node status, component's status on a node, volume of requests processed over a past time period on a node etc.&lt;br /&gt;
&lt;br /&gt;
=='''Steps to build and test Ambari-WebSocket'''==&lt;br /&gt;
1. Clone the repository to your local system&amp;lt;br&amp;gt;&lt;br /&gt;
   git clone https://github.com/nisarg64/ambari&lt;br /&gt;
&lt;br /&gt;
2. Got to ambari directory and checkout the branch &amp;quot;migration&amp;quot; using below command&amp;lt;br&amp;gt;&lt;br /&gt;
   git checkout migration&lt;br /&gt;
&lt;br /&gt;
3. You will need nodeJs, maven etc to build the ambari. Check the requirements as described in [https://cwiki.apache.org/confluence/display/AMBARI/Ambari+Development Ambari PreConfigs]&lt;br /&gt;
&lt;br /&gt;
4. After having the required configurations, run below command to build &amp;lt;br&amp;gt;&lt;br /&gt;
   mvn clean package -DskipTests -Drat.ignoreErrors=true&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Project Benefits and Challenges'''==&lt;br /&gt;
'''Benefits:'''&lt;br /&gt;
&amp;lt;p&amp;gt;1. Web Socket will allow Ambari-Server to perform robustly in a large cluster setup with multiple browser sessions and when continuous heavy requests are being made&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Challenges:'''&lt;br /&gt;
&amp;lt;p&amp;gt;1. Ambari server uses [https://en.wikipedia.org/wiki/Jetty_%28web_server%29 Jetty] 8.x version, while support for Web Socket was made available after [https://en.wikipedia.org/wiki/Jetty_%28web_server%29 Jetty] 9.x&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;2. Ambari has a huge codebase with multiple modules and multiple frameworks and design patterns adopted. Understanding the flow of the project and taking care of dependencies is a huge challenge.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;3. For testing the code requires a cluster of around 3 nodes. Running 3 virtual machines requires a high performance machine.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Learning Outcomes'''==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;1. We also noticed in one of the classes called HeartBeatHandler, that it obeys the [https://en.wikipedia.org/wiki/Law_of_Demeter Law of Demeter].&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;2. For testing, project using the [https://en.wikipedia.org/wiki/Mockito Mockito] framework to mock the heartbeat and cluster functionality.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;3. For configuration management, [https://en.wikipedia.org/wiki/Puppet_%28software%29 Puppet] configuration management tool is used.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;4. Ambari-Web is implemented in [https://en.wikipedia.org/wiki/Ember.js Ember.js] which is an open-source Javascript framework that follows [https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller MVC] pattern similar to Rails framework.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;5. Ambari-server uses [https://en.wikipedia.org/wiki/Jetty_%28web_server%29 Jetty] which is a web-server to handle all the HTTP requests made onto the ambari-server from the UI.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Github Location'''==&lt;br /&gt;
 [https://github.com/apache/ambari Ambari Project]&lt;br /&gt;
&lt;br /&gt;
Forked Repository:&lt;br /&gt;
 [https://github.com/nisarg64/ambari Forked Repo]&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;p&amp;gt;https://ambari.apache.org/&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;https://en.wikipedia.org/wiki/Apache_Ambari&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;https://cwiki.apache.org/confluence/display/AMBARI/Ambari&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;https://issues.apache.org/jira/secure/attachment/12559939/Ambari_Architecture.pdf&amp;lt;/p&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rpsingh3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_A1550_Web_Socket_Implementation_in_Apache_Ambari&amp;diff=99898</id>
		<title>CSC/ECE 517 Fall 2015 A1550 Web Socket Implementation in Apache Ambari</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_A1550_Web_Socket_Implementation_in_Apache_Ambari&amp;diff=99898"/>
		<updated>2015-11-14T04:13:41Z</updated>

		<summary type="html">&lt;p&gt;Rpsingh3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction'''==&lt;br /&gt;
&lt;br /&gt;
Apache Ambari is a software project of the [https://en.wikipedia.org/wiki/Apache_Software_Foundation Apache Software Foundation], aimed at making [https://en.wikipedia.org/wiki/Apache_Hadoop Hadoop] management simpler by developing software for provisioning, managing, and monitoring Apache Hadoop clusters. Ambari provides an intuitive, easy-to-use [https://en.wikipedia.org/wiki/Apache_Hadoop Hadoop] management web UI backed by its [https://en.wikipedia.org/wiki/Representational_state_transfer RESTful] APIs. Ambari was a sub-project of [https://en.wikipedia.org/wiki/Apache_Hadoop Hadoop] but is now a [https://en.wikipedia.org/wiki/Apache_Software_Foundation#Projects top-level] project in its own right.&lt;br /&gt;
&lt;br /&gt;
An Apache Hadoop cluster consists on a group or nodes/machines. Each node acts as an Ambari Agent that runs various service components (e.g. datanode for HDFS). One of the agents acts as an Ambari Server that takes care of the task allocation, management, gathering information about the services status and other information from the agents and giving the information to Ambari UI for display. More information about Agent-Server-Web flow is available in the following sections.&lt;br /&gt;
&lt;br /&gt;
Ambari-Web uses simple ajax polling mechanism to fetch data from Ambari-Server. Constant polling is done to show current service status, alerts, service graphs, etc on Ambari-Web. With this mechanism, the performance of Ambari-Server can be affected on a large size cluster with multiple active browser sessions due to continuous heavy requests being made. &lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/WebSocket WebSocket] is a protocol providing full-duplex communication channels over a single TCP connection. Implementing Web-Socket between Ambari-Web and Ambari-Server will be helpful to address this scenario.&lt;br /&gt;
&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;font color = &amp;quot;red&amp;quot;&amp;gt; Note: This is continuation of our OSS project &amp;lt;/font&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==='''Project Goals'''===&lt;br /&gt;
&amp;lt;p&amp;gt;1. Understand architecture of Ambari-Server and Ambari-Web&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;2. Replace the current [https://en.wikipedia.org/wiki/Polling_(computer_science) polling mechanism] with the push-based mechanism via Web-Socket&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;3. Write test cases for the Web Socket implementation to test the functionalities of WebSocket Client and WebSocket Server&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==='''Project Design'''===&lt;br /&gt;
Ambari is a multi-module Maven project. The relevant modules for our project from an implementation perspective are Ambari Web and Ambari Server. Ambari Agent is another module, important functionally.&lt;br /&gt;
&lt;br /&gt;
===='''Major Components'''====&lt;br /&gt;
&amp;lt;b&amp;gt;Ambari Agent &amp;lt;/b&amp;gt; is a component that resides on every node of the cluster. Its responsibility is to collect the node's overall health which comprises of the health metrics of all the different services running on that node. Ambari Agent sends these statuses to the Ambari Server in the form of periodic messages which is termed as 'Heartbeat' in the Ambari nomenclature. In return, Ambari agents receive Heartbeat responses from Ambari Server. Hearbeat responses could contain commands for the agent to perform.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Ambari Web &amp;lt;/b&amp;gt; presents a user interface to monitor and manage a Hadoop cluster. Web module is written in JavaScript using Ember.js framework. During our code study, we observed this module following the [https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller MVC] design methodology. The whole motivation of this module is to make it convenient to the end-user to manage the concerned Hadoop cluster.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Ambari Server &amp;lt;/b&amp;gt; is the most central component of an Ambari ecosystem. Ambari Server exposes [https://en.wikipedia.org/wiki/Application_programming_interface APIs]] to its clients such as Ambari Web, which monitors health of a cluster. Ambari Server clients can query for node health statuses. Ambari Server persists the nodes' statuses in a [https://en.wikipedia.org/wiki/PostgreSQL PostgreSQL] database in the backend. Internally, Ambari Server has several components which help it to manage its responsibilities. Ambari Server's important responsibilities are as follows:&lt;br /&gt;
&amp;lt;p&amp;gt; 1. Collect health statuses ( Heartbeats ) from Ambari agents. Process their statuses and send Heartbeat responses to Ambari agents. &amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt; 2. Handle requests from Ambari Server's clients: One such use case is installing a new service on an Ambari agent. This request could be received from Ambari Web and it is the server's responsibility to send appropriate instructions to the particular agent to get the new service up and running on the agent. &amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===='''Architectural design of WebSocket client-server in Apache Ambari'''====&lt;br /&gt;
[[File:Ambari-WebServerClient.png]]&lt;br /&gt;
&lt;br /&gt;
===='''Flow Diagram'''====&lt;br /&gt;
[[File:Ambari-Flow.png]]&lt;br /&gt;
&lt;br /&gt;
==='''Implementation'''===&lt;br /&gt;
===='''Design Pattern'''====&lt;br /&gt;
We have observed that Ambari project adopts various design patterns like [https://en.wikipedia.org/wiki/Singleton_pattern Singleton Pattern] in the Data Access Object Classes. For this project, we will be using [https://en.wikipedia.org/wiki/Request%E2%80%93response request-response], one of the [https://en.wikipedia.org/wiki/Messaging_pattern Messaging Pattern].&lt;br /&gt;
&lt;br /&gt;
Request–response is a message exchange pattern in which a requestor sends a request message to a replier system which receives and processes the request, ultimately returning a message in response. This is a simple, but powerful messaging pattern which allows two applications to have a two-way conversation with one another over a channel. In our project, Ambari-Server's HeartBeat handler acts as a requestor which sends the message to Ambari UI via WebSocket protocol. In response, Ambari UI acknowledges the received information and sends new requests if any to the Ambari-Server. Moreover, same messaging pattern is followed for bidirectional communication between Ambari-Agent and Ambari-Server.&lt;br /&gt;
&lt;br /&gt;
===='''UML Diagrams'''====&lt;br /&gt;
====='''Class Diagram'''=====&lt;br /&gt;
[[File:Ambari-UML.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;1. New class is added for both Web Socket client and Server.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;2. One method is added in the existing class &amp;quot;HeartBeatHandler&amp;quot; &amp;lt;/p&amp;gt;&lt;br /&gt;
'''WebSocketClient'''&lt;br /&gt;
&amp;lt;p&amp;gt;'''1. onOpen''': An event listener to be called when connection to server is established.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;'''2. onClose''': An event listener to be called when connection to server is closed.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;'''3. onText''': An event listener to be called when message is received from server.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;'''4. getLatch''':&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;'''5. sendMessage''': Method to send message to server&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''WebSocketServer'''&lt;br /&gt;
&amp;lt;p&amp;gt;'''1. onOpen''': An event listener to be called when connection has been opened.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;'''2. onClose''': An event listener to be called when connection has been closed&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;'''3. onMessage''': An event listener to be called when message is received .&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''HeartBeatHandler'''&lt;br /&gt;
&amp;lt;p&amp;gt;'''1. sendMessage''': Method to instantiate a WebSocketClient to send message to server.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Testing Framework'''==&lt;br /&gt;
&lt;br /&gt;
A popular mocking framework, [https://en.wikipedia.org/wiki/Mockito Mockito] is used to mock responses from dependent downstream services. A whole prototype of an in-memory cluster is also mocked using Mockito. Mocking frameworks let us have our test cases fast and independent, which is very well depicted in this project. &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Only the results/responses obtained from controller methods are asserted. We do not find any significant &amp;quot;verify / expect&amp;quot; calls. (&amp;quot;verify/expect&amp;quot; calls are used to assert if a given method was invoked during the test method execution). Hence, tests are implemented in a result-oriented way and are not bound to the method implementation in anyway.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==='''Test cases'''===&lt;br /&gt;
Following is a brief overview of the test cases that we look to add in the Ambari project to test out our functionality:&lt;br /&gt;
&lt;br /&gt;
1. Testing if the websocket response to Ambari Web is triggered when a Heartbeat is received and persisted in the backend PostgreSQL DB.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
2. Mocking an agent Heartbeat and asserting that the same status is reflected on the front-end Ambari Web.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
3. Verifying the correctness of websocket behavior for agent Heartbeats received with different contents. We could have Heartbeats having a variety of data such as node status, component's status on a node, volume of requests processed over a past time period on a node etc.&lt;br /&gt;
&lt;br /&gt;
=='''Steps to build and test Ambari-WebSocket'''==&lt;br /&gt;
1. Clone the repository to your local system&amp;lt;br&amp;gt;&lt;br /&gt;
   git clone https://github.com/nisarg64/ambari&lt;br /&gt;
&lt;br /&gt;
2. Got to ambari directory and checkout the branch &amp;quot;migration&amp;quot; using below command&amp;lt;br&amp;gt;&lt;br /&gt;
   git checkout migration&lt;br /&gt;
&lt;br /&gt;
3. You will need nodeJs, maven etc to build the ambari. Check the requirements as described in [https://cwiki.apache.org/confluence/display/AMBARI/Ambari+Development Ambari PreConfigs]&lt;br /&gt;
&lt;br /&gt;
4. After having the required configurations, run below command to build &amp;lt;br&amp;gt;&lt;br /&gt;
   mvn clean package -DskipTests -Drat.ignoreErrors=true&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Project Benefits and Challenges'''==&lt;br /&gt;
'''Benefits:'''&lt;br /&gt;
&amp;lt;p&amp;gt;1. Web Socket will allow Ambari-Server to perform robustly in a large cluster setup with multiple browser sessions and when continuous heavy requests are being made&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Challenges:'''&lt;br /&gt;
&amp;lt;p&amp;gt;1. Ambari server uses [https://en.wikipedia.org/wiki/Jetty_%28web_server%29 Jetty] 8.x version, while support for Web Socket was made available after [https://en.wikipedia.org/wiki/Jetty_%28web_server%29 Jetty] 9.x&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;2. Ambari has a huge codebase with multiple modules and multiple frameworks and design patterns adopted. Understanding the flow of the project and taking care of dependencies is a huge challenge&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;3. For testing the code requires a cluster of around 3 nodes. Running 3 virtual machines requires a high performance machine.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Learning Outcomes'''==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;1. We also noticed in one of the classes called HeartBeatHandler, that it obeys the [https://en.wikipedia.org/wiki/Law_of_Demeter Law of Demeter]&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;2. For testing, project using the [https://en.wikipedia.org/wiki/Mockito Mockito] framework to mock the heartbeat and cluster functionality&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;3. For configuration management, [https://en.wikipedia.org/wiki/Puppet_%28software%29 Puppet] configuration management tool is used&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;4. Ambari-Web is implemented in [https://en.wikipedia.org/wiki/Ember.js Ember.js] which is an open-source Javascript framework that follows [https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller MVC] pattern similar to Rails framework.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;5. Ambari-server uses [https://en.wikipedia.org/wiki/Jetty_%28web_server%29 Jetty] which is a web-server to handle all the HTTP requests made onto the ambari-server from the UI&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Github Location'''==&lt;br /&gt;
 [https://github.com/apache/ambari Ambari Project]&lt;br /&gt;
&lt;br /&gt;
Forked Repository:&lt;br /&gt;
 [https://github.com/nisarg64/ambari Forked Repo]&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;p&amp;gt;https://ambari.apache.org/&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;https://en.wikipedia.org/wiki/Apache_Ambari&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;https://cwiki.apache.org/confluence/display/AMBARI/Ambari&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;https://issues.apache.org/jira/secure/attachment/12559939/Ambari_Architecture.pdf&amp;lt;/p&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rpsingh3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_A1550_Web_Socket_Implementation_in_Apache_Ambari&amp;diff=99897</id>
		<title>CSC/ECE 517 Fall 2015 A1550 Web Socket Implementation in Apache Ambari</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_A1550_Web_Socket_Implementation_in_Apache_Ambari&amp;diff=99897"/>
		<updated>2015-11-14T04:11:15Z</updated>

		<summary type="html">&lt;p&gt;Rpsingh3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction'''==&lt;br /&gt;
&lt;br /&gt;
Apache Ambari is a software project of the [https://en.wikipedia.org/wiki/Apache_Software_Foundation Apache Software Foundation], aimed at making [https://en.wikipedia.org/wiki/Apache_Hadoop Hadoop] management simpler by developing software for provisioning, managing, and monitoring Apache Hadoop clusters. Ambari provides an intuitive, easy-to-use [https://en.wikipedia.org/wiki/Apache_Hadoop Hadoop] management web UI backed by its [https://en.wikipedia.org/wiki/Representational_state_transfer RESTful] APIs. Ambari was a sub-project of [https://en.wikipedia.org/wiki/Apache_Hadoop Hadoop] but is now a [https://en.wikipedia.org/wiki/Apache_Software_Foundation#Projects top-level] project in its own right.&lt;br /&gt;
&lt;br /&gt;
An Apache Hadoop cluster consists on a group or nodes/machines. Each node acts as an Ambari Agent that runs various service components (e.g. datanode for HDFS). One of the agents acts as an Ambari Server that takes care of the task allocation, management, gathering information about the services status and other information from the agents and giving the information to Ambari UI for display. More information about Agent-Server-Web flow is available in the following sections.&lt;br /&gt;
&lt;br /&gt;
Ambari-Web uses simple ajax polling mechanism to fetch data from Ambari-Server. Constant polling is done to show current service status, alerts, service graphs, etc on Ambari-Web. With this mechanism, the performance of Ambari-Server can be affected on a large size cluster with multiple active browser sessions due to continuous heavy requests being made. &lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/WebSocket WebSocket] is a protocol providing full-duplex communication channels over a single TCP connection. Implementing Web-Socket between Ambari-Web and Ambari-Server will be helpful to address this scenario.&lt;br /&gt;
&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;font color = &amp;quot;red&amp;quot;&amp;gt; Note: This is continuation of our OSS project &amp;lt;/font&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==='''Project Goals'''===&lt;br /&gt;
&amp;lt;p&amp;gt;1. Understand architecture of Ambari-Server and Ambari-Web&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;2. Replace the current [https://en.wikipedia.org/wiki/Polling_(computer_science) polling mechanism] with the push-based mechanism via Web-Socket&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;3. Write test cases for the Web Socket implementation to test the functionalities of WebSocket Client and WebSocket Server&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==='''Project Design'''===&lt;br /&gt;
Ambari is a multi-module Maven project. The relevant modules for our project from an implementation perspective are Ambari Web and Ambari Server. Ambari Agent is another module, important functionally.&lt;br /&gt;
&lt;br /&gt;
===='''Major Components'''====&lt;br /&gt;
&amp;lt;b&amp;gt;Ambari Agent &amp;lt;/b&amp;gt; is a component that resides on every node of the cluster. Its responsibility is to collect the node's overall health which comprises of the health metrics of all the different services running on that node. Ambari Agent sends these statuses to the Ambari Server in the form of periodic messages which is termed as 'Heartbeat' in the Ambari nomenclature. In return, Ambari agents receive Heartbeat responses from Ambari Server. Hearbeat responses could contain commands for the agent to perform.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Ambari Web &amp;lt;/b&amp;gt; presents a user interface to monitor and manage a Hadoop cluster. Web module is written in JavaScript using Ember.js framework. During our code study, we observed this module following the [https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller MVC] design methodology. The whole motivation of this module is to make it convenient to the end-user to manage the concerned Hadoop cluster.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Ambari Server &amp;lt;/b&amp;gt; is the most central component of an Ambari ecosystem. Ambari Server exposes [https://en.wikipedia.org/wiki/Application_programming_interface APIs]] to its clients such as Ambari Web, which monitors health of a cluster. Ambari Server clients can query for node health statuses. Ambari Server persists the nodes' statuses in a [https://en.wikipedia.org/wiki/PostgreSQL PostgreSQL] database in the backend. Internally, Ambari Server has several components which help it to manage its responsibilities. Ambari Server's important responsibilities are as follows:&lt;br /&gt;
&amp;lt;p&amp;gt; 1. Collect health statuses ( Heartbeats ) from Ambari agents. Process their statuses and send Heartbeat responses to Ambari agents. &amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt; 2. Handle requests from Ambari Server's clients: One such use case is installing a new service on an Ambari agent. This request could be received from Ambari Web and it is the server's responsibility to send appropriate instructions to the particular agent to get the new service up and running on the agent. &amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===='''Architectural design of WebSocket client-server in Apache Ambari'''====&lt;br /&gt;
[[File:Ambari-WebServerClient.png]]&lt;br /&gt;
&lt;br /&gt;
===='''Flow Diagram'''====&lt;br /&gt;
[[File:Ambari-Flow.png]]&lt;br /&gt;
&lt;br /&gt;
==='''Implementation'''===&lt;br /&gt;
===='''Design Pattern'''====&lt;br /&gt;
We have observed that Ambari project adopts various design patterns like [https://en.wikipedia.org/wiki/Singleton_pattern Singleton Pattern] in the Data Access Object Classes. For this project, we will be using [https://en.wikipedia.org/wiki/Request%E2%80%93response request-response], one of the [https://en.wikipedia.org/wiki/Messaging_pattern Messaging Pattern].&lt;br /&gt;
&lt;br /&gt;
Request–response is a message exchange pattern in which a requestor sends a request message to a replier system which receives and processes the request, ultimately returning a message in response. This is a simple, but powerful messaging pattern which allows two applications to have a two-way conversation with one another over a channel. In our project, Ambari-Server's HeartBeat handler acts as a requestor which sends the message to Ambari UI via WebSocket protocol. In response, Ambari UI acknowledges the received information and sends new requests if any to the Ambari-Server. Moreover, same messaging pattern is followed for bidirectional communication between Ambari-Agent and Ambari-Server.&lt;br /&gt;
&lt;br /&gt;
===='''UML Diagrams'''====&lt;br /&gt;
====='''Class Diagram'''=====&lt;br /&gt;
[[File:Ambari-UML.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;1. New class is added for both Web Socket client and Server.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;2. One method is added in the existing class &amp;quot;HeartBeatHandler&amp;quot; &amp;lt;/p&amp;gt;&lt;br /&gt;
======'''WebSocketClient'''======&lt;br /&gt;
&amp;lt;p&amp;gt;'''1. onOpen''': An event listener to be called when connection to server is established.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;'''2. onClose''': An event listener to be called when connection to server is closed.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;'''3. onText''': An event listener to be called when message is received from server.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;'''4. getLatch''':&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;'''5. sendMessage''': Method to send message to server&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
======'''WebSocketServer'''======&lt;br /&gt;
&amp;lt;p&amp;gt;'''1. onOpen''': An event listener to be called when connection has been opened.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;'''2. onClose''': An event listener to be called when connection has been closed&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;'''3. onMessage''': An event listener to be called when message is received .&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
======'''HeartBeatHandler'''======&lt;br /&gt;
&amp;lt;p&amp;gt;'''1. sendMessage''': Method to instantiate a WebSocketClient to send message to server.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Testing Framework'''==&lt;br /&gt;
&lt;br /&gt;
A popular mocking framework, [https://en.wikipedia.org/wiki/Mockito Mockito] is used to mock responses from dependent downstream services. A whole prototype of an in-memory cluster is also mocked using Mockito. Mocking frameworks let us have our test cases fast and independent, which is very well depicted in this project. &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Only the results/responses obtained from controller methods are asserted. We do not find any significant &amp;quot;verify / expect&amp;quot; calls. (&amp;quot;verify/expect&amp;quot; calls are used to assert if a given method was invoked during the test method execution). Hence, tests are implemented in a result-oriented way and are not bound to the method implementation in anyway.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==='''Test cases'''===&lt;br /&gt;
Following is a brief overview of the test cases that we look to add in the Ambari project to test out our functionality:&lt;br /&gt;
&lt;br /&gt;
1. Testing if the websocket response to Ambari Web is triggered when a Heartbeat is received and persisted in the backend PostgreSQL DB.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
2. Mocking an agent Heartbeat and asserting that the same status is reflected on the front-end Ambari Web.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
3. Verifying the correctness of websocket behavior for agent Heartbeats received with different contents. We could have Heartbeats having a variety of data such as node status, component's status on a node, volume of requests processed over a past time period on a node etc.&lt;br /&gt;
&lt;br /&gt;
=='''Steps to build and test Ambari-WebSocket'''==&lt;br /&gt;
1. Clone the repository to your local system&amp;lt;br&amp;gt;&lt;br /&gt;
   git clone https://github.com/nisarg64/ambari&lt;br /&gt;
&lt;br /&gt;
2. Got to ambari directory and checkout the branch &amp;quot;migration&amp;quot; using below command&amp;lt;br&amp;gt;&lt;br /&gt;
   git checkout migration&lt;br /&gt;
&lt;br /&gt;
3. You will need nodeJs, maven etc to build the ambari. Check the requirements as described in [https://cwiki.apache.org/confluence/display/AMBARI/Ambari+Development Ambari PreConfigs]&lt;br /&gt;
&lt;br /&gt;
4. After having the required configurations, run below command to build &amp;lt;br&amp;gt;&lt;br /&gt;
   mvn clean package -DskipTests -Drat.ignoreErrors=true&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Project Benefits and Challenges'''==&lt;br /&gt;
'''Benefits:'''&lt;br /&gt;
&amp;lt;p&amp;gt;1. Web Socket will allow Ambari-Server to perform robustly in a large cluster setup with multiple browser sessions and when continuous heavy requests are being made&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Challenges:'''&lt;br /&gt;
&amp;lt;p&amp;gt;1. Ambari server uses [https://en.wikipedia.org/wiki/Jetty_%28web_server%29 Jetty] 8.x version, while support for Web Socket was made available after [https://en.wikipedia.org/wiki/Jetty_%28web_server%29 Jetty] 9.x&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;2. Ambari has a huge codebase with multiple modules and multiple frameworks and design patterns adopted. Understanding the flow of the project and taking care of dependencies is a huge challenge&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;3. For testing the code requires a cluster of around 3 nodes. Running 3 virtual machines requires a high performance machine.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Learning Outcomes'''==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;1. We also noticed in one of the classes called HeartBeatHandler, that it obeys the [https://en.wikipedia.org/wiki/Law_of_Demeter Law of Demeter]&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;2. For testing, project using the [https://en.wikipedia.org/wiki/Mockito Mockito] framework to mock the heartbeat and cluster functionality&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;3. For configuration management, [https://en.wikipedia.org/wiki/Puppet_%28software%29 Puppet] configuration management tool is used&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;4. Ambari-Web is implemented in [https://en.wikipedia.org/wiki/Ember.js Ember.js] which is an open-source Javascript framework that follows [https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller MVC] pattern similar to Rails framework.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;5. Ambari-server uses [https://en.wikipedia.org/wiki/Jetty_%28web_server%29 Jetty] which is a web-server to handle all the HTTP requests made onto the ambari-server from the UI&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Github Location'''==&lt;br /&gt;
 [https://github.com/apache/ambari Ambari Project]&lt;br /&gt;
&lt;br /&gt;
Forked Repository:&lt;br /&gt;
 [https://github.com/nisarg64/ambari Forked Repo]&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;p&amp;gt;https://ambari.apache.org/&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;https://en.wikipedia.org/wiki/Apache_Ambari&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;https://cwiki.apache.org/confluence/display/AMBARI/Ambari&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;https://issues.apache.org/jira/secure/attachment/12559939/Ambari_Architecture.pdf&amp;lt;/p&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rpsingh3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_A1550_Web_Socket_Implementation_in_Apache_Ambari&amp;diff=99896</id>
		<title>CSC/ECE 517 Fall 2015 A1550 Web Socket Implementation in Apache Ambari</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_A1550_Web_Socket_Implementation_in_Apache_Ambari&amp;diff=99896"/>
		<updated>2015-11-14T04:10:40Z</updated>

		<summary type="html">&lt;p&gt;Rpsingh3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction'''==&lt;br /&gt;
&lt;br /&gt;
Apache Ambari is a software project of the [https://en.wikipedia.org/wiki/Apache_Software_Foundation Apache Software Foundation], aimed at making [https://en.wikipedia.org/wiki/Apache_Hadoop Hadoop] management simpler by developing software for provisioning, managing, and monitoring Apache Hadoop clusters. Ambari provides an intuitive, easy-to-use [https://en.wikipedia.org/wiki/Apache_Hadoop Hadoop] management web UI backed by its [https://en.wikipedia.org/wiki/Representational_state_transfer RESTful] APIs. Ambari was a sub-project of [https://en.wikipedia.org/wiki/Apache_Hadoop Hadoop] but is now a [https://en.wikipedia.org/wiki/Apache_Software_Foundation#Projects top-level] project in its own right.&lt;br /&gt;
&lt;br /&gt;
An Apache Hadoop cluster consists on a group or nodes/machines. Each node acts as an Ambari Agent that runs various service components (e.g. datanode for HDFS). One of the agents acts as an Ambari Server that takes care of the task allocation, management, gathering information about the services status and other information from the agents and giving the information to Ambari UI for display. More information about Agent-Server-Web flow is available in the following sections.&lt;br /&gt;
&lt;br /&gt;
Ambari-Web uses simple ajax polling mechanism to fetch data from Ambari-Server. Constant polling is done to show current service status, alerts, service graphs, etc on Ambari-Web. With this mechanism, the performance of Ambari-Server can be affected on a large size cluster with multiple active browser sessions due to continuous heavy requests being made. &lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/WebSocket WebSocket] is a protocol providing full-duplex communication channels over a single TCP connection. Implementing Web-Socket between Ambari-Web and Ambari-Server will be helpful to address this scenario.&lt;br /&gt;
&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;font color = &amp;quot;red&amp;quot;&amp;gt; Note: This is continuation of our OSS project &amp;lt;/font&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==='''Project Goals'''===&lt;br /&gt;
&amp;lt;p&amp;gt;1. Understand architecture of Ambari-Server and Ambari-Web&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;2. Replace the current [https://en.wikipedia.org/wiki/Polling_(computer_science) polling mechanism] with the push-based mechanism via Web-Socket&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;3. Write test cases for the Web Socket implementation to test the functionalities of WebSocket Client and WebSocket Server&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==='''Project Design'''===&lt;br /&gt;
Ambari is a multi-module Maven project. The relevant modules for our project from an implementation perspective are Ambari Web and Ambari Server. Ambari Agent is another module, important functionally.&lt;br /&gt;
&lt;br /&gt;
===='''Major Components'''====&lt;br /&gt;
&amp;lt;b&amp;gt;Ambari Agent &amp;lt;/b&amp;gt; is a component that resides on every node of the cluster. Its responsibility is to collect the node's overall health which comprises of the health metrics of all the different services running on that node. Ambari Agent sends these statuses to the Ambari Server in the form of periodic messages which is termed as 'Heartbeat' in the Ambari nomenclature. In return, Ambari agents receive Heartbeat responses from Ambari Server. Hearbeat responses could contain commands for the agent to perform.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Ambari Web &amp;lt;/b&amp;gt; presents a user interface to monitor and manage a Hadoop cluster. Web module is written in JavaScript using Ember.js framework. During our code study, we observed this module following the [https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller MVC] design methodology. The whole motivation of this module is to make it convenient to the end-user to manage the concerned Hadoop cluster.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Ambari Server &amp;lt;/b&amp;gt; is the most central component of an Ambari ecosystem. Ambari Server exposes [https://en.wikipedia.org/wiki/Application_programming_interface APIs]] to its clients such as Ambari Web, which monitors health of a cluster. Ambari Server clients can query for node health statuses. Ambari Server persists the nodes' statuses in a [https://en.wikipedia.org/wiki/PostgreSQL PostgreSQL] database in the backend. Internally, Ambari Server has several components which help it to manage its responsibilities. Ambari Server's important responsibilities are as follows:&lt;br /&gt;
&amp;lt;p&amp;gt; 1. Collect health statuses ( Heartbeats ) from Ambari agents. Process their statuses and send Heartbeat responses to Ambari agents. &amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt; 2. Handle requests from Ambari Server's clients: One such use case is installing a new service on an Ambari agent. This request could be received from Ambari Web and it is the server's responsibility to send appropriate instructions to the particular agent to get the new service up and running on the agent. &amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===='''Architectural design of WebSocket client-server in Apache Ambari'''====&lt;br /&gt;
[[File:Ambari-WebServerClient.png]]&lt;br /&gt;
&lt;br /&gt;
===='''Flow Diagram'''====&lt;br /&gt;
[[File:Ambari-Flow.png]]&lt;br /&gt;
&lt;br /&gt;
==='''Implementation'''===&lt;br /&gt;
===='''Design Pattern'''====&lt;br /&gt;
We have observed that Ambari project adopts various design patterns like [https://en.wikipedia.org/wiki/Singleton_pattern Singleton Pattern] in the Data Access Object Classes. For this project, we will be using [https://en.wikipedia.org/wiki/Request%E2%80%93response request-response], one of the [https://en.wikipedia.org/wiki/Messaging_pattern Messaging Pattern].&lt;br /&gt;
&lt;br /&gt;
Request–response is a message exchange pattern in which a requestor sends a request message to a replier system which receives and processes the request, ultimately returning a message in response. This is a simple, but powerful messaging pattern which allows two applications to have a two-way conversation with one another over a channel. In our project, Ambari-Server's HeartBeat handler acts as a requestor which sends the message to Ambari UI via WebSocket protocol. In response, Ambari UI acknowledges the received information and sends new requests if any to the Ambari-Server. Moreover, same messaging pattern is followed for bidirectional communication between Ambari-Agent and Ambari-Server.&lt;br /&gt;
&lt;br /&gt;
===='''UML Diagrams'''====&lt;br /&gt;
====='''Class Diagram'''=====&lt;br /&gt;
[[File:Ambari-UML.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;1. New class is added for both Web Socket client and Server.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;2. One method is added in the existing class &amp;quot;HeartBeatHandler&amp;quot; &amp;lt;/p&amp;gt;&lt;br /&gt;
======'''WebSocketClient'''======&lt;br /&gt;
&amp;lt;p&amp;gt;'''1. onOpen''': An event listener to be called when connection to server is established.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;'''2. onClose''': An event listener to be called when connection to server is closed.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;'''3. onText''': An event listener to be called when message is received from server.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;'''4. getLatch''':&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;'''5. sendMessage''': Method to send message to server&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
======'''WebSocketServer'''======&lt;br /&gt;
&amp;lt;p&amp;gt;'''1. onOpen''': An event listener to be called when connection has been opened.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;'''2. onClose''': An event listener to be called when connection has been closed&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;'''3. onMessage''': An event listener to be called when message is received .&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
======'''HeartBeatHandler'''======&lt;br /&gt;
&amp;lt;p&amp;gt;'''1. sendMessage'': Method to instantiate a WebSocketClient to send message to server.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Testing Framework'''==&lt;br /&gt;
&lt;br /&gt;
A popular mocking framework, [https://en.wikipedia.org/wiki/Mockito Mockito] is used to mock responses from dependent downstream services. A whole prototype of an in-memory cluster is also mocked using Mockito. Mocking frameworks let us have our test cases fast and independent, which is very well depicted in this project. &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Only the results/responses obtained from controller methods are asserted. We do not find any significant &amp;quot;verify / expect&amp;quot; calls. (&amp;quot;verify/expect&amp;quot; calls are used to assert if a given method was invoked during the test method execution). Hence, tests are implemented in a result-oriented way and are not bound to the method implementation in anyway.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==='''Test cases'''===&lt;br /&gt;
Following is a brief overview of the test cases that we look to add in the Ambari project to test out our functionality:&lt;br /&gt;
&lt;br /&gt;
1. Testing if the websocket response to Ambari Web is triggered when a Heartbeat is received and persisted in the backend PostgreSQL DB.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
2. Mocking an agent Heartbeat and asserting that the same status is reflected on the front-end Ambari Web.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
3. Verifying the correctness of websocket behavior for agent Heartbeats received with different contents. We could have Heartbeats having a variety of data such as node status, component's status on a node, volume of requests processed over a past time period on a node etc.&lt;br /&gt;
&lt;br /&gt;
=='''Steps to build and test Ambari-WebSocket'''==&lt;br /&gt;
1. Clone the repository to your local system&amp;lt;br&amp;gt;&lt;br /&gt;
   git clone https://github.com/nisarg64/ambari&lt;br /&gt;
&lt;br /&gt;
2. Got to ambari directory and checkout the branch &amp;quot;migration&amp;quot; using below command&amp;lt;br&amp;gt;&lt;br /&gt;
   git checkout migration&lt;br /&gt;
&lt;br /&gt;
3. You will need nodeJs, maven etc to build the ambari. Check the requirements as described in [https://cwiki.apache.org/confluence/display/AMBARI/Ambari+Development Ambari PreConfigs]&lt;br /&gt;
&lt;br /&gt;
4. After having the required configurations, run below command to build &amp;lt;br&amp;gt;&lt;br /&gt;
   mvn clean package -DskipTests -Drat.ignoreErrors=true&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Project Benefits and Challenges'''==&lt;br /&gt;
'''Benefits:'''&lt;br /&gt;
&amp;lt;p&amp;gt;1. Web Socket will allow Ambari-Server to perform robustly in a large cluster setup with multiple browser sessions and when continuous heavy requests are being made&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Challenges:'''&lt;br /&gt;
&amp;lt;p&amp;gt;1. Ambari server uses [https://en.wikipedia.org/wiki/Jetty_%28web_server%29 Jetty] 8.x version, while support for Web Socket was made available after [https://en.wikipedia.org/wiki/Jetty_%28web_server%29 Jetty] 9.x&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;2. Ambari has a huge codebase with multiple modules and multiple frameworks and design patterns adopted. Understanding the flow of the project and taking care of dependencies is a huge challenge&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;3. For testing the code requires a cluster of around 3 nodes. Running 3 virtual machines requires a high performance machine.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Learning Outcomes'''==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;1. We also noticed in one of the classes called HeartBeatHandler, that it obeys the [https://en.wikipedia.org/wiki/Law_of_Demeter Law of Demeter]&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;2. For testing, project using the [https://en.wikipedia.org/wiki/Mockito Mockito] framework to mock the heartbeat and cluster functionality&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;3. For configuration management, [https://en.wikipedia.org/wiki/Puppet_%28software%29 Puppet] configuration management tool is used&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;4. Ambari-Web is implemented in [https://en.wikipedia.org/wiki/Ember.js Ember.js] which is an open-source Javascript framework that follows [https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller MVC] pattern similar to Rails framework.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;5. Ambari-server uses [https://en.wikipedia.org/wiki/Jetty_%28web_server%29 Jetty] which is a web-server to handle all the HTTP requests made onto the ambari-server from the UI&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Github Location'''==&lt;br /&gt;
 [https://github.com/apache/ambari Ambari Project]&lt;br /&gt;
&lt;br /&gt;
Forked Repository:&lt;br /&gt;
 [https://github.com/nisarg64/ambari Forked Repo]&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;p&amp;gt;https://ambari.apache.org/&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;https://en.wikipedia.org/wiki/Apache_Ambari&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;https://cwiki.apache.org/confluence/display/AMBARI/Ambari&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;https://issues.apache.org/jira/secure/attachment/12559939/Ambari_Architecture.pdf&amp;lt;/p&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rpsingh3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_A1550_Web_Socket_Implementation_in_Apache_Ambari&amp;diff=99888</id>
		<title>CSC/ECE 517 Fall 2015 A1550 Web Socket Implementation in Apache Ambari</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_A1550_Web_Socket_Implementation_in_Apache_Ambari&amp;diff=99888"/>
		<updated>2015-11-14T03:59:36Z</updated>

		<summary type="html">&lt;p&gt;Rpsingh3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction'''==&lt;br /&gt;
&lt;br /&gt;
Apache Ambari is a software project of the [https://en.wikipedia.org/wiki/Apache_Software_Foundation Apache Software Foundation], aimed at making [https://en.wikipedia.org/wiki/Apache_Hadoop Hadoop] management simpler by developing software for provisioning, managing, and monitoring Apache Hadoop clusters. Ambari provides an intuitive, easy-to-use [https://en.wikipedia.org/wiki/Apache_Hadoop Hadoop] management web UI backed by its [https://en.wikipedia.org/wiki/Representational_state_transfer RESTful] APIs. Ambari was a sub-project of [https://en.wikipedia.org/wiki/Apache_Hadoop Hadoop] but is now a [https://en.wikipedia.org/wiki/Apache_Software_Foundation#Projects top-level] project in its own right.&lt;br /&gt;
&lt;br /&gt;
An Apache Hadoop cluster consists on a group or nodes/machines. Each node acts as an Ambari Agent that runs various service components (e.g. datanode for HDFS). One of the agents acts as an Ambari Server that takes care of the task allocation, management, gathering information about the services status and other information from the agents and giving the information to Ambari UI for display. More information about Agent-Server-Web flow is available in the following sections.&lt;br /&gt;
&lt;br /&gt;
Ambari-Web uses simple ajax polling mechanism to fetch data from Ambari-Server. Constant polling is done to show current service status, alerts, service graphs, etc on Ambari-Web. With this mechanism, the performance of Ambari-Server can be affected on a large size cluster with multiple active browser sessions due to continuous heavy requests being made. &lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/WebSocket WebSocket] is a protocol providing full-duplex communication channels over a single TCP connection. Implementing Web-Socket between Ambari-Web and Ambari-Server will be helpful to address this scenario.&lt;br /&gt;
&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;font color = &amp;quot;red&amp;quot;&amp;gt; Note: This is continuation of our OSS project &amp;lt;/font&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==='''Project Goals'''===&lt;br /&gt;
&amp;lt;p&amp;gt;1. Understand architecture of Ambari-Server and Ambari-Web&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;2. Replace the current [https://en.wikipedia.org/wiki/Polling_(computer_science) polling mechanism] with the push-based mechanism via Web-Socket&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;3. Write test cases for the Web Socket implementation to test the functionalities of WebSocket Client and WebSocket Server&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==='''Project Design'''===&lt;br /&gt;
Ambari is a multi-module Maven project. The relevant modules for our project from an implementation perspective are Ambari Web and Ambari Server. Ambari Agent is another module, important functionally.&lt;br /&gt;
&lt;br /&gt;
===='''Major Components'''====&lt;br /&gt;
&amp;lt;b&amp;gt;Ambari Agent &amp;lt;/b&amp;gt; is a component that resides on every node of the cluster. Its responsibility is to collect the node's overall health which comprises of the health metrics of all the different services running on that node. Ambari Agent sends these statuses to the Ambari Server in the form of periodic messages which is termed as 'Heartbeat' in the Ambari nomenclature. In return, Ambari agents receive Heartbeat responses from Ambari Server. Hearbeat responses could contain commands for the agent to perform.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Ambari Web &amp;lt;/b&amp;gt; presents a user interface to monitor and manage a Hadoop cluster. Web module is written in JavaScript using Ember.js framework. During our code study, we observed this module following the [https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller MVC] design methodology. The whole motivation of this module is to make it convenient to the end-user to manage the concerned Hadoop cluster.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Ambari Server &amp;lt;/b&amp;gt; is the most central component of an Ambari ecosystem. Ambari Server exposes [https://en.wikipedia.org/wiki/Application_programming_interface APIs]] to its clients such as Ambari Web, which monitors health of a cluster. Ambari Server clients can query for node health statuses. Ambari Server persists the nodes' statuses in a [https://en.wikipedia.org/wiki/PostgreSQL PostgreSQL] database in the backend. Internally, Ambari Server has several components which help it to manage its responsibilities. Ambari Server's important responsibilities are as follows:&lt;br /&gt;
&amp;lt;p&amp;gt; 1. Collect health statuses ( Heartbeats ) from Ambari agents. Process their statuses and send Heartbeat responses to Ambari agents. &amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt; 2. Handle requests from Ambari Server's clients: One such use case is installing a new service on an Ambari agent. This request could be received from Ambari Web and it is the server's responsibility to send appropriate instructions to the particular agent to get the new service up and running on the agent. &amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===='''Architectural design of WebSocket client-server in Apache Ambari'''====&lt;br /&gt;
[[File:Ambari-WebServerClient.png]]&lt;br /&gt;
&lt;br /&gt;
===='''Flow Diagram'''====&lt;br /&gt;
[[File:Ambari-Flow.png]]&lt;br /&gt;
&lt;br /&gt;
==='''Implementation'''===&lt;br /&gt;
===='''Design Pattern'''====&lt;br /&gt;
We have observed that Ambari project adopts various design patterns like [https://en.wikipedia.org/wiki/Singleton_pattern Singleton Pattern] in the Data Access Object Classes. For this project, we will be using [https://en.wikipedia.org/wiki/Request%E2%80%93response request-response], one of the [https://en.wikipedia.org/wiki/Messaging_pattern Messaging Pattern].&lt;br /&gt;
&lt;br /&gt;
Request–response is a message exchange pattern in which a requestor sends a request message to a replier system which receives and processes the request, ultimately returning a message in response. This is a simple, but powerful messaging pattern which allows two applications to have a two-way conversation with one another over a channel. In our project, Ambari-Server's HeartBeat handler acts as a requestor which sends the message to Ambari UI via WebSocket protocol. In response, Ambari UI acknowledges the received information and sends new requests if any to the Ambari-Server. Moreover, same messaging pattern is followed for bidirectional communication between Ambari-Agent and Ambari-Server.&lt;br /&gt;
&lt;br /&gt;
===='''UML Diagrams'''====&lt;br /&gt;
====='''Class Diagram'''=====&lt;br /&gt;
[[File:Ambari-UML.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;1. New class is added for both Web Socket client and Server.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;2. One method is added in the existing class &amp;quot;HeartBeatHandler&amp;quot; &amp;lt;/p&amp;gt;&lt;br /&gt;
======'''WebSocketClient'''======&lt;br /&gt;
&amp;lt;p&amp;gt;'''1. onOpen''': An event listener to be called when connection to server is established.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;'''2. onClose''': An event listener to be called when connection to server is closed.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;'''3. onText''': An event listener to be called when message is received from server.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;'''4. getLatch''':&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;'''5. sendMessage''': Method to send message to server&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
======'''WebSocketServer'''======&lt;br /&gt;
&amp;lt;p&amp;gt;'''1. onOpen''': An event listener to be called when connection to server is established.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;'''2. onClose''': An event listener to be called when connection to server is closed.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;'''3. onText''': An event listener to be called when message is received from server.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;'''4. getLatch''': &amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;'''5. sendMessage''': Method to send message to server.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Testing Framework'''==&lt;br /&gt;
&lt;br /&gt;
A popular mocking framework, [https://en.wikipedia.org/wiki/Mockito Mockito] is used to mock responses from dependent downstream services. A whole prototype of an in-memory cluster is also mocked using Mockito. Mocking frameworks let us have our test cases fast and independent, which is very well depicted in this project. &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Only the results/responses obtained from controller methods are asserted. We do not find any significant &amp;quot;verify / expect&amp;quot; calls. (&amp;quot;verify/expect&amp;quot; calls are used to assert if a given method was invoked during the test method execution). Hence, tests are implemented in a result-oriented way and are not bound to the method implementation in anyway.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==='''Test cases'''===&lt;br /&gt;
Following is a brief overview of the test cases that we look to add in the Ambari project to test out our functionality:&lt;br /&gt;
&lt;br /&gt;
1. Testing if the websocket response to Ambari Web is triggered when a Heartbeat is received and persisted in the backend PostgreSQL DB.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
2. Mocking an agent Heartbeat and asserting that the same status is reflected on the front-end Ambari Web.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
3. Verifying the correctness of websocket behavior for agent Heartbeats received with different contents. We could have Heartbeats having a variety of data such as node status, component's status on a node, volume of requests processed over a past time period on a node etc.&lt;br /&gt;
&lt;br /&gt;
=='''Steps to build and test Ambari-WebSocket'''==&lt;br /&gt;
1. Clone the repository to your local system&amp;lt;br&amp;gt;&lt;br /&gt;
   git clone https://github.com/nisarg64/ambari&lt;br /&gt;
&lt;br /&gt;
2. Got to ambari directory and checkout the branch &amp;quot;migration&amp;quot; using below command&amp;lt;br&amp;gt;&lt;br /&gt;
   git checkout migration&lt;br /&gt;
&lt;br /&gt;
3. You will need nodeJs, maven etc to build the ambari. Check the requirements as described in [https://cwiki.apache.org/confluence/display/AMBARI/Ambari+Development Ambari PreConfigs]&lt;br /&gt;
&lt;br /&gt;
4. After having the required configurations, run below command to build &amp;lt;br&amp;gt;&lt;br /&gt;
   mvn clean package -DskipTests -Drat.ignoreErrors=true&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Project Benefits and Challenges'''==&lt;br /&gt;
'''Benefits:'''&lt;br /&gt;
&amp;lt;p&amp;gt;1. Web Socket will allow Ambari-Server to perform robustly in a large cluster setup with multiple browser sessions and when continuous heavy requests are being made&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Challenges:'''&lt;br /&gt;
&amp;lt;p&amp;gt;1. Ambari server uses [https://en.wikipedia.org/wiki/Jetty_%28web_server%29 Jetty] 8.x version, while support for Web Socket was made available after [https://en.wikipedia.org/wiki/Jetty_%28web_server%29 Jetty] 9.x&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;2. Ambari has a huge codebase with multiple modules and multiple frameworks and design patterns adopted. Understanding the flow of the project and taking care of dependencies is a huge challenge&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;3. For testing the code requires a cluster of around 3 nodes. Running 3 virtual machines requires a high performance machine.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Learning Outcomes'''==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;1. We also noticed in one of the classes called HeartBeatHandler, that it obeys the [https://en.wikipedia.org/wiki/Law_of_Demeter Law of Demeter]&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;2. For testing, project using the [https://en.wikipedia.org/wiki/Mockito Mockito] framework to mock the heartbeat and cluster functionality&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;3. For configuration management, [https://en.wikipedia.org/wiki/Puppet_%28software%29 Puppet] configuration management tool is used&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;4. Ambari-Web is implemented in [https://en.wikipedia.org/wiki/Ember.js Ember.js] which is an open-source Javascript framework that follows [https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller MVC] pattern similar to Rails framework.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;5. Ambari-server uses [https://en.wikipedia.org/wiki/Jetty_%28web_server%29 Jetty] which is a web-server to handle all the HTTP requests made onto the ambari-server from the UI&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Github Location'''==&lt;br /&gt;
 [https://github.com/apache/ambari Ambari Project]&lt;br /&gt;
&lt;br /&gt;
Forked Repository:&lt;br /&gt;
 [https://github.com/nisarg64/ambari Forked Repo]&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;p&amp;gt;https://ambari.apache.org/&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;https://en.wikipedia.org/wiki/Apache_Ambari&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;https://cwiki.apache.org/confluence/display/AMBARI/Ambari&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;https://issues.apache.org/jira/secure/attachment/12559939/Ambari_Architecture.pdf&amp;lt;/p&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rpsingh3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_A1550_Web_Socket_Implementation_in_Apache_Ambari&amp;diff=99886</id>
		<title>CSC/ECE 517 Fall 2015 A1550 Web Socket Implementation in Apache Ambari</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_A1550_Web_Socket_Implementation_in_Apache_Ambari&amp;diff=99886"/>
		<updated>2015-11-14T03:55:33Z</updated>

		<summary type="html">&lt;p&gt;Rpsingh3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction'''==&lt;br /&gt;
&lt;br /&gt;
Apache Ambari is a software project of the [https://en.wikipedia.org/wiki/Apache_Software_Foundation Apache Software Foundation], aimed at making [https://en.wikipedia.org/wiki/Apache_Hadoop Hadoop] management simpler by developing software for provisioning, managing, and monitoring Apache Hadoop clusters. Ambari provides an intuitive, easy-to-use [https://en.wikipedia.org/wiki/Apache_Hadoop Hadoop] management web UI backed by its [https://en.wikipedia.org/wiki/Representational_state_transfer RESTful] APIs. Ambari was a sub-project of [https://en.wikipedia.org/wiki/Apache_Hadoop Hadoop] but is now a [https://en.wikipedia.org/wiki/Apache_Software_Foundation#Projects top-level] project in its own right.&lt;br /&gt;
&lt;br /&gt;
An Apache Hadoop cluster consists on a group or nodes/machines. Each node acts as an Ambari Agent that runs various service components (e.g. datanode for HDFS). One of the agents acts as an Ambari Server that takes care of the task allocation, management, gathering information about the services status and other information from the agents and giving the information to Ambari UI for display. More information about Agent-Server-Web flow is available in the following sections.&lt;br /&gt;
&lt;br /&gt;
Ambari-Web uses simple ajax polling mechanism to fetch data from Ambari-Server. Constant polling is done to show current service status, alerts, service graphs, etc on Ambari-Web. With this mechanism, the performance of Ambari-Server can be affected on a large size cluster with multiple active browser sessions due to continuous heavy requests being made. &lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/WebSocket WebSocket] is a protocol providing full-duplex communication channels over a single TCP connection. Implementing Web-Socket between Ambari-Web and Ambari-Server will be helpful to address this scenario.&lt;br /&gt;
&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;font color = &amp;quot;red&amp;quot;&amp;gt; Note: This is continuation of our OSS project &amp;lt;/font&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==='''Project Goals'''===&lt;br /&gt;
&amp;lt;p&amp;gt;1. Understand architecture of Ambari-Server and Ambari-Web&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;2. Replace the current [https://en.wikipedia.org/wiki/Polling_(computer_science) polling mechanism] with the push-based mechanism via Web-Socket&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;3. Write test cases for the Web Socket implementation to test the functionalities of WebSocket Client and WebSocket Server&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==='''Project Design'''===&lt;br /&gt;
Ambari is a multi-module Maven project. The relevant modules for our project from an implementation perspective are Ambari Web and Ambari Server. Ambari Agent is another module, important functionally.&lt;br /&gt;
&lt;br /&gt;
===='''Major Components'''====&lt;br /&gt;
&amp;lt;b&amp;gt;Ambari Agent &amp;lt;/b&amp;gt; is a component that resides on every node of the cluster. Its responsibility is to collect the node's overall health which comprises of the health metrics of all the different services running on that node. Ambari Agent sends these statuses to the Ambari Server in the form of periodic messages which is termed as 'Heartbeat' in the Ambari nomenclature. In return, Ambari agents receive Heartbeat responses from Ambari Server. Hearbeat responses could contain commands for the agent to perform.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Ambari Web &amp;lt;/b&amp;gt; presents a user interface to monitor and manage a Hadoop cluster. Web module is written in JavaScript using Ember.js framework. During our code study, we observed this module following the [https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller MVC] design methodology. The whole motivation of this module is to make it convenient to the end-user to manage the concerned Hadoop cluster.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Ambari Server &amp;lt;/b&amp;gt; is the most central component of an Ambari ecosystem. Ambari Server exposes [https://en.wikipedia.org/wiki/Application_programming_interface APIs]] to its clients such as Ambari Web, which monitors health of a cluster. Ambari Server clients can query for node health statuses. Ambari Server persists the nodes' statuses in a [https://en.wikipedia.org/wiki/PostgreSQL PostgreSQL] database in the backend. Internally, Ambari Server has several components which help it to manage its responsibilities. Ambari Server's important responsibilities are as follows:&lt;br /&gt;
&amp;lt;p&amp;gt; 1. Collect health statuses ( Heartbeats ) from Ambari agents. Process their statuses and send Heartbeat responses to Ambari agents. &amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt; 2. Handle requests from Ambari Server's clients: One such use case is installing a new service on an Ambari agent. This request could be received from Ambari Web and it is the server's responsibility to send appropriate instructions to the particular agent to get the new service up and running on the agent. &amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===='''Architectural design of WebSocket client-server in Apache Ambari'''====&lt;br /&gt;
[[File:Ambari-WebServerClient.png]]&lt;br /&gt;
&lt;br /&gt;
===='''Flow Diagram'''====&lt;br /&gt;
[[File:Ambari-Flow.png]]&lt;br /&gt;
&lt;br /&gt;
==='''Implementation'''===&lt;br /&gt;
===='''Design Pattern'''====&lt;br /&gt;
We have observed that Ambari project adopts various design patterns like [https://en.wikipedia.org/wiki/Singleton_pattern Singleton Pattern] in the Data Access Object Classes. For this project, we will be using [https://en.wikipedia.org/wiki/Request%E2%80%93response request-response], one of the [https://en.wikipedia.org/wiki/Messaging_pattern Messaging Pattern].&lt;br /&gt;
&lt;br /&gt;
Request–response is a message exchange pattern in which a requestor sends a request message to a replier system which receives and processes the request, ultimately returning a message in response. This is a simple, but powerful messaging pattern which allows two applications to have a two-way conversation with one another over a channel. In our project, Ambari-Server's HeartBeat handler acts as a requestor which sends the message to Ambari UI via WebSocket protocol. In response, Ambari UI acknowledges the received information and sends new requests if any to the Ambari-Server. Moreover, same messaging pattern is followed for bidirectional communication between Ambari-Agent and Ambari-Server.&lt;br /&gt;
&lt;br /&gt;
===='''UML Diagrams'''====&lt;br /&gt;
====='''Class Diagram'''=====&lt;br /&gt;
[[File:Ambari-UML.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;1. New class is added for both Web Socket client and Server.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;2. One method is added in the existing class &amp;quot;HeartBeatHandler&amp;quot; &amp;lt;/p&amp;gt;&lt;br /&gt;
======'''WebSocketClient'''======&lt;br /&gt;
&amp;lt;p&amp;gt;'''1. onOpen''': An event listener to be called when connection to server is established.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;'''2. onClose''': An event listener to be called when connection to server is closed.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;'''3. onText''': An event listener to be called when message is received from server.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;'''4. getLatch''':&lt;br /&gt;
&amp;lt;p&amp;gt;'''5. sendMessage''': Method to send message to server&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Testing Framework'''==&lt;br /&gt;
&lt;br /&gt;
A popular mocking framework, [https://en.wikipedia.org/wiki/Mockito Mockito] is used to mock responses from dependent downstream services. A whole prototype of an in-memory cluster is also mocked using Mockito. Mocking frameworks let us have our test cases fast and independent, which is very well depicted in this project. &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Only the results/responses obtained from controller methods are asserted. We do not find any significant &amp;quot;verify / expect&amp;quot; calls. (&amp;quot;verify/expect&amp;quot; calls are used to assert if a given method was invoked during the test method execution). Hence, tests are implemented in a result-oriented way and are not bound to the method implementation in anyway.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==='''Test cases'''===&lt;br /&gt;
Following is a brief overview of the test cases that we look to add in the Ambari project to test out our functionality:&lt;br /&gt;
&lt;br /&gt;
1. Testing if the websocket response to Ambari Web is triggered when a Heartbeat is received and persisted in the backend PostgreSQL DB.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
2. Mocking an agent Heartbeat and asserting that the same status is reflected on the front-end Ambari Web.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
3. Verifying the correctness of websocket behavior for agent Heartbeats received with different contents. We could have Heartbeats having a variety of data such as node status, component's status on a node, volume of requests processed over a past time period on a node etc.&lt;br /&gt;
&lt;br /&gt;
=='''Steps to build and test Ambari-WebSocket'''==&lt;br /&gt;
1. Clone the repository to your local system&amp;lt;br&amp;gt;&lt;br /&gt;
   git clone https://github.com/nisarg64/ambari&lt;br /&gt;
&lt;br /&gt;
2. Got to ambari directory and checkout the branch &amp;quot;migration&amp;quot; using below command&amp;lt;br&amp;gt;&lt;br /&gt;
   git checkout migration&lt;br /&gt;
&lt;br /&gt;
3. You will need nodeJs, maven etc to build the ambari. Check the requirements as described in [https://cwiki.apache.org/confluence/display/AMBARI/Ambari+Development Ambari PreConfigs]&lt;br /&gt;
&lt;br /&gt;
4. After having the required configurations, run below command to build &amp;lt;br&amp;gt;&lt;br /&gt;
   mvn clean package -DskipTests -Drat.ignoreErrors=true&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Project Benefits and Challenges'''==&lt;br /&gt;
'''Benefits:'''&lt;br /&gt;
&amp;lt;p&amp;gt;1. Web Socket will allow Ambari-Server to perform robustly in a large cluster setup with multiple browser sessions and when continuous heavy requests are being made&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Challenges:'''&lt;br /&gt;
&amp;lt;p&amp;gt;1. Ambari server uses [https://en.wikipedia.org/wiki/Jetty_%28web_server%29 Jetty] 8.x version, while support for Web Socket was made available after [https://en.wikipedia.org/wiki/Jetty_%28web_server%29 Jetty] 9.x&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;2. Ambari has a huge codebase with multiple modules and multiple frameworks and design patterns adopted. Understanding the flow of the project and taking care of dependencies is a huge challenge&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;3. For testing the code requires a cluster of around 3 nodes. Running 3 virtual machines requires a high performance machine.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Learning Outcomes'''==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;1. We also noticed in one of the classes called HeartBeatHandler, that it obeys the [https://en.wikipedia.org/wiki/Law_of_Demeter Law of Demeter]&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;2. For testing, project using the [https://en.wikipedia.org/wiki/Mockito Mockito] framework to mock the heartbeat and cluster functionality&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;3. For configuration management, [https://en.wikipedia.org/wiki/Puppet_%28software%29 Puppet] configuration management tool is used&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;4. Ambari-Web is implemented in [https://en.wikipedia.org/wiki/Ember.js Ember.js] which is an open-source Javascript framework that follows [https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller MVC] pattern similar to Rails framework.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;5. Ambari-server uses [https://en.wikipedia.org/wiki/Jetty_%28web_server%29 Jetty] which is a web-server to handle all the HTTP requests made onto the ambari-server from the UI&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Github Location'''==&lt;br /&gt;
 [https://github.com/apache/ambari Ambari Project]&lt;br /&gt;
&lt;br /&gt;
Forked Repository:&lt;br /&gt;
 [https://github.com/nisarg64/ambari Forked Repo]&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;p&amp;gt;https://ambari.apache.org/&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;https://en.wikipedia.org/wiki/Apache_Ambari&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;https://cwiki.apache.org/confluence/display/AMBARI/Ambari&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;https://issues.apache.org/jira/secure/attachment/12559939/Ambari_Architecture.pdf&amp;lt;/p&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rpsingh3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_A1550_Web_Socket_Implementation_in_Apache_Ambari&amp;diff=99885</id>
		<title>CSC/ECE 517 Fall 2015 A1550 Web Socket Implementation in Apache Ambari</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_A1550_Web_Socket_Implementation_in_Apache_Ambari&amp;diff=99885"/>
		<updated>2015-11-14T03:55:09Z</updated>

		<summary type="html">&lt;p&gt;Rpsingh3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction'''==&lt;br /&gt;
&lt;br /&gt;
Apache Ambari is a software project of the [https://en.wikipedia.org/wiki/Apache_Software_Foundation Apache Software Foundation], aimed at making [https://en.wikipedia.org/wiki/Apache_Hadoop Hadoop] management simpler by developing software for provisioning, managing, and monitoring Apache Hadoop clusters. Ambari provides an intuitive, easy-to-use [https://en.wikipedia.org/wiki/Apache_Hadoop Hadoop] management web UI backed by its [https://en.wikipedia.org/wiki/Representational_state_transfer RESTful] APIs. Ambari was a sub-project of [https://en.wikipedia.org/wiki/Apache_Hadoop Hadoop] but is now a [https://en.wikipedia.org/wiki/Apache_Software_Foundation#Projects top-level] project in its own right.&lt;br /&gt;
&lt;br /&gt;
An Apache Hadoop cluster consists on a group or nodes/machines. Each node acts as an Ambari Agent that runs various service components (e.g. datanode for HDFS). One of the agents acts as an Ambari Server that takes care of the task allocation, management, gathering information about the services status and other information from the agents and giving the information to Ambari UI for display. More information about Agent-Server-Web flow is available in the following sections.&lt;br /&gt;
&lt;br /&gt;
Ambari-Web uses simple ajax polling mechanism to fetch data from Ambari-Server. Constant polling is done to show current service status, alerts, service graphs, etc on Ambari-Web. With this mechanism, the performance of Ambari-Server can be affected on a large size cluster with multiple active browser sessions due to continuous heavy requests being made. &lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/WebSocket WebSocket] is a protocol providing full-duplex communication channels over a single TCP connection. Implementing Web-Socket between Ambari-Web and Ambari-Server will be helpful to address this scenario.&lt;br /&gt;
&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;font color = &amp;quot;red&amp;quot;&amp;gt; Note: This is continuation of our OSS project &amp;lt;/font&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==='''Project Goals'''===&lt;br /&gt;
&amp;lt;p&amp;gt;1. Understand architecture of Ambari-Server and Ambari-Web&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;2. Replace the current [https://en.wikipedia.org/wiki/Polling_(computer_science) polling mechanism] with the push-based mechanism via Web-Socket&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;3. Write test cases for the Web Socket implementation to test the functionalities of WebSocket Client and WebSocket Server&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==='''Project Design'''===&lt;br /&gt;
Ambari is a multi-module Maven project. The relevant modules for our project from an implementation perspective are Ambari Web and Ambari Server. Ambari Agent is another module, important functionally.&lt;br /&gt;
&lt;br /&gt;
===='''Major Components'''====&lt;br /&gt;
&amp;lt;b&amp;gt;Ambari Agent &amp;lt;/b&amp;gt; is a component that resides on every node of the cluster. Its responsibility is to collect the node's overall health which comprises of the health metrics of all the different services running on that node. Ambari Agent sends these statuses to the Ambari Server in the form of periodic messages which is termed as 'Heartbeat' in the Ambari nomenclature. In return, Ambari agents receive Heartbeat responses from Ambari Server. Hearbeat responses could contain commands for the agent to perform.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Ambari Web &amp;lt;/b&amp;gt; presents a user interface to monitor and manage a Hadoop cluster. Web module is written in JavaScript using Ember.js framework. During our code study, we observed this module following the [https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller MVC] design methodology. The whole motivation of this module is to make it convenient to the end-user to manage the concerned Hadoop cluster.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Ambari Server &amp;lt;/b&amp;gt; is the most central component of an Ambari ecosystem. Ambari Server exposes [https://en.wikipedia.org/wiki/Application_programming_interface APIs]] to its clients such as Ambari Web, which monitors health of a cluster. Ambari Server clients can query for node health statuses. Ambari Server persists the nodes' statuses in a [https://en.wikipedia.org/wiki/PostgreSQL PostgreSQL] database in the backend. Internally, Ambari Server has several components which help it to manage its responsibilities. Ambari Server's important responsibilities are as follows:&lt;br /&gt;
&amp;lt;p&amp;gt; 1. Collect health statuses ( Heartbeats ) from Ambari agents. Process their statuses and send Heartbeat responses to Ambari agents. &amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt; 2. Handle requests from Ambari Server's clients: One such use case is installing a new service on an Ambari agent. This request could be received from Ambari Web and it is the server's responsibility to send appropriate instructions to the particular agent to get the new service up and running on the agent. &amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===='''Architectural design of WebSocket client-server in Apache Ambari'''====&lt;br /&gt;
[[File:Ambari-WebServerClient.png]]&lt;br /&gt;
&lt;br /&gt;
===='''Flow Diagram'''====&lt;br /&gt;
[[File:Ambari-Flow.png]]&lt;br /&gt;
&lt;br /&gt;
==='''Implementation'''===&lt;br /&gt;
===='''Design Pattern'''====&lt;br /&gt;
We have observed that Ambari project adopts various design patterns like [https://en.wikipedia.org/wiki/Singleton_pattern Singleton Pattern] in the Data Access Object Classes. For this project, we will be using [https://en.wikipedia.org/wiki/Request%E2%80%93response request-response], one of the [https://en.wikipedia.org/wiki/Messaging_pattern Messaging Pattern].&lt;br /&gt;
&lt;br /&gt;
Request–response is a message exchange pattern in which a requestor sends a request message to a replier system which receives and processes the request, ultimately returning a message in response. This is a simple, but powerful messaging pattern which allows two applications to have a two-way conversation with one another over a channel. In our project, Ambari-Server's HeartBeat handler acts as a requestor which sends the message to Ambari UI via WebSocket protocol. In response, Ambari UI acknowledges the received information and sends new requests if any to the Ambari-Server. Moreover, same messaging pattern is followed for bidirectional communication between Ambari-Agent and Ambari-Server.&lt;br /&gt;
&lt;br /&gt;
===='''UML Diagrams'''====&lt;br /&gt;
====='''Class Diagram'''=====&lt;br /&gt;
[[File:Ambari-UML.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;1. New class is added for both Web Socket client and Server.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;2. One method is added in the existing class &amp;quot;HeartBeatHandler&amp;quot; &amp;lt;/p&amp;gt;&lt;br /&gt;
======'''WebSocketClient'''======&lt;br /&gt;
&amp;lt;p&amp;gt;'''1. onOpen''': An event listener to be called when connection to server is established.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;'''2. onClose''': An event listener to be called when connection to server is closed.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;'''3. onText''': An event listener to be called when message is received from server.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;'''4. getLatch''':&lt;br /&gt;
&amp;lt;p&amp;gt;'''5. sendMessage''': Method to send message to server&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Testing Framework'''==&lt;br /&gt;
&lt;br /&gt;
A popular mocking framework, [https://en.wikipedia.org/wiki/Mockito Mockito] is used to mock responses from dependent downstream services. A whole prototype of an in-memory cluster is also mocked using Mockito. Mocking frameworks let us have our test cases fast and independent, which is very well depicted in this project. &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Only the results/responses obtained from controller methods are asserted. We do not find any significant &amp;quot;verify / expect&amp;quot; calls. (&amp;quot;verify/expect&amp;quot; calls are used to assert if a given method was invoked during the test method execution). Hence, tests are implemented in a result-oriented way and are not bound to the method implementation in anyway.&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
==='''Test cases'''===&lt;br /&gt;
Following is a brief overview of the test cases that we look to add in the Ambari project to test out our functionality:&lt;br /&gt;
&lt;br /&gt;
1. Testing if the websocket response to Ambari Web is triggered when a Heartbeat is received and persisted in the backend PostgreSQL DB.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
2. Mocking an agent Heartbeat and asserting that the same status is reflected on the front-end Ambari Web.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
3. Verifying the correctness of websocket behavior for agent Heartbeats received with different contents. We could have Heartbeats having a variety of data such as node status, component's status on a node, volume of requests processed over a past time period on a node etc.&lt;br /&gt;
&lt;br /&gt;
=='''Steps to build and test Ambari-WebSocket'''==&lt;br /&gt;
1. Clone the repository to your local system&amp;lt;br&amp;gt;&lt;br /&gt;
   git clone https://github.com/nisarg64/ambari&lt;br /&gt;
&lt;br /&gt;
2. Got to ambari directory and checkout the branch &amp;quot;migration&amp;quot; using below command&amp;lt;br&amp;gt;&lt;br /&gt;
   git checkout migration&lt;br /&gt;
&lt;br /&gt;
3. You will need nodeJs, maven etc to build the ambari. Check the requirements as described in [https://cwiki.apache.org/confluence/display/AMBARI/Ambari+Development Ambari PreConfigs]&lt;br /&gt;
&lt;br /&gt;
4. After having the required configurations, run below command to build &amp;lt;br&amp;gt;&lt;br /&gt;
   mvn clean package -DskipTests -Drat.ignoreErrors=true&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Project Benefits and Challenges'''==&lt;br /&gt;
'''Benefits:'''&lt;br /&gt;
&amp;lt;p&amp;gt;1. Web Socket will allow Ambari-Server to perform robustly in a large cluster setup with multiple browser sessions and when continuous heavy requests are being made&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Challenges:'''&lt;br /&gt;
&amp;lt;p&amp;gt;1. Ambari server uses [https://en.wikipedia.org/wiki/Jetty_%28web_server%29 Jetty] 8.x version, while support for Web Socket was made available after [https://en.wikipedia.org/wiki/Jetty_%28web_server%29 Jetty] 9.x&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;2. Ambari has a huge codebase with multiple modules and multiple frameworks and design patterns adopted. Understanding the flow of the project and taking care of dependencies is a huge challenge&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;3. For testing the code requires a cluster of around 3 nodes. Running 3 virtual machines requires a high performance machine.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Learning Outcomes'''==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;1. We also noticed in one of the classes called HeartBeatHandler, that it obeys the [https://en.wikipedia.org/wiki/Law_of_Demeter Law of Demeter]&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;2. For testing, project using the [https://en.wikipedia.org/wiki/Mockito Mockito] framework to mock the heartbeat and cluster functionality&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;3. For configuration management, [https://en.wikipedia.org/wiki/Puppet_%28software%29 Puppet] configuration management tool is used&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;4. Ambari-Web is implemented in [https://en.wikipedia.org/wiki/Ember.js Ember.js] which is an open-source Javascript framework that follows [https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller MVC] pattern similar to Rails framework.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;5. Ambari-server uses [https://en.wikipedia.org/wiki/Jetty_%28web_server%29 Jetty] which is a web-server to handle all the HTTP requests made onto the ambari-server from the UI&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Github Location'''==&lt;br /&gt;
 [https://github.com/apache/ambari Ambari Project]&lt;br /&gt;
&lt;br /&gt;
Forked Repository:&lt;br /&gt;
 [https://github.com/nisarg64/ambari Forked Repo]&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;p&amp;gt;https://ambari.apache.org/&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;https://en.wikipedia.org/wiki/Apache_Ambari&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;https://cwiki.apache.org/confluence/display/AMBARI/Ambari&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;https://issues.apache.org/jira/secure/attachment/12559939/Ambari_Architecture.pdf&amp;lt;/p&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rpsingh3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_A1550_Web_Socket_Implementation_in_Apache_Ambari&amp;diff=99884</id>
		<title>CSC/ECE 517 Fall 2015 A1550 Web Socket Implementation in Apache Ambari</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_A1550_Web_Socket_Implementation_in_Apache_Ambari&amp;diff=99884"/>
		<updated>2015-11-14T03:52:04Z</updated>

		<summary type="html">&lt;p&gt;Rpsingh3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction'''==&lt;br /&gt;
&lt;br /&gt;
Apache Ambari is a software project of the [https://en.wikipedia.org/wiki/Apache_Software_Foundation Apache Software Foundation], aimed at making [https://en.wikipedia.org/wiki/Apache_Hadoop Hadoop] management simpler by developing software for provisioning, managing, and monitoring Apache Hadoop clusters. Ambari provides an intuitive, easy-to-use [https://en.wikipedia.org/wiki/Apache_Hadoop Hadoop] management web UI backed by its [https://en.wikipedia.org/wiki/Representational_state_transfer RESTful] APIs. Ambari was a sub-project of [https://en.wikipedia.org/wiki/Apache_Hadoop Hadoop] but is now a [https://en.wikipedia.org/wiki/Apache_Software_Foundation#Projects top-level] project in its own right.&lt;br /&gt;
&lt;br /&gt;
An Apache Hadoop cluster consists on a group or nodes/machines. Each node acts as an Ambari Agent that runs various service components (e.g. datanode for HDFS). One of the agents acts as an Ambari Server that takes care of the task allocation, management, gathering information about the services status and other information from the agents and giving the information to Ambari UI for display. More information about Agent-Server-Web flow is available in the following sections.&lt;br /&gt;
&lt;br /&gt;
Ambari-Web uses simple ajax polling mechanism to fetch data from Ambari-Server. Constant polling is done to show current service status, alerts, service graphs, etc on Ambari-Web. With this mechanism, the performance of Ambari-Server can be affected on a large size cluster with multiple active browser sessions due to continuous heavy requests being made. &lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/WebSocket WebSocket] is a protocol providing full-duplex communication channels over a single TCP connection. Implementing Web-Socket between Ambari-Web and Ambari-Server will be helpful to address this scenario.&lt;br /&gt;
&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;font color = &amp;quot;red&amp;quot;&amp;gt; Note: This is continuation of our OSS project &amp;lt;/font&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==='''Project Goals'''===&lt;br /&gt;
&amp;lt;p&amp;gt;1. Understand architecture of Ambari-Server and Ambari-Web&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;2. Replace the current [https://en.wikipedia.org/wiki/Polling_(computer_science) polling mechanism] with the push-based mechanism via Web-Socket&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;3. Write test cases for the Web Socket implementation to test the functionalities of WebSocket Client and WebSocket Server&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==='''Project Design'''===&lt;br /&gt;
Ambari is a multi-module Maven project. The relevant modules for our project from an implementation perspective are Ambari Web and Ambari Server. Ambari Agent is another module, important functionally.&lt;br /&gt;
&lt;br /&gt;
===='''Major Components'''====&lt;br /&gt;
&amp;lt;b&amp;gt;Ambari Agent &amp;lt;/b&amp;gt; is a component that resides on every node of the cluster. Its responsibility is to collect the node's overall health which comprises of the health metrics of all the different services running on that node. Ambari Agent sends these statuses to the Ambari Server in the form of periodic messages which is termed as 'Heartbeat' in the Ambari nomenclature. In return, Ambari agents receive Heartbeat responses from Ambari Server. Hearbeat responses could contain commands for the agent to perform.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Ambari Web &amp;lt;/b&amp;gt; presents a user interface to monitor and manage a Hadoop cluster. Web module is written in JavaScript using Ember.js framework. During our code study, we observed this module following the [https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller MVC] design methodology. The whole motivation of this module is to make it convenient to the end-user to manage the concerned Hadoop cluster.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Ambari Server &amp;lt;/b&amp;gt; is the most central component of an Ambari ecosystem. Ambari Server exposes [https://en.wikipedia.org/wiki/Application_programming_interface APIs]] to its clients such as Ambari Web, which monitors health of a cluster. Ambari Server clients can query for node health statuses. Ambari Server persists the nodes' statuses in a [https://en.wikipedia.org/wiki/PostgreSQL PostgreSQL] database in the backend. Internally, Ambari Server has several components which help it to manage its responsibilities. Ambari Server's important responsibilities are as follows:&lt;br /&gt;
&amp;lt;p&amp;gt; 1. Collect health statuses ( Heartbeats ) from Ambari agents. Process their statuses and send Heartbeat responses to Ambari agents. &amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt; 2. Handle requests from Ambari Server's clients: One such use case is installing a new service on an Ambari agent. This request could be received from Ambari Web and it is the server's responsibility to send appropriate instructions to the particular agent to get the new service up and running on the agent. &amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===='''Architectural design of WebSocket client-server in Apache Ambari'''====&lt;br /&gt;
[[File:Ambari-WebServerClient.png]]&lt;br /&gt;
&lt;br /&gt;
===='''Flow Diagram'''====&lt;br /&gt;
[[File:Ambari-Flow.png]]&lt;br /&gt;
&lt;br /&gt;
==='''Implementation'''===&lt;br /&gt;
===='''Design Pattern'''====&lt;br /&gt;
We have observed that Ambari project adopts various design patterns like [https://en.wikipedia.org/wiki/Singleton_pattern Singleton Pattern] in the Data Access Object Classes. For this project, we will be using [https://en.wikipedia.org/wiki/Request%E2%80%93response request-response], one of the [https://en.wikipedia.org/wiki/Messaging_pattern Messaging Pattern].&lt;br /&gt;
&lt;br /&gt;
Request–response is a message exchange pattern in which a requestor sends a request message to a replier system which receives and processes the request, ultimately returning a message in response. This is a simple, but powerful messaging pattern which allows two applications to have a two-way conversation with one another over a channel. In our project, Ambari-Server's HeartBeat handler acts as a requestor which sends the message to Ambari UI via WebSocket protocol. In response, Ambari UI acknowledges the received information and sends new requests if any to the Ambari-Server. Moreover, same messaging pattern is followed for bidirectional communication between Ambari-Agent and Ambari-Server.&lt;br /&gt;
&lt;br /&gt;
===='''UML Diagrams'''====&lt;br /&gt;
====='''Class Diagram'''=====&lt;br /&gt;
[[File:Ambari-UML.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;1. New class is added for both Web Socket client and Server.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;2. One method is added in the existing class &amp;quot;HeartBeatHandler&amp;quot; &amp;lt;/p&amp;gt;&lt;br /&gt;
======'''WebSocketClient'''======&lt;br /&gt;
&amp;lt;p&amp;gt;'''1. onOpen''': An event listener to be called when connection to server is established.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;'''2. onClose''': An event listener to be called when connection to server is closed.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;'''3. onText''': An event listener to be called when message is received from server.&amp;lt;/p&amp;gt;&lt;br /&gt;
'''4. getLatch''':&lt;br /&gt;
'''5. sendMessage''':&lt;br /&gt;
=='''Testing Framework'''==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A popular mocking framework, [https://en.wikipedia.org/wiki/Mockito Mockito] is used to mock responses from dependent downstream services. A whole prototype of an in-memory cluster is also mocked using Mockito. Mocking frameworks let us have our test cases fast and independent, which is very well depicted in this project. &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Only the results/responses obtained from controller methods are asserted. We do not find any significant &amp;quot;verify / expect&amp;quot; calls. (&amp;quot;verify/expect&amp;quot; calls are used to assert if a given method was invoked during the test method execution). Hence, tests are implemented in a result-oriented way and are not bound to the method implementation in anyway.&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
Following is a brief overview of the test cases that we look to add in the Ambari project to test out our functionality:&lt;br /&gt;
&lt;br /&gt;
1. Testing if the websocket response to Ambari Web is triggered when a Heartbeat is received and persisted in the backend PostgreSQL DB.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
2. Mocking an agent Heartbeat and asserting that the same status is reflected on the front-end Ambari Web.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
3. Verifying the correctness of websocket behavior for agent Heartbeats received with different contents. We could have Heartbeats having a variety of data such as node status, component's status on a node, volume of requests processed over a past time period on a node etc.&lt;br /&gt;
&lt;br /&gt;
=='''Steps to build and test Ambari-WebSocket'''==&lt;br /&gt;
1. Clone the repository to your local system&amp;lt;br&amp;gt;&lt;br /&gt;
   git clone https://github.com/nisarg64/ambari&lt;br /&gt;
&lt;br /&gt;
2. Got to ambari directory and checkout the branch &amp;quot;migration&amp;quot; using below command&amp;lt;br&amp;gt;&lt;br /&gt;
   git checkout migration&lt;br /&gt;
&lt;br /&gt;
3. You will need nodeJs, maven etc to build the ambari. Check the requirements as described in [https://cwiki.apache.org/confluence/display/AMBARI/Ambari+Development Ambari PreConfigs]&lt;br /&gt;
&lt;br /&gt;
4. After having the required configurations, run below command to build &amp;lt;br&amp;gt;&lt;br /&gt;
   mvn clean package -DskipTests -Drat.ignoreErrors=true&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Project Benefits and Challenges'''==&lt;br /&gt;
'''Benefits:'''&lt;br /&gt;
&amp;lt;p&amp;gt;1. Web Socket will allow Ambari-Server to perform robustly in a large cluster setup with multiple browser sessions and when continuous heavy requests are being made&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Challenges:'''&lt;br /&gt;
&amp;lt;p&amp;gt;1. Ambari server uses [https://en.wikipedia.org/wiki/Jetty_%28web_server%29 Jetty] 8.x version, while support for Web Socket was made available after [https://en.wikipedia.org/wiki/Jetty_%28web_server%29 Jetty] 9.x&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;2. Ambari has a huge codebase with multiple modules and multiple frameworks and design patterns adopted. Understanding the flow of the project and taking care of dependencies is a huge challenge&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;3. For testing the code requires a cluster of around 3 nodes. Running 3 virtual machines requires a high performance machine.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Learning Outcomes'''==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;1. We also noticed in one of the classes called HeartBeatHandler, that it obeys the [https://en.wikipedia.org/wiki/Law_of_Demeter Law of Demeter]&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;2. For testing, project using the [https://en.wikipedia.org/wiki/Mockito Mockito] framework to mock the heartbeat and cluster functionality&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;3. For configuration management, [https://en.wikipedia.org/wiki/Puppet_%28software%29 Puppet] configuration management tool is used&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;4. Ambari-Web is implemented in [https://en.wikipedia.org/wiki/Ember.js Ember.js] which is an open-source Javascript framework that follows [https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller MVC] pattern similar to Rails framework.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;5. Ambari-server uses [https://en.wikipedia.org/wiki/Jetty_%28web_server%29 Jetty] which is a web-server to handle all the HTTP requests made onto the ambari-server from the UI&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Github Location'''==&lt;br /&gt;
 [https://github.com/apache/ambari Ambari Project]&lt;br /&gt;
&lt;br /&gt;
Forked Repository:&lt;br /&gt;
 [https://github.com/nisarg64/ambari Forked Repo]&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;p&amp;gt;https://ambari.apache.org/&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;https://en.wikipedia.org/wiki/Apache_Ambari&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;https://cwiki.apache.org/confluence/display/AMBARI/Ambari&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;https://issues.apache.org/jira/secure/attachment/12559939/Ambari_Architecture.pdf&amp;lt;/p&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rpsingh3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_A1550_Web_Socket_Implementation_in_Apache_Ambari&amp;diff=99883</id>
		<title>CSC/ECE 517 Fall 2015 A1550 Web Socket Implementation in Apache Ambari</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_A1550_Web_Socket_Implementation_in_Apache_Ambari&amp;diff=99883"/>
		<updated>2015-11-14T03:51:09Z</updated>

		<summary type="html">&lt;p&gt;Rpsingh3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction'''==&lt;br /&gt;
&lt;br /&gt;
Apache Ambari is a software project of the [https://en.wikipedia.org/wiki/Apache_Software_Foundation Apache Software Foundation], aimed at making [https://en.wikipedia.org/wiki/Apache_Hadoop Hadoop] management simpler by developing software for provisioning, managing, and monitoring Apache Hadoop clusters. Ambari provides an intuitive, easy-to-use [https://en.wikipedia.org/wiki/Apache_Hadoop Hadoop] management web UI backed by its [https://en.wikipedia.org/wiki/Representational_state_transfer RESTful] APIs. Ambari was a sub-project of [https://en.wikipedia.org/wiki/Apache_Hadoop Hadoop] but is now a [https://en.wikipedia.org/wiki/Apache_Software_Foundation#Projects top-level] project in its own right.&lt;br /&gt;
&lt;br /&gt;
An Apache Hadoop cluster consists on a group or nodes/machines. Each node acts as an Ambari Agent that runs various service components (e.g. datanode for HDFS). One of the agents acts as an Ambari Server that takes care of the task allocation, management, gathering information about the services status and other information from the agents and giving the information to Ambari UI for display. More information about Agent-Server-Web flow is available in the following sections.&lt;br /&gt;
&lt;br /&gt;
Ambari-Web uses simple ajax polling mechanism to fetch data from Ambari-Server. Constant polling is done to show current service status, alerts, service graphs, etc on Ambari-Web. With this mechanism, the performance of Ambari-Server can be affected on a large size cluster with multiple active browser sessions due to continuous heavy requests being made. &lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/WebSocket WebSocket] is a protocol providing full-duplex communication channels over a single TCP connection. Implementing Web-Socket between Ambari-Web and Ambari-Server will be helpful to address this scenario.&lt;br /&gt;
&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;font color = &amp;quot;red&amp;quot;&amp;gt; Note: This is continuation of our OSS project &amp;lt;/font&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==='''Project Goals'''===&lt;br /&gt;
&amp;lt;p&amp;gt;1. Understand architecture of Ambari-Server and Ambari-Web&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;2. Replace the current [https://en.wikipedia.org/wiki/Polling_(computer_science) polling mechanism] with the push-based mechanism via Web-Socket&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;3. Write test cases for the Web Socket implementation to test the functionalities of WebSocket Client and WebSocket Server&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==='''Project Design'''===&lt;br /&gt;
Ambari is a multi-module Maven project. The relevant modules for our project from an implementation perspective are Ambari Web and Ambari Server. Ambari Agent is another module, important functionally.&lt;br /&gt;
&lt;br /&gt;
===='''Major Components'''====&lt;br /&gt;
&amp;lt;b&amp;gt;Ambari Agent &amp;lt;/b&amp;gt; is a component that resides on every node of the cluster. Its responsibility is to collect the node's overall health which comprises of the health metrics of all the different services running on that node. Ambari Agent sends these statuses to the Ambari Server in the form of periodic messages which is termed as 'Heartbeat' in the Ambari nomenclature. In return, Ambari agents receive Heartbeat responses from Ambari Server. Hearbeat responses could contain commands for the agent to perform.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Ambari Web &amp;lt;/b&amp;gt; presents a user interface to monitor and manage a Hadoop cluster. Web module is written in JavaScript using Ember.js framework. During our code study, we observed this module following the [https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller MVC] design methodology. The whole motivation of this module is to make it convenient to the end-user to manage the concerned Hadoop cluster.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Ambari Server &amp;lt;/b&amp;gt; is the most central component of an Ambari ecosystem. Ambari Server exposes [https://en.wikipedia.org/wiki/Application_programming_interface APIs]] to its clients such as Ambari Web, which monitors health of a cluster. Ambari Server clients can query for node health statuses. Ambari Server persists the nodes' statuses in a [https://en.wikipedia.org/wiki/PostgreSQL PostgreSQL] database in the backend. Internally, Ambari Server has several components which help it to manage its responsibilities. Ambari Server's important responsibilities are as follows:&lt;br /&gt;
&amp;lt;p&amp;gt; 1. Collect health statuses ( Heartbeats ) from Ambari agents. Process their statuses and send Heartbeat responses to Ambari agents. &amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt; 2. Handle requests from Ambari Server's clients: One such use case is installing a new service on an Ambari agent. This request could be received from Ambari Web and it is the server's responsibility to send appropriate instructions to the particular agent to get the new service up and running on the agent. &amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===='''Architectural design of WebSocket client-server in Apache Ambari'''====&lt;br /&gt;
[[File:Ambari-WebServerClient.png]]&lt;br /&gt;
&lt;br /&gt;
===='''Flow Diagram'''====&lt;br /&gt;
[[File:Ambari-Flow.png]]&lt;br /&gt;
&lt;br /&gt;
==='''Implementation'''===&lt;br /&gt;
===='''Design Pattern'''====&lt;br /&gt;
We have observed that Ambari project adopts various design patterns like [https://en.wikipedia.org/wiki/Singleton_pattern Singleton Pattern] in the Data Access Object Classes. For this project, we will be using [https://en.wikipedia.org/wiki/Request%E2%80%93response request-response], one of the [https://en.wikipedia.org/wiki/Messaging_pattern Messaging Pattern].&lt;br /&gt;
&lt;br /&gt;
Request–response is a message exchange pattern in which a requestor sends a request message to a replier system which receives and processes the request, ultimately returning a message in response. This is a simple, but powerful messaging pattern which allows two applications to have a two-way conversation with one another over a channel. In our project, Ambari-Server's HeartBeat handler acts as a requestor which sends the message to Ambari UI via WebSocket protocol. In response, Ambari UI acknowledges the received information and sends new requests if any to the Ambari-Server. Moreover, same messaging pattern is followed for bidirectional communication between Ambari-Agent and Ambari-Server.&lt;br /&gt;
&lt;br /&gt;
===='''UML Diagrams'''====&lt;br /&gt;
====='''Class Diagram'''=====&lt;br /&gt;
[[File:Ambari-UML.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;1. New class is added for both Web Socket client and Server.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;2. One method is added in the existing class &amp;quot;HeartBeatHandler&amp;quot; &amp;lt;/p&amp;gt;&lt;br /&gt;
======'''WebSocketClient'''======&lt;br /&gt;
'''1. onOpen''': An event listener to be called when connection to server is established.&lt;br /&gt;
'''2. onClose''': An event listener to be called when connection to server is closed.&lt;br /&gt;
'''3. onText''': An event listener to be called when message is received from server&lt;br /&gt;
'''4. getLatch''':&lt;br /&gt;
'''5. sendMessage''':&lt;br /&gt;
=='''Testing Framework'''==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A popular mocking framework, [https://en.wikipedia.org/wiki/Mockito Mockito] is used to mock responses from dependent downstream services. A whole prototype of an in-memory cluster is also mocked using Mockito. Mocking frameworks let us have our test cases fast and independent, which is very well depicted in this project. &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Only the results/responses obtained from controller methods are asserted. We do not find any significant &amp;quot;verify / expect&amp;quot; calls. (&amp;quot;verify/expect&amp;quot; calls are used to assert if a given method was invoked during the test method execution). Hence, tests are implemented in a result-oriented way and are not bound to the method implementation in anyway.&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
Following is a brief overview of the test cases that we look to add in the Ambari project to test out our functionality:&lt;br /&gt;
&lt;br /&gt;
1. Testing if the websocket response to Ambari Web is triggered when a Heartbeat is received and persisted in the backend PostgreSQL DB.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
2. Mocking an agent Heartbeat and asserting that the same status is reflected on the front-end Ambari Web.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
3. Verifying the correctness of websocket behavior for agent Heartbeats received with different contents. We could have Heartbeats having a variety of data such as node status, component's status on a node, volume of requests processed over a past time period on a node etc.&lt;br /&gt;
&lt;br /&gt;
=='''Steps to build and test Ambari-WebSocket'''==&lt;br /&gt;
1. Clone the repository to your local system&amp;lt;br&amp;gt;&lt;br /&gt;
   git clone https://github.com/nisarg64/ambari&lt;br /&gt;
&lt;br /&gt;
2. Got to ambari directory and checkout the branch &amp;quot;migration&amp;quot; using below command&amp;lt;br&amp;gt;&lt;br /&gt;
   git checkout migration&lt;br /&gt;
&lt;br /&gt;
3. You will need nodeJs, maven etc to build the ambari. Check the requirements as described in [https://cwiki.apache.org/confluence/display/AMBARI/Ambari+Development Ambari PreConfigs]&lt;br /&gt;
&lt;br /&gt;
4. After having the required configurations, run below command to build &amp;lt;br&amp;gt;&lt;br /&gt;
   mvn clean package -DskipTests -Drat.ignoreErrors=true&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Project Benefits and Challenges'''==&lt;br /&gt;
'''Benefits:'''&lt;br /&gt;
&amp;lt;p&amp;gt;1. Web Socket will allow Ambari-Server to perform robustly in a large cluster setup with multiple browser sessions and when continuous heavy requests are being made&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Challenges:'''&lt;br /&gt;
&amp;lt;p&amp;gt;1. Ambari server uses [https://en.wikipedia.org/wiki/Jetty_%28web_server%29 Jetty] 8.x version, while support for Web Socket was made available after [https://en.wikipedia.org/wiki/Jetty_%28web_server%29 Jetty] 9.x&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;2. Ambari has a huge codebase with multiple modules and multiple frameworks and design patterns adopted. Understanding the flow of the project and taking care of dependencies is a huge challenge&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;3. For testing the code requires a cluster of around 3 nodes. Running 3 virtual machines requires a high performance machine.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Learning Outcomes'''==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;1. We also noticed in one of the classes called HeartBeatHandler, that it obeys the [https://en.wikipedia.org/wiki/Law_of_Demeter Law of Demeter]&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;2. For testing, project using the [https://en.wikipedia.org/wiki/Mockito Mockito] framework to mock the heartbeat and cluster functionality&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;3. For configuration management, [https://en.wikipedia.org/wiki/Puppet_%28software%29 Puppet] configuration management tool is used&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;4. Ambari-Web is implemented in [https://en.wikipedia.org/wiki/Ember.js Ember.js] which is an open-source Javascript framework that follows [https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller MVC] pattern similar to Rails framework.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;5. Ambari-server uses [https://en.wikipedia.org/wiki/Jetty_%28web_server%29 Jetty] which is a web-server to handle all the HTTP requests made onto the ambari-server from the UI&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Github Location'''==&lt;br /&gt;
 [https://github.com/apache/ambari Ambari Project]&lt;br /&gt;
&lt;br /&gt;
Forked Repository:&lt;br /&gt;
 [https://github.com/nisarg64/ambari Forked Repo]&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;p&amp;gt;https://ambari.apache.org/&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;https://en.wikipedia.org/wiki/Apache_Ambari&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;https://cwiki.apache.org/confluence/display/AMBARI/Ambari&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;https://issues.apache.org/jira/secure/attachment/12559939/Ambari_Architecture.pdf&amp;lt;/p&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rpsingh3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_A1550_Web_Socket_Implementation_in_Apache_Ambari&amp;diff=99872</id>
		<title>CSC/ECE 517 Fall 2015 A1550 Web Socket Implementation in Apache Ambari</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_A1550_Web_Socket_Implementation_in_Apache_Ambari&amp;diff=99872"/>
		<updated>2015-11-14T03:34:33Z</updated>

		<summary type="html">&lt;p&gt;Rpsingh3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction'''==&lt;br /&gt;
&lt;br /&gt;
Apache Ambari is a software project of the [https://en.wikipedia.org/wiki/Apache_Software_Foundation Apache Software Foundation], aimed at making [https://en.wikipedia.org/wiki/Apache_Hadoop Hadoop] management simpler by developing software for provisioning, managing, and monitoring Apache Hadoop clusters. Ambari provides an intuitive, easy-to-use [https://en.wikipedia.org/wiki/Apache_Hadoop Hadoop] management web UI backed by its [https://en.wikipedia.org/wiki/Representational_state_transfer RESTful] APIs. Ambari was a sub-project of [https://en.wikipedia.org/wiki/Apache_Hadoop Hadoop] but is now a [https://en.wikipedia.org/wiki/Apache_Software_Foundation#Projects top-level] project in its own right.&lt;br /&gt;
&lt;br /&gt;
An Apache Hadoop cluster consists on a group or nodes/machines. Each node acts as an Ambari Agent that runs various service components (e.g. datanode for HDFS). One of the agents acts as an Ambari Server that takes care of the task allocation, management, gathering information about the services status and other information from the agents and giving the information to Ambari UI for display. More information about Agent-Server-Web flow is available in the following sections.&lt;br /&gt;
&lt;br /&gt;
Ambari-Web uses simple ajax polling mechanism to fetch data from Ambari-Server. Constant polling is done to show current service status, alerts, service graphs, etc on Ambari-Web. With this mechanism, the performance of Ambari-Server can be affected on a large size cluster with multiple active browser sessions due to continuous heavy requests being made. &lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/WebSocket WebSocket] is a protocol providing full-duplex communication channels over a single TCP connection. Implementing Web-Socket between Ambari-Web and Ambari-Server will be helpful to address this scenario.&lt;br /&gt;
&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;font color = &amp;quot;red&amp;quot;&amp;gt; Note: This is continuation of our OSS project &amp;lt;/font&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==='''Project Goals'''===&lt;br /&gt;
&amp;lt;p&amp;gt;1. Understand architecture of Ambari-Server and Ambari-Web&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;2. Replace the current [https://en.wikipedia.org/wiki/Polling_(computer_science) polling mechanism] with the push-based mechanism via Web-Socket&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;3. Write test cases for the Web Socket implementation to test the functionalities of WebSocket Client and WebSocket Server&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==='''Project Design'''===&lt;br /&gt;
Ambari is a multi-module Maven project. The relevant modules for our project from an implementation perspective are Ambari Web and Ambari Server. Ambari Agent is another module, important functionally.&lt;br /&gt;
&lt;br /&gt;
===='''Major Components'''====&lt;br /&gt;
&amp;lt;b&amp;gt;Ambari Agent &amp;lt;/b&amp;gt; is a component that resides on every node of the cluster. Its responsibility is to collect the node's overall health which comprises of the health metrics of all the different services running on that node. Ambari Agent sends these statuses to the Ambari Server in the form of periodic messages which is termed as 'Heartbeat' in the Ambari nomenclature. In return, Ambari agents receive Heartbeat responses from Ambari Server. Hearbeat responses could contain commands for the agent to perform.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Ambari Web &amp;lt;/b&amp;gt; presents a user interface to monitor and manage a Hadoop cluster. Web module is written in JavaScript using Ember.js framework. During our code study, we observed this module following the [https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller MVC] design methodology. The whole motivation of this module is to make it convenient to the end-user to manage the concerned Hadoop cluster.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Ambari Server &amp;lt;/b&amp;gt; is the most central component of an Ambari ecosystem. Ambari Server exposes [https://en.wikipedia.org/wiki/Application_programming_interface APIs]] to its clients such as Ambari Web, which monitors health of a cluster. Ambari Server clients can query for node health statuses. Ambari Server persists the nodes' statuses in a [https://en.wikipedia.org/wiki/PostgreSQL PostgreSQL] database in the backend. Internally, Ambari Server has several components which help it to manage its responsibilities. Ambari Server's important responsibilities are as follows:&lt;br /&gt;
&amp;lt;p&amp;gt; 1. Collect health statuses ( Heartbeats ) from Ambari agents. Process their statuses and send Heartbeat responses to Ambari agents. &amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt; 2. Handle requests from Ambari Server's clients: One such use case is installing a new service on an Ambari agent. This request could be received from Ambari Web and it is the server's responsibility to send appropriate instructions to the particular agent to get the new service up and running on the agent. &amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===='''Architectural design of WebSocket client-server in Apache Ambari'''====&lt;br /&gt;
[[File:Ambari-WebServerClient.png]]&lt;br /&gt;
&lt;br /&gt;
===='''Flow Diagram'''====&lt;br /&gt;
[[File:Ambari-Flow.png]]&lt;br /&gt;
&lt;br /&gt;
==='''Implementation'''===&lt;br /&gt;
===='''Design Pattern'''====&lt;br /&gt;
We have observed that Ambari project adopts various design patterns like [https://en.wikipedia.org/wiki/Singleton_pattern Singleton Pattern] in the Data Access Object Classes. For this project, we will be using [https://en.wikipedia.org/wiki/Request%E2%80%93response request-response], one of the [https://en.wikipedia.org/wiki/Messaging_pattern Messaging Pattern].&lt;br /&gt;
&lt;br /&gt;
Request–response is a message exchange pattern in which a requestor sends a request message to a replier system which receives and processes the request, ultimately returning a message in response. This is a simple, but powerful messaging pattern which allows two applications to have a two-way conversation with one another over a channel. In our project, Ambari-Server's HeartBeat handler acts as a requestor which sends the message to Ambari UI via WebSocket protocol. In response, Ambari UI acknowledges the received information and sends new requests if any to the Ambari-Server. Moreover, same messaging pattern is followed for bidirectional communication between Ambari-Agent and Ambari-Server.&lt;br /&gt;
&lt;br /&gt;
===='''UML Diagrams'''====&lt;br /&gt;
====='''Class Diagram'''=====&lt;br /&gt;
[[File:Ambari-UML.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;1. New class is added for both Web Socket client and Server.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;2. One method is added in the existing class &amp;quot;HeartBeatHandler&amp;quot; &amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Testing Framework'''==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A popular mocking framework, [https://en.wikipedia.org/wiki/Mockito Mockito] is used to mock responses from dependent downstream services. A whole prototype of an in-memory cluster is also mocked using Mockito. Mocking frameworks let us have our test cases fast and independent, which is very well depicted in this project. &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Only the results/responses obtained from controller methods are asserted. We do not find any significant &amp;quot;verify / expect&amp;quot; calls. (&amp;quot;verify/expect&amp;quot; calls are used to assert if a given method was invoked during the test method execution). Hence, tests are implemented in a result-oriented way and are not bound to the method implementation in anyway.&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
Following is a brief overview of the test cases that we look to add in the Ambari project to test out our functionality:&lt;br /&gt;
&lt;br /&gt;
1. Testing if the websocket response to Ambari Web is triggered when a Heartbeat is received and persisted in the backend PostgreSQL DB.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
2. Mocking an agent Heartbeat and asserting that the same status is reflected on the front-end Ambari Web.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Steps to build and test Ambari-WebSocket'''==&lt;br /&gt;
1. Clone the repository to your local system&amp;lt;br&amp;gt;&lt;br /&gt;
   git clone https://github.com/nisarg64/ambari&lt;br /&gt;
&lt;br /&gt;
2. Got to ambari directory and checkout the branch &amp;quot;migration&amp;quot; using below command&amp;lt;br&amp;gt;&lt;br /&gt;
   git checkout migration&lt;br /&gt;
&lt;br /&gt;
3. You will need nodeJs, maven etc to build the ambari. Check the requirements as described in [https://cwiki.apache.org/confluence/display/AMBARI/Ambari+Development Ambari PreConfigs]&lt;br /&gt;
&lt;br /&gt;
4. After having the required configurations, run below command to build &amp;lt;br&amp;gt;&lt;br /&gt;
   mvn clean package -DskipTests -Drat.ignoreErrors=true&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Project Benefits and Challenges'''==&lt;br /&gt;
'''Benefits:'''&lt;br /&gt;
&amp;lt;p&amp;gt;1. Web Socket will allow Ambari-Server to perform robustly in a large cluster setup with multiple browser sessions and when continuous heavy requests are being made&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Challenges:'''&lt;br /&gt;
&amp;lt;p&amp;gt;1. Ambari server uses [https://en.wikipedia.org/wiki/Jetty_%28web_server%29 Jetty] 8.x version, while support for Web Socket was made available after [https://en.wikipedia.org/wiki/Jetty_%28web_server%29 Jetty] 9.x&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;2. Ambari has a huge codebase with multiple modules and multiple frameworks and design patterns adopted. Understanding the flow of the project and taking care of dependencies is a huge challenge&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;3. For testing the code requires a cluster of around 3 nodes. Running 3 virtual machines requires a high performance machine.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Learning Outcomes'''==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;1. We also noticed in one of the classes called HeartBeatHandler, that it obeys the [https://en.wikipedia.org/wiki/Law_of_Demeter Law of Demeter]&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;2. For testing, project using the [https://en.wikipedia.org/wiki/Mockito Mockito] framework to mock the heartbeat and cluster functionality&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;3. For configuration management, [https://en.wikipedia.org/wiki/Puppet_%28software%29 Puppet] configuration management tool is used&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;4. Ambari-Web is implemented in [https://en.wikipedia.org/wiki/Ember.js Ember.js] which is an open-source Javascript framework that follows [https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller MVC] pattern similar to Rails framework.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;5. Ambari-server uses [https://en.wikipedia.org/wiki/Jetty_%28web_server%29 Jetty] which is a web-server to handle all the HTTP requests made onto the ambari-server from the UI&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Github Location'''==&lt;br /&gt;
 [https://github.com/apache/ambari Ambari Project]&lt;br /&gt;
&lt;br /&gt;
Forked Repository:&lt;br /&gt;
 [https://github.com/nisarg64/ambari Forked Repo]&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;p&amp;gt;https://ambari.apache.org/&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;https://en.wikipedia.org/wiki/Apache_Ambari&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;https://cwiki.apache.org/confluence/display/AMBARI/Ambari&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;https://issues.apache.org/jira/secure/attachment/12559939/Ambari_Architecture.pdf&amp;lt;/p&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rpsingh3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_A1550_Web_Socket_Implementation_in_Apache_Ambari&amp;diff=99850</id>
		<title>CSC/ECE 517 Fall 2015 A1550 Web Socket Implementation in Apache Ambari</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_A1550_Web_Socket_Implementation_in_Apache_Ambari&amp;diff=99850"/>
		<updated>2015-11-14T03:16:27Z</updated>

		<summary type="html">&lt;p&gt;Rpsingh3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction'''==&lt;br /&gt;
&lt;br /&gt;
Apache Ambari is a software project of the [https://en.wikipedia.org/wiki/Apache_Software_Foundation Apache Software Foundation], is aimed at making [https://en.wikipedia.org/wiki/Apache_Hadoop Hadoop] management simpler by developing software for provisioning, managing, and monitoring Apache Hadoop clusters. Ambari provides an intuitive, easy-to-use [https://en.wikipedia.org/wiki/Apache_Hadoop Hadoop] management web UI backed by its [https://en.wikipedia.org/wiki/Representational_state_transfer RESTful] APIs. Ambari was a sub-project of [https://en.wikipedia.org/wiki/Apache_Hadoop Hadoop] but is now a [https://en.wikipedia.org/wiki/Apache_Software_Foundation#Projects top-level] project in its own right.&lt;br /&gt;
&lt;br /&gt;
An Apache Hadoop cluster consists on a group or nodes/machines. Each node acts as an Ambari Agent that runs various service components (e.g. Datanode for HDFS). One of the agents acts as an Ambari Server that takes care of the task allocation, management, gathering information about the services status and other information from the agents and giving the information to Ambari UI for display. More information about Agent-Server-Web flow is available in the following sections.&lt;br /&gt;
&lt;br /&gt;
Ambari-Web uses simple ajax polling mechanism to fetch data from Ambari-Server. Constant polling is done to show current service status, alerts, service graphs, etc on Ambari-Web. With this mechanism, the performance of Ambari-Server can be affected on a large size cluster with multiple active browser sessions due to continuous heavy requests being made. &lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/WebSocket WebSocket] is a protocol providing full-duplex communication channels over a single TCP connection. Implementing Web-Socket between Ambari-Web and Ambari-Server will be helpful to address this scenario.&lt;br /&gt;
&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;font color = &amp;quot;red&amp;quot;&amp;gt; Note: This is continuation of our OSS project &amp;lt;/font&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==='''Project Goals'''===&lt;br /&gt;
&amp;lt;p&amp;gt;1. Understand architecture of Ambari-Server and Ambari-Web&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;2. Replace the current pull-based mechanism with the push-based mechanism via Web-Socket&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;3. Write test cases for the Web Socket implementation to test the functionalities of WebSocket Client and WebSocket Server&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==='''Project Design'''===&lt;br /&gt;
Ambari is a multi-module Maven project. The relevant modules for our project from an implementation perspective are Ambari Web and Ambari Server. Ambari Agent is another module, important functionally.&lt;br /&gt;
&lt;br /&gt;
===='''Major Components'''====&lt;br /&gt;
&amp;lt;b&amp;gt;Ambari Agent &amp;lt;/b&amp;gt; is a component that resides on every node of the cluster. Its responsibility is to collect the node's overall health which comprises of the health metrics of all the different services running on that node. Ambari Agent sends these statuses to the Ambari Server in the form of periodic messages which is termed as 'Heartbeat' in the Ambari nomenclature. In return, Ambari agents receive Heartbeat responses from Ambari Server. Hearbeat responses could contain commands for the agent to perform.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Ambari Web &amp;lt;/b&amp;gt; presents a user interface to monitor and manage a Hadoop cluster. Web module is written in JavaScript using ember.js framework. During our code study, we observed this module following the [https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller MVC] design methodology. The whole motivation of this module is to make it convenient to the end-user to manage the concerned Hadoop cluster.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Ambari Server &amp;lt;/b&amp;gt; is the most central component of an Ambari ecosystem. Ambari Server exposes [https://en.wikipedia.org/wiki/Application_programming_interface APIs]] to its clients such as Ambari Web, which monitors health of a cluster. Ambari Server clients can query for node health statuses. Ambari Server persists the nodes' statuses in a [https://en.wikipedia.org/wiki/PostgreSQL PostgreSQL] database in the backend. Internally, Ambari Server has several components which help it to manage its responsibilities. Ambari Server's important responsibilities are as follows:&lt;br /&gt;
&amp;lt;p&amp;gt; 1. Collect health statuses ( Heartbeats ) from Ambari agents. Process their statuses and send Heartbeat responses to Ambari agents. &amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt; 2. Handle requests from Ambari Server's clients: One such use case is installing a new service on an Ambari agent. This request could be received from Ambari Web and it is the server's responsibility to send appropriate instructions to the particular agent to get the new service up and running on the agent. &amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===='''Architectural design of WebSocket client-server in Apache Ambari'''====&lt;br /&gt;
[[File:Ambari-WebServerClient.png]]&lt;br /&gt;
&lt;br /&gt;
===='''Flow Diagram'''====&lt;br /&gt;
[[File:Ambari-Flow.png]]&lt;br /&gt;
&lt;br /&gt;
==='''Implementation'''===&lt;br /&gt;
===='''Design Pattern'''====&lt;br /&gt;
We have observed that Ambari project adopts various design patterns like [https://en.wikipedia.org/wiki/Singleton_pattern Singleton Pattern] in the Data Access Object Classes. For this project, we will be using [https://en.wikipedia.org/wiki/Request%E2%80%93response request-response], one of the [https://en.wikipedia.org/wiki/Messaging_pattern message exchange pattern].&lt;br /&gt;
&lt;br /&gt;
===='''UML Diagrams'''====&lt;br /&gt;
====='''Class Diagram'''=====&lt;br /&gt;
[[File:Ambari-UML.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;1. New class is added for both Web Socket client and Server.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;2. One method is added in the existing class &amp;quot;HeartBeatHandler&amp;quot; &amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Testing Framework'''==&lt;br /&gt;
The codebase is very well supported with unit tests. Following are a few important characteristics of the testing process that we observed during our code study:&lt;br /&gt;
&lt;br /&gt;
1. A popular mocking framework, [https://en.wikipedia.org/wiki/Mockito Mockito] is used to mock responses from dependent downstream services. An in-memory cluster is also mocked using Mockito. Mocking frameworks let us have our test cases fast and independent, which is very well depicted in this project. &lt;br /&gt;
&lt;br /&gt;
2. Every controller method is tested in and out. Tests are quite extensive and cover almost all the code branches, testing each and every feature thoroughly.&lt;br /&gt;
&lt;br /&gt;
3. Only the results/responses obtained from controller methods are asserted. We do not find any significant &amp;quot;verify() / expect()&amp;quot; calls. (&amp;quot;verify/expect&amp;quot; calls are used to assert if a given method was invoked during the test method execution). This is quite a good feature followed as the tests are implemented in a result-oriented way and are not bound to the method implementation in anyway. This also goes to show the stability of the tests as if the method implementation undergoes changes in future, it won't fail our tests.&lt;br /&gt;
&lt;br /&gt;
=='''Steps to build and test Ambari-WebSocket'''==&lt;br /&gt;
1. Clone the repository to your local system&amp;lt;br&amp;gt;&lt;br /&gt;
   git clone https://github.com/nisarg64/ambari&lt;br /&gt;
&lt;br /&gt;
2. Got to ambari directory and checkout the branch &amp;quot;migration&amp;quot; using below command&amp;lt;br&amp;gt;&lt;br /&gt;
   git checkout migration&lt;br /&gt;
&lt;br /&gt;
3. You will need nodeJs, maven etc to build the ambari. Check the requirements as described in [https://cwiki.apache.org/confluence/display/AMBARI/Ambari+Development Ambari PreConfigs]&lt;br /&gt;
&lt;br /&gt;
4. After having the required configurations, run below command to build &amp;lt;br&amp;gt;&lt;br /&gt;
   mvn clean package -DskipTests -Drat.ignoreErrors=true&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Project Benefits and Challenges'''==&lt;br /&gt;
'''Benefits:'''&lt;br /&gt;
&amp;lt;p&amp;gt;1. Web Socket will allow Ambari-Server to perform robustly in a large cluster setup with multiple browser sessions and when continuous heavy requests are being made&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Challenges:'''&lt;br /&gt;
&amp;lt;p&amp;gt;1. Ambari server uses [https://en.wikipedia.org/wiki/Jetty_%28web_server%29 Jetty] 8.x version, while support for Web Socket was made available after [https://en.wikipedia.org/wiki/Jetty_%28web_server%29 Jetty] 9.x&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;2. Ambari has a huge codebase with multiple modules and multiple frameworks and design patterns adopted. Understanding the flow of the project and taking care of dependencies is a huge challenge&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;3. For testing the code requires a cluster of around 3 nodes. Running 3 virtual machines requires a high performance machine.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Learning Outcomes'''==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;2. We also noticed in one of the classes called HeartBeatHandler, that it obeys the [https://en.wikipedia.org/wiki/Law_of_Demeter Law of Demeter]&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;3. For testing, project using the [https://en.wikipedia.org/wiki/Mockito Mockito] framework to mock the heartbeat and cluster functionality&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;4. For configuration management, [https://en.wikipedia.org/wiki/Puppet_%28software%29 Puppet] configuration management tool is used&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;5. Ambari-Web is implemented in [https://en.wikipedia.org/wiki/Ember.js Ember.js] which is an open-source Javascript framework that follows [https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller MVC] pattern similar to Rails framework.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;6. Ambari-server uses [https://en.wikipedia.org/wiki/Jetty_%28web_server%29 Jetty] which is a web-server to handle all the HTTP requests made onto the ambari-server from the UI&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Github Location'''==&lt;br /&gt;
 [https://github.com/apache/ambari Ambari Project]&lt;br /&gt;
&lt;br /&gt;
Forked Repository:&lt;br /&gt;
 [https://github.com/nisarg64/ambari Forked Repo]&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;p&amp;gt;https://ambari.apache.org/&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;https://en.wikipedia.org/wiki/Apache_Ambari&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;https://cwiki.apache.org/confluence/display/AMBARI/Ambari&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;https://issues.apache.org/jira/secure/attachment/12559939/Ambari_Architecture.pdf&amp;lt;/p&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rpsingh3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Ambari-WebServerClient.png&amp;diff=99847</id>
		<title>File:Ambari-WebServerClient.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Ambari-WebServerClient.png&amp;diff=99847"/>
		<updated>2015-11-14T03:12:52Z</updated>

		<summary type="html">&lt;p&gt;Rpsingh3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Rpsingh3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_A1550_Web_Socket_Implementation_in_Apache_Ambari&amp;diff=99544</id>
		<title>CSC/ECE 517 Fall 2015 A1550 Web Socket Implementation in Apache Ambari</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_A1550_Web_Socket_Implementation_in_Apache_Ambari&amp;diff=99544"/>
		<updated>2015-11-13T10:48:26Z</updated>

		<summary type="html">&lt;p&gt;Rpsingh3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction'''==&lt;br /&gt;
&lt;br /&gt;
Apache Ambari is a software project of the [https://en.wikipedia.org/wiki/Apache_Software_Foundation Apache Software Foundation], is aimed at making [https://en.wikipedia.org/wiki/Apache_Hadoop Hadoop] management simpler by developing software for provisioning, managing, and monitoring Apache Hadoop clusters. Ambari provides an intuitive, easy-to-use [https://en.wikipedia.org/wiki/Apache_Hadoop Hadoop] management web UI backed by its [https://en.wikipedia.org/wiki/Representational_state_transfer RESTful] APIs. Ambari was a sub-project of [https://en.wikipedia.org/wiki/Apache_Hadoop Hadoop] but is now a [https://en.wikipedia.org/wiki/Apache_Software_Foundation#Projects top-level] project in its own right.&lt;br /&gt;
&lt;br /&gt;
An Apache Hadoop cluster consists on a group or nodes/machines. Each node acts as an Ambari Agent that runs various service components (e.g. Datanode for HDFS). One of the agents acts as an Ambari Server that takes care of the task allocation, management, gathering information about the services status and other information from the agents and giving the information to Ambari UI for display. More information about Agent-Server-Web flow is available in the following sections.&lt;br /&gt;
&lt;br /&gt;
Ambari-Web uses simple ajax polling mechanism to fetch data from Ambari-Server. Constant polling is done to show current service status, alerts, service graphs, etc on Ambari-Web. With this mechanism, the performance of Ambari-Server can be affected on a large size cluster with multiple active browser sessions due to continuous heavy requests being made. &lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/WebSocket WebSocket] is a protocol providing full-duplex communication channels over a single TCP connection. Implementing Web-Socket between Ambari-Web and Ambari-Server will be helpful to address this scenario.&lt;br /&gt;
&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;font color = &amp;quot;red&amp;quot;&amp;gt; Note: This is continuation of our OSS project &amp;lt;/font&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==='''Project Goals'''===&lt;br /&gt;
&amp;lt;p&amp;gt;1. Understand architecture of Ambari-Server and Ambari-web&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;2. Replace the current pull-based mechanism with the push-based mechanism via Web-Socket&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;3. Write test cases for the Web Socket implementation to test the functionalities of WebSocket Client and WebSocket Server&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==='''Project Design'''===&lt;br /&gt;
Ambari is a multi-module Maven project. The relevant modules for our project from an implementation perspective are Ambari Web and Ambari Server. Ambari Agent is another module, important functionally.&lt;br /&gt;
&lt;br /&gt;
===='''Major Components'''====&lt;br /&gt;
&amp;lt;b&amp;gt;Ambari Agent &amp;lt;/b&amp;gt; is a component that resides on every node of the cluster. Its responsibility is to collect the node's overall health which comprises of the health metrics of all the different services running on that node. Ambari Agent sends these statuses to the Ambari Server in the form of periodic messages which is termed as 'heartbeat' in the Ambari nomenclature. In return, Ambari agents receive Heartbeat responses from Ambari Server. Hearbeat responses could contain commands for the agent to perform.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Ambari Web &amp;lt;/b&amp;gt; presents a user interface to monitor and manage a Hadoop cluster. Web module is written in JavaScript using ember.js framework. During our code study, we observed this module following the [https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller MVC] design methodology. The whole motivation of this module is to make it convenient to the end-user to manage the concerned Hadoop cluster.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Ambari Server &amp;lt;/b&amp;gt; is the most central component of an Ambari ecosystem. Ambari Server exposes [https://en.wikipedia.org/wiki/Application_programming_interface APIs]] to its clients such as Ambari Web, which monitors health of a cluster. Ambari Server clients can query for node health statuses. Ambari Server persists the nodes' statuses in a [https://en.wikipedia.org/wiki/PostgreSQL PostgreSQL] database in the backend. Internally, Ambari Server has several components which help it to manage its responsibilities. Ambari Server's important responsibilities are as follows:&lt;br /&gt;
&amp;lt;p&amp;gt; 1. Collect health statuses ( heartbeats ) from Ambari agents. Process their statuses and send heartbeat responses to Ambari agents. &amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt; 2. Handle requests from Ambari Server's clients: One such use case is installing a new service on an Ambari agent. This request could be received from Ambari Web and it is the server's responsibility to send appropriate instructions to the particular agent to get the new service up and running on the agent. &amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===='''Architectural design of WebSocket client-server in Apache Ambari'''====&lt;br /&gt;
[[File:Ambari-WebSocket.png]]&lt;br /&gt;
&lt;br /&gt;
===='''Flow Diagram'''====&lt;br /&gt;
[[File:Ambari-Flow.png]]&lt;br /&gt;
&lt;br /&gt;
==='''Implementation'''===&lt;br /&gt;
===='''Design Pattern'''====&lt;br /&gt;
We have observed that Ambari project adopts various design patterns like [https://en.wikipedia.org/wiki/Singleton_pattern Singleton Pattern] in the Data Access Object Classes. For this project, we will be using [https://en.wikipedia.org/wiki/Request%E2%80%93response request-response], one of the [https://en.wikipedia.org/wiki/Messaging_pattern message exchange pattern].&lt;br /&gt;
&lt;br /&gt;
===='''UML Diagrams'''====&lt;br /&gt;
====='''Class Diagram'''=====&lt;br /&gt;
[[File:Ambari-UML.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;1. New class is added for both Web Socket client and Server.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;2. One method is added in the existing class &amp;quot;HeartBeatHandler&amp;quot; &amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Testing Framework'''==&lt;br /&gt;
The codebase is very well supported with unit tests. Following are a few important characteristics of the testing process that we observed during our code study:&lt;br /&gt;
&lt;br /&gt;
1. A popular mocking framework, [https://en.wikipedia.org/wiki/Mockito Mockito] is used to mock responses from dependent downstream services. An in-memory cluster is also mocked using Mockito. Mocking frameworks let us have our test cases fast and independent, which is very well depicted in this project. &lt;br /&gt;
&lt;br /&gt;
2. Every controller method is tested in and out. Tests are quite extensive and cover almost all the code branches, testing each and every feature thoroughly.&lt;br /&gt;
&lt;br /&gt;
3. Only the results/responses obtained from controller methods are asserted. We do not find any significant &amp;quot;verify() / expect()&amp;quot; calls. (&amp;quot;verify/expect&amp;quot; calls are used to assert if a given method was invoked during the test method execution). This is quite a good feature followed as the tests are implemented in a result-oriented way and are not bound to the method implementation in anyway. This also goes to show the stability of the tests as if the method implementation undergoes changes in future, it won't fail our tests.&lt;br /&gt;
&lt;br /&gt;
=='''Steps to build and test Ambari-WebSocket'''==&lt;br /&gt;
1. Clone the repository to your local system&amp;lt;br&amp;gt;&lt;br /&gt;
   git clone https://github.com/nisarg64/ambari&lt;br /&gt;
&lt;br /&gt;
2. Got to ambari directory and checkout the branch &amp;quot;migration&amp;quot; using below command&amp;lt;br&amp;gt;&lt;br /&gt;
   git checkout migration&lt;br /&gt;
&lt;br /&gt;
3. You will need nodeJs, maven etc to build the ambari. Check the requirements as described in [https://cwiki.apache.org/confluence/display/AMBARI/Ambari+Development Ambari PreConfigs]&lt;br /&gt;
&lt;br /&gt;
4. After having the required configurations, run below command to build &amp;lt;br&amp;gt;&lt;br /&gt;
   mvn clean package -DskipTests -Drat.ignoreErrors=true&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Project Benefits and Challenges'''==&lt;br /&gt;
'''Benefits:'''&lt;br /&gt;
&amp;lt;p&amp;gt;1. Web Socket will allow Ambari-Server to perform robustly in a large cluster setup with multiple browser sessions and when continuous heavy requests are being made&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Challenges:'''&lt;br /&gt;
&amp;lt;p&amp;gt;1. Ambari server uses [https://en.wikipedia.org/wiki/Jetty_%28web_server%29 Jetty] 8.x version, while support for Web Socket was made available after [https://en.wikipedia.org/wiki/Jetty_%28web_server%29 Jetty] 9.x&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;2. Ambari has a huge codebase with multiple modules and multiple frameworks and design patterns adopted. Understanding the flow of the project and taking care of dependencies is a huge challenge&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;3. For testing the code requires a cluster of around 3 nodes. Running 3 virtual machines requires a high performance machine.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Learning Outcomes'''==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;2. We also noticed in one of the classes called HeartBeatHandler, that it obeys the [https://en.wikipedia.org/wiki/Law_of_Demeter Law of Demeter]&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;3. For testing, project using the [https://en.wikipedia.org/wiki/Mockito Mockito] framework to mock the heartbeat and cluster functionality&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;4. For configuration management, [https://en.wikipedia.org/wiki/Puppet_%28software%29 Puppet] configuration management tool is used&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;5. Ambari-Web is implemented in [https://en.wikipedia.org/wiki/Ember.js Ember.js] which is an open-source Javascript framework that follows [https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller MVC] pattern similar to Rails framework.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;6. Ambari-server uses [https://en.wikipedia.org/wiki/Jetty_%28web_server%29 Jetty] which is a web-server to handle all the HTTP requests made onto the ambari-server from the UI&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Github Location'''==&lt;br /&gt;
 [https://github.com/apache/ambari Ambari Project]&lt;br /&gt;
&lt;br /&gt;
Forked Repository:&lt;br /&gt;
 [https://github.com/nisarg64/ambari Forked Repo]&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;p&amp;gt;https://ambari.apache.org/&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;https://en.wikipedia.org/wiki/Apache_Ambari&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;https://cwiki.apache.org/confluence/display/AMBARI/Ambari&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;https://issues.apache.org/jira/secure/attachment/12559939/Ambari_Architecture.pdf&amp;lt;/p&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rpsingh3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_A1550_Web_Socket_Implementation_in_Apache_Ambari&amp;diff=99489</id>
		<title>CSC/ECE 517 Fall 2015 A1550 Web Socket Implementation in Apache Ambari</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_A1550_Web_Socket_Implementation_in_Apache_Ambari&amp;diff=99489"/>
		<updated>2015-11-12T08:11:37Z</updated>

		<summary type="html">&lt;p&gt;Rpsingh3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction'''==&lt;br /&gt;
&lt;br /&gt;
Apache Ambari is a software project of the [https://en.wikipedia.org/wiki/Apache_Software_Foundation Apache Software Foundation], is aimed at making [https://en.wikipedia.org/wiki/Apache_Hadoop Hadoop] management simpler by developing software for provisioning, managing, and monitoring Apache Hadoop clusters. Ambari provides an intuitive, easy-to-use [https://en.wikipedia.org/wiki/Apache_Hadoop Hadoop] management web UI backed by its [https://en.wikipedia.org/wiki/Representational_state_transfer RESTful] APIs. Ambari was a sub-project of [https://en.wikipedia.org/wiki/Apache_Hadoop Hadoop] but is now a [https://en.wikipedia.org/wiki/Apache_Software_Foundation#Projects top-level] project in its own right.&lt;br /&gt;
&lt;br /&gt;
An Apache Hadoop cluster consists on a group or nodes/machines. Each node acts as an Ambari Agent that runs various service components (e.g. Datanode for HDFS). One of the agents acts as an Ambari Server that takes care of the task allocation, management, gathering information about the services status and other information from the agents and giving the information to Ambari UI for display. More information about Agent-Server-Web flow is available in the following sections.&lt;br /&gt;
&lt;br /&gt;
Ambari-Web uses simple ajax polling mechanism to fetch data from Ambari-Server. Constant polling is done to show current service status, alerts, service graphs, etc on Ambari-Web. With this mechanism, the performance of Ambari-Server can be affected on a large size cluster with multiple active browser sessions due to continuous heavy requests being made. &lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/WebSocket WebSocket] is a protocol providing full-duplex communication channels over a single TCP connection. Implementing Web-Socket between Ambari-Web and Ambari-Server will be helpful to address this scenario.&lt;br /&gt;
&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
==='''Project Goals'''===&lt;br /&gt;
&amp;lt;p&amp;gt;1. Understand architecture of Ambari-Server and Ambari-web&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;2. Replace the current pull-based mechanism with the push-based mechanism via Web-Socket&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;3. Write test cases for the Web Socket implementation to test the functionalities of WebSocket Client and WebSocket Server&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==='''Project Design'''===&lt;br /&gt;
Ambari is a multi-module Maven project. The relevant modules for our project from an implementation perspective are Ambari Web and Ambari Server. Ambari Agent is another module, important functionally.&lt;br /&gt;
&lt;br /&gt;
===='''Major Components'''====&lt;br /&gt;
&amp;lt;b&amp;gt;Ambari Agent &amp;lt;/b&amp;gt; is a component that resides on every node of the cluster. Its responsibility is to collect the node's overall health which comprises of the health metrics of all the different services running on that node. Ambari Agent sends these statuses to the Ambari Server in the form of periodic messages which is termed as 'heartbeat' in the Ambari nomenclature. In return, Ambari agents receive Heartbeat responses from Ambari Server. Hearbeat responses could contain commands for the agent to perform.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Ambari Web &amp;lt;/b&amp;gt; presents a user interface to monitor and manage a Hadoop cluster. Web module is written in JavaScript using ember.js framework. During our code study, we observed this module following the [https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller MVC] design methodology. The whole motivation of this module is to make it convenient to the end-user to manage the concerned Hadoop cluster.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Ambari Server &amp;lt;/b&amp;gt; is the most central component of an Ambari ecosystem. Ambari Server exposes [https://en.wikipedia.org/wiki/Application_programming_interface APIs]] to its clients such as Ambari Web, which monitors health of a cluster. Ambari Server clients can query for node health statuses. Ambari Server persists the nodes' statuses in a [https://en.wikipedia.org/wiki/PostgreSQL PostgreSQL] database in the backend. Internally, Ambari Server has several components which help it to manage its responsibilities. Ambari Server's important responsibilities are as follows:&lt;br /&gt;
&amp;lt;p&amp;gt; 1. Collect health statuses ( heartbeats ) from Ambari agents. Process their statuses and send heartbeat responses to Ambari agents. &amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt; 2. Handle requests from Ambari Server's clients: One such use case is installing a new service on an Ambari agent. This request could be received from Ambari Web and it is the server's responsibility to send appropriate instructions to the particular agent to get the new service up and running on the agent. &amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===='''Architectural design of WebSocket client-server in Apache Ambari'''====&lt;br /&gt;
[[File:Ambari-WebSocket.png]]&lt;br /&gt;
&lt;br /&gt;
===='''Flow Diagram'''====&lt;br /&gt;
[[File:Ambari-Flow.png]]&lt;br /&gt;
&lt;br /&gt;
==='''Implementation'''===&lt;br /&gt;
===='''Design Pattern'''====&lt;br /&gt;
We have observed that Ambari project adopts various design patterns like [https://en.wikipedia.org/wiki/Singleton_pattern Singleton Pattern] in the Data Access Object Classes. For this project, we will be using [https://en.wikipedia.org/wiki/Request%E2%80%93response request-response], one of the [https://en.wikipedia.org/wiki/Messaging_pattern message exchange pattern].&lt;br /&gt;
&lt;br /&gt;
===='''UML Diagrams'''====&lt;br /&gt;
====='''Class Diagram'''=====&lt;br /&gt;
[[File:Ambari-UML.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;1. New class is added for both Web Socket client and Server.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;2. One method is added in the existing class &amp;quot;HeartBeatHandler&amp;quot; &amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Testing Framework'''==&lt;br /&gt;
The codebase is very well supported with unit tests. Following are a few important characteristics of the testing process that we observed during our code study:&lt;br /&gt;
&lt;br /&gt;
1. A popular mocking framework, [https://en.wikipedia.org/wiki/Mockito Mockito] is used to mock responses from dependent downstream services. An in-memory cluster is also mocked using Mockito. Mocking frameworks let us have our test cases fast and independent, which is very well depicted in this project. &lt;br /&gt;
&lt;br /&gt;
2. Every controller method is tested in and out. Tests are quite extensive and cover almost all the code branches, testing each and every feature thoroughly.&lt;br /&gt;
&lt;br /&gt;
3. Only the results/responses obtained from controller methods are asserted. We do not find any significant &amp;quot;verify() / expect()&amp;quot; calls. (&amp;quot;verify/expect&amp;quot; calls are used to assert if a given method was invoked during the test method execution). This is quite a good feature followed as the tests are implemented in a result-oriented way and are not bound to the method implementation in anyway. This also goes to show the stability of the tests as if the method implementation undergoes changes in future, it won't fail our tests.&lt;br /&gt;
&lt;br /&gt;
=='''Steps to build and test Ambari-WebSocket'''==&lt;br /&gt;
1. Clone the repository to your local system&amp;lt;br&amp;gt;&lt;br /&gt;
   git clone https://github.com/nisarg64/ambari&lt;br /&gt;
&lt;br /&gt;
2. Got to ambari directory and checkout the branch &amp;quot;migration&amp;quot; using below command&amp;lt;br&amp;gt;&lt;br /&gt;
   git checkout migration&lt;br /&gt;
&lt;br /&gt;
3. You will need nodeJs, maven etc to build the ambari. Check the requirements as described in [https://cwiki.apache.org/confluence/display/AMBARI/Ambari+Development Ambari PreConfigs]&lt;br /&gt;
&lt;br /&gt;
4. After having the required configurations, run below command to build &amp;lt;br&amp;gt;&lt;br /&gt;
   mvn clean package -DskipTests -Drat.ignoreErrors=true&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Project Benefits and Challenges'''==&lt;br /&gt;
'''Benefits:'''&lt;br /&gt;
&amp;lt;p&amp;gt;1. Web Socket will allow Ambari-Server to perform robustly in a large cluster setup with multiple browser sessions and when continuous heavy requests are being made&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Challenges:'''&lt;br /&gt;
&amp;lt;p&amp;gt;1. Ambari server uses [https://en.wikipedia.org/wiki/Jetty_%28web_server%29 Jetty] 8.x version, while support for Web Socket was made available after [https://en.wikipedia.org/wiki/Jetty_%28web_server%29 Jetty] 9.x&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;2. Ambari has a huge codebase with multiple modules and multiple frameworks and design patterns adopted. Understanding the flow of the project and taking care of dependencies is a huge challenge&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;3. For testing the code requires a cluster of around 3 nodes. Running 3 virtual machines requires a high performance machine.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;font color = &amp;quot;red&amp;quot;&amp;gt; Note: This is continuation of our OSS project &amp;lt;/font&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Learning Outcomes'''==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;2. We also noticed in one of the classes called HeartBeatHandler, that it obeys the [https://en.wikipedia.org/wiki/Law_of_Demeter Law of Demeter]&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;3. For testing, project using the [https://en.wikipedia.org/wiki/Mockito Mockito] framework to mock the heartbeat and cluster functionality&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;4. For configuration management, [https://en.wikipedia.org/wiki/Puppet_%28software%29 Puppet] configuration management tool is used&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;5. Ambari-Web is implemented in [https://en.wikipedia.org/wiki/Ember.js Ember.js] which is an open-source Javascript framework that follows [https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller MVC] pattern similar to Rails framework.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;6. Ambari-server uses [https://en.wikipedia.org/wiki/Jetty_%28web_server%29 Jetty] which is a web-server to handle all the HTTP requests made onto the ambari-server from the UI&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Github Location'''==&lt;br /&gt;
 [https://github.com/apache/ambari Ambari Project]&lt;br /&gt;
&lt;br /&gt;
Forked Repository:&lt;br /&gt;
 [https://github.com/nisarg64/ambari Forked Repo]&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;p&amp;gt;https://ambari.apache.org/&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;https://en.wikipedia.org/wiki/Apache_Ambari&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;https://cwiki.apache.org/confluence/display/AMBARI/Ambari&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;https://issues.apache.org/jira/secure/attachment/12559939/Ambari_Architecture.pdf&amp;lt;/p&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rpsingh3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Ambari-UML.png&amp;diff=99488</id>
		<title>File:Ambari-UML.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Ambari-UML.png&amp;diff=99488"/>
		<updated>2015-11-12T08:08:03Z</updated>

		<summary type="html">&lt;p&gt;Rpsingh3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Rpsingh3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_A1550_Web_Socket_Implementation_in_Apache_Ambari&amp;diff=99487</id>
		<title>CSC/ECE 517 Fall 2015 A1550 Web Socket Implementation in Apache Ambari</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_A1550_Web_Socket_Implementation_in_Apache_Ambari&amp;diff=99487"/>
		<updated>2015-11-12T08:02:26Z</updated>

		<summary type="html">&lt;p&gt;Rpsingh3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction'''==&lt;br /&gt;
&lt;br /&gt;
Apache Ambari is a software project of the [https://en.wikipedia.org/wiki/Apache_Software_Foundation Apache Software Foundation], is aimed at making [https://en.wikipedia.org/wiki/Apache_Hadoop Hadoop] management simpler by developing software for provisioning, managing, and monitoring Apache Hadoop clusters. Ambari provides an intuitive, easy-to-use [https://en.wikipedia.org/wiki/Apache_Hadoop Hadoop] management web UI backed by its [https://en.wikipedia.org/wiki/Representational_state_transfer RESTful] APIs. Ambari was a sub-project of [https://en.wikipedia.org/wiki/Apache_Hadoop Hadoop] but is now a [https://en.wikipedia.org/wiki/Apache_Software_Foundation#Projects top-level] project in its own right.&lt;br /&gt;
&lt;br /&gt;
An Apache Hadoop cluster consists on a group or nodes/machines. Each node acts as an Ambari Agent that runs various service components (e.g. Datanode for HDFS). One of the agents acts as an Ambari Server that takes care of the task allocation, management, gathering information about the services status and other information from the agents and giving the information to Ambari UI for display. More information about Agent-Server-Web flow is available in the following sections.&lt;br /&gt;
&lt;br /&gt;
Ambari-Web uses simple ajax polling mechanism to fetch data from Ambari-Server. Constant polling is done to show current service status, alerts, service graphs, etc on Ambari-Web. With this mechanism, the performance of Ambari-Server can be affected on a large size cluster with multiple active browser sessions due to continuous heavy requests being made. &lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/WebSocket WebSocket] is a protocol providing full-duplex communication channels over a single TCP connection. Implementing Web-Socket between Ambari-Web and Ambari-Server will be helpful to address this scenario.&lt;br /&gt;
&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
==='''Project Goals'''===&lt;br /&gt;
&amp;lt;p&amp;gt;1. Understand architecture of Ambari-Server and Ambari-web&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;2. Replace the current pull-based mechanism with the push-based mechanism via Web-Socket&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;3. Write test cases for the Web Socket implementation to test the functionalities of WebSocket Client and WebSocket Server&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==='''Project Design'''===&lt;br /&gt;
Ambari is a multi-module Maven project. The relevant modules for our project from an implementation perspective are Ambari Web and Ambari Server. Ambari Agent is another module, important functionally.&lt;br /&gt;
&lt;br /&gt;
===='''Major Components'''====&lt;br /&gt;
&amp;lt;b&amp;gt;Ambari Agent &amp;lt;/b&amp;gt; is a component that resides on every node of the cluster. Its responsibility is to collect the node's overall health which comprises of the health metrics of all the different services running on that node. Ambari Agent sends these statuses to the Ambari Server in the form of periodic messages which is termed as 'heartbeat' in the Ambari nomenclature. In return, Ambari agents receive Heartbeat responses from Ambari Server. Hearbeat responses could contain commands for the agent to perform.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Ambari Web &amp;lt;/b&amp;gt; presents a user interface to monitor and manage a Hadoop cluster. Web module is written in JavaScript using ember.js framework. During our code study, we observed this module following the [https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller MVC] design methodology. The whole motivation of this module is to make it convenient to the end-user to manage the concerned Hadoop cluster.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Ambari Server &amp;lt;/b&amp;gt; is the most central component of an Ambari ecosystem. Ambari Server exposes [https://en.wikipedia.org/wiki/Application_programming_interface APIs]] to its clients such as Ambari Web, which monitors health of a cluster. Ambari Server clients can query for node health statuses. Ambari Server persists the nodes' statuses in a [https://en.wikipedia.org/wiki/PostgreSQL PostgreSQL] database in the backend. Internally, Ambari Server has several components which help it to manage its responsibilities. Ambari Server's important responsibilities are as follows:&lt;br /&gt;
&amp;lt;p&amp;gt; 1. Collect health statuses ( heartbeats ) from Ambari agents. Process their statuses and send heartbeat responses to Ambari agents. &amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt; 2. Handle requests from Ambari Server's clients: One such use case is installing a new service on an Ambari agent. This request could be received from Ambari Web and it is the server's responsibility to send appropriate instructions to the particular agent to get the new service up and running on the agent. &amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===='''Architectural design of WebSocket client-server in Apache Ambari'''====&lt;br /&gt;
[[File:Ambari-WebSocket.png]]&lt;br /&gt;
&lt;br /&gt;
===='''Flow Diagram'''====&lt;br /&gt;
[[File:Ambari-Flow.png]]&lt;br /&gt;
&lt;br /&gt;
==='''Implementation'''===&lt;br /&gt;
===='''Design Pattern'''====&lt;br /&gt;
We have observed that Ambari project adopts various design patterns like [https://en.wikipedia.org/wiki/Singleton_pattern Singleton Pattern] in the Data Access Object Classes. For this project, we will be using [https://en.wikipedia.org/wiki/Request%E2%80%93response request-response], one of the [https://en.wikipedia.org/wiki/Messaging_pattern message exchange pattern].&lt;br /&gt;
&lt;br /&gt;
===='''UML Diagrams'''====&lt;br /&gt;
&lt;br /&gt;
[[File:Ambari-ClassDiagram.png]]&lt;br /&gt;
&lt;br /&gt;
=='''Testing Framework'''==&lt;br /&gt;
The codebase is very well supported with unit tests. Following are a few important characteristics of the testing process that we observed during our code study:&lt;br /&gt;
&lt;br /&gt;
1. A popular mocking framework, [https://en.wikipedia.org/wiki/Mockito Mockito] is used to mock responses from dependent downstream services. An in-memory cluster is also mocked using Mockito. Mocking frameworks let us have our test cases fast and independent, which is very well depicted in this project. &lt;br /&gt;
&lt;br /&gt;
2. Every controller method is tested in and out. Tests are quite extensive and cover almost all the code branches, testing each and every feature thoroughly.&lt;br /&gt;
&lt;br /&gt;
3. Only the results/responses obtained from controller methods are asserted. We do not find any significant &amp;quot;verify() / expect()&amp;quot; calls. (&amp;quot;verify/expect&amp;quot; calls are used to assert if a given method was invoked during the test method execution). This is quite a good feature followed as the tests are implemented in a result-oriented way and are not bound to the method implementation in anyway. This also goes to show the stability of the tests as if the method implementation undergoes changes in future, it won't fail our tests.&lt;br /&gt;
&lt;br /&gt;
=='''Steps to build and test Ambari-WebSocket'''==&lt;br /&gt;
1. Clone the repository to your local system&amp;lt;br&amp;gt;&lt;br /&gt;
   git clone https://github.com/nisarg64/ambari&lt;br /&gt;
&lt;br /&gt;
2. Got to ambari directory and checkout the branch &amp;quot;migration&amp;quot; using below command&amp;lt;br&amp;gt;&lt;br /&gt;
   git checkout migration&lt;br /&gt;
&lt;br /&gt;
3. You will need nodeJs, maven etc to build the ambari. Check the requirements as described in [https://cwiki.apache.org/confluence/display/AMBARI/Ambari+Development Ambari PreConfigs]&lt;br /&gt;
&lt;br /&gt;
4. After having the required configurations, run below command to build &amp;lt;br&amp;gt;&lt;br /&gt;
   mvn clean package -DskipTests -Drat.ignoreErrors=true&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Project Benefits and Challenges'''==&lt;br /&gt;
'''Benefits:'''&lt;br /&gt;
&amp;lt;p&amp;gt;1. Web Socket will allow Ambari-Server to perform robustly in a large cluster setup with multiple browser sessions and when continuous heavy requests are being made&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Challenges:'''&lt;br /&gt;
&amp;lt;p&amp;gt;1. Ambari server uses [https://en.wikipedia.org/wiki/Jetty_%28web_server%29 Jetty] 8.x version, while support for Web Socket was made available after [https://en.wikipedia.org/wiki/Jetty_%28web_server%29 Jetty] 9.x&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;2. Ambari has a huge codebase with multiple modules and multiple frameworks and design patterns adopted. Understanding the flow of the project and taking care of dependencies is a huge challenge&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;3. For testing the code requires a cluster of around 3 nodes. Running 3 virtual machines requires a high performance machine.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;font color = &amp;quot;red&amp;quot;&amp;gt; Note: This is continuation of our OSS project &amp;lt;/font&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Learning Outcomes'''==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;2. We also noticed in one of the classes called HeartBeatHandler, that it obeys the [https://en.wikipedia.org/wiki/Law_of_Demeter Law of Demeter]&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;3. For testing, project using the [https://en.wikipedia.org/wiki/Mockito Mockito] framework to mock the heartbeat and cluster functionality&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;4. For configuration management, [https://en.wikipedia.org/wiki/Puppet_%28software%29 Puppet] configuration management tool is used&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;5. Ambari-Web is implemented in [https://en.wikipedia.org/wiki/Ember.js Ember.js] which is an open-source Javascript framework that follows [https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller MVC] pattern similar to Rails framework.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;6. Ambari-server uses [https://en.wikipedia.org/wiki/Jetty_%28web_server%29 Jetty] which is a web-server to handle all the HTTP requests made onto the ambari-server from the UI&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Github Location'''==&lt;br /&gt;
 [https://github.com/apache/ambari Ambari Project]&lt;br /&gt;
&lt;br /&gt;
Forked Repository:&lt;br /&gt;
 [https://github.com/nisarg64/ambari Forked Repo]&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;p&amp;gt;https://ambari.apache.org/&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;https://en.wikipedia.org/wiki/Apache_Ambari&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;https://cwiki.apache.org/confluence/display/AMBARI/Ambari&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;https://issues.apache.org/jira/secure/attachment/12559939/Ambari_Architecture.pdf&amp;lt;/p&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rpsingh3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_A1550_Web_Socket_Implementation_in_Apache_Ambari&amp;diff=99486</id>
		<title>CSC/ECE 517 Fall 2015 A1550 Web Socket Implementation in Apache Ambari</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_A1550_Web_Socket_Implementation_in_Apache_Ambari&amp;diff=99486"/>
		<updated>2015-11-12T08:01:55Z</updated>

		<summary type="html">&lt;p&gt;Rpsingh3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction'''==&lt;br /&gt;
&lt;br /&gt;
Apache Ambari is a software project of the [https://en.wikipedia.org/wiki/Apache_Software_Foundation Apache Software Foundation], is aimed at making [https://en.wikipedia.org/wiki/Apache_Hadoop Hadoop] management simpler by developing software for provisioning, managing, and monitoring Apache Hadoop clusters. Ambari provides an intuitive, easy-to-use [https://en.wikipedia.org/wiki/Apache_Hadoop Hadoop] management web UI backed by its [https://en.wikipedia.org/wiki/Representational_state_transfer RESTful] APIs. Ambari was a sub-project of [https://en.wikipedia.org/wiki/Apache_Hadoop Hadoop] but is now a [https://en.wikipedia.org/wiki/Apache_Software_Foundation#Projects top-level] project in its own right.&lt;br /&gt;
&lt;br /&gt;
An Apache Hadoop cluster consists on a group or nodes/machines. Each node acts as an Ambari Agent that runs various service components (e.g. Datanode for HDFS). One of the agents acts as an Ambari Server that takes care of the task allocation, management, gathering information about the services status and other information from the agents and giving the information to Ambari UI for display. More information about Agent-Server-Web flow is available in the following sections.&lt;br /&gt;
&lt;br /&gt;
Ambari-Web uses simple ajax polling mechanism to fetch data from Ambari-Server. Constant polling is done to show current service status, alerts, service graphs, etc on Ambari-Web. With this mechanism, the performance of Ambari-Server can be affected on a large size cluster with multiple active browser sessions due to continuous heavy requests being made. &lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/WebSocket WebSocket] is a protocol providing full-duplex communication channels over a single TCP connection. Implementing Web-Socket between Ambari-Web and Ambari-Server will be helpful to address this scenario.&lt;br /&gt;
&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
==='''Project Goals'''===&lt;br /&gt;
&amp;lt;p&amp;gt;1. Understand architecture of Ambari-Server and Ambari-web&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;2. Replace the current pull-based mechanism with the push-based mechanism via Web-Socket&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;3. Write test cases for the Web Socket implementation to test the functionalities of WebSocket Client and WebSocket Server&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==='''Project Design'''===&lt;br /&gt;
Ambari is a multi-module Maven project. The relevant modules for our project from an implementation perspective are Ambari Web and Ambari Server. Ambari Agent is another module, important functionally.&lt;br /&gt;
&lt;br /&gt;
===='''Major Components'''====&lt;br /&gt;
&amp;lt;b&amp;gt;Ambari Agent &amp;lt;/b&amp;gt; is a component that resides on every node of the cluster. Its responsibility is to collect the node's overall health which comprises of the health metrics of all the different services running on that node. Ambari Agent sends these statuses to the Ambari Server in the form of periodic messages which is termed as 'heartbeat' in the Ambari nomenclature. In return, Ambari agents receive Heartbeat responses from Ambari Server. Hearbeat responses could contain commands for the agent to perform.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Ambari Web &amp;lt;/b&amp;gt; presents a user interface to monitor and manage a Hadoop cluster. Web module is written in JavaScript using ember.js framework. During our code study, we observed this module following the [https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller MVC] design methodology. The whole motivation of this module is to make it convenient to the end-user to manage the concerned Hadoop cluster.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Ambari Server &amp;lt;/b&amp;gt; is the most central component of an Ambari ecosystem. Ambari Server exposes [https://en.wikipedia.org/wiki/Application_programming_interface APIs]] to its clients such as Ambari Web, which monitors health of a cluster. Ambari Server clients can query for node health statuses. Ambari Server persists the nodes' statuses in a [https://en.wikipedia.org/wiki/PostgreSQL PostgreSQL] database in the backend. Internally, Ambari Server has several components which help it to manage its responsibilities. Ambari Server's important responsibilities are as follows:&lt;br /&gt;
&amp;lt;p&amp;gt; 1. Collect health statuses ( heartbeats ) from Ambari agents. Process their statuses and send heartbeat responses to Ambari agents. &amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt; 2. Handle requests from Ambari Server's clients: One such use case is installing a new service on an Ambari agent. This request could be received from Ambari Web and it is the server's responsibility to send appropriate instructions to the particular agent to get the new service up and running on the agent. &amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===='''Architectural design of WebSocket client-server in Apache Ambari'''====&lt;br /&gt;
[[File:Ambari-WebSocket.png]]&lt;br /&gt;
&lt;br /&gt;
===='''Flow Diagram'''====&lt;br /&gt;
[[File:Ambari-Flow.png]]&lt;br /&gt;
&lt;br /&gt;
==='''Implementation'''===&lt;br /&gt;
===='''Design Pattern'''====&lt;br /&gt;
We have observed that Ambari project adopts various design patterns like [https://en.wikipedia.org/wiki/Singleton_pattern Singleton Pattern] in the Data Access Object Classes. For this project, we will be using [https://en.wikipedia.org/wiki/Request%E2%80%93response request-response], one of the [https://en.wikipedia.org/wiki/Messaging_pattern message exchange pattern].&lt;br /&gt;
&lt;br /&gt;
===='''UML Diagrams'''====&lt;br /&gt;
&lt;br /&gt;
[[File:Ambari-ClassDiagram.png]]&lt;br /&gt;
&lt;br /&gt;
=='''Testing Framework'''==&lt;br /&gt;
The codebase is very well supported with unit tests. Following are a few important characteristics of the testing process that we observed during our code study:&lt;br /&gt;
&lt;br /&gt;
1. A popular mocking framework, [https://en.wikipedia.org/wiki/Mockito Mockito] is used to mock responses from dependent downstream services. An in-memory cluster is also mocked using Mockito. Mocking frameworks let us have our test cases fast and independent, which is very well depicted in this project. &lt;br /&gt;
&lt;br /&gt;
2. Every controller method is tested in and out. Tests are quite extensive and cover almost all the code branches, testing each and every feature thoroughly.&lt;br /&gt;
&lt;br /&gt;
3. Only the results/responses obtained from controller methods are asserted. We do not find any significant &amp;quot;verify() / expect()&amp;quot; calls. (&amp;quot;verify/expect&amp;quot; calls are used to assert if a given method was invoked during the test method execution). This is quite a good feature followed as the tests are implemented in a result-oriented way and are not bound to the method implementation in anyway. This also goes to show the stability of the tests as if the method implementation undergoes changes in future, it won't fail our tests.&lt;br /&gt;
&lt;br /&gt;
=='''Steps to build and test Ambari-WebSocket'''==&lt;br /&gt;
1. Clone the repository to your local system&amp;lt;br&amp;gt;&lt;br /&gt;
   git clone https://github.com/nisarg64/ambari&lt;br /&gt;
&lt;br /&gt;
2. Got to ambari directory and checkout the branch &amp;quot;migration&amp;quot; using below command&amp;lt;br&amp;gt;&lt;br /&gt;
   git checkout migration&lt;br /&gt;
&lt;br /&gt;
3. You will need nodeJs, maven etc to build the ambari. Check the requirements as described in [https://cwiki.apache.org/confluence/display/AMBARI/Ambari+Development Ambari PreConfigs]&lt;br /&gt;
&lt;br /&gt;
4. After having the required configurations, run below command to build &amp;lt;br&amp;gt;&lt;br /&gt;
   mvn clean package -DskipTests -Drat.ignoreErrors=true&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Project Benefits and Challenges'''==&lt;br /&gt;
'''Benefits:'''&lt;br /&gt;
&amp;lt;p&amp;gt;1. Web Socket will allow Ambari-Server to perform robustly in a large cluster setup with multiple browser sessions and when continuous heavy requests are being made&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Challenges:'''&lt;br /&gt;
&amp;lt;p&amp;gt;1. Ambari server uses [https://en.wikipedia.org/wiki/Jetty_%28web_server%29 Jetty] 8.x version, while support for Web Socket was made available after [https://en.wikipedia.org/wiki/Jetty_%28web_server%29 Jetty] 9.x&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;2. Ambari has a huge codebase with multiple modules and multiple frameworks and design patterns adopted. Understanding the flow of the project and taking care of dependencies is a huge challenge&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;3. For testing the code requires a cluster of around 3 nodes. Running 3 virtual machines requires a high performance machine.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;font color = &amp;quot;red&amp;quot;&amp;gt; Note: This is continuation of our OSS project &amp;lt;/font&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Learning Outcomes'''==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;2. We also noticed in one of the classes called HeartBeatHandler, that it obeys the [https://en.wikipedia.org/wiki/Law_of_Demeter Law of Demeter]&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;3. For testing, project using the [https://en.wikipedia.org/wiki/Mockito Mockito] framework to mock the heartbeat and cluster functionality&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;4. For configuration management, [https://en.wikipedia.org/wiki/Puppet_%28software%29 Puppet] configuration management tool is used&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;5. Ambari-Web is implemented in [https://en.wikipedia.org/wiki/Ember.js Ember.js] which is an open-source Javascript framework that follows [https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller MVC] pattern similar to Rails framework.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;6. Ambari-server uses [https://en.wikipedia.org/wiki/Jetty_%28web_server%29 Jetty] which is a web-server to handle all the HTTP requests made onto the ambari-server from the UI&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Github Location'''==&lt;br /&gt;
 [https://github.com/apache/ambari Ambari Project]&lt;br /&gt;
&lt;br /&gt;
Forked Repository:&lt;br /&gt;
 [https://github.com/nisarg64/ambari Forked Repo]&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;p&amp;gt;https://ambari.apache.org/&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;https://en.wikipedia.org/wiki/Apache_Ambari&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;https://cwiki.apache.org/confluence/display/AMBARI/Ambari&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;https://issues.apache.org/jira/secure/attachment/12559939/Ambari_Architecture.pdf&amp;lt;/p&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rpsingh3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_A1550_Web_Socket_Implementation_in_Apache_Ambari&amp;diff=99485</id>
		<title>CSC/ECE 517 Fall 2015 A1550 Web Socket Implementation in Apache Ambari</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_A1550_Web_Socket_Implementation_in_Apache_Ambari&amp;diff=99485"/>
		<updated>2015-11-12T07:59:17Z</updated>

		<summary type="html">&lt;p&gt;Rpsingh3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction'''==&lt;br /&gt;
&lt;br /&gt;
Apache Ambari is a software project of the [https://en.wikipedia.org/wiki/Apache_Software_Foundation Apache Software Foundation], is aimed at making [https://en.wikipedia.org/wiki/Apache_Hadoop Hadoop] management simpler by developing software for provisioning, managing, and monitoring Apache Hadoop clusters. Ambari provides an intuitive, easy-to-use [https://en.wikipedia.org/wiki/Apache_Hadoop Hadoop] management web UI backed by its [https://en.wikipedia.org/wiki/Representational_state_transfer RESTful] APIs. Ambari was a sub-project of [https://en.wikipedia.org/wiki/Apache_Hadoop Hadoop] but is now a [https://en.wikipedia.org/wiki/Apache_Software_Foundation#Projects top-level] project in its own right.&lt;br /&gt;
&lt;br /&gt;
An Apache Hadoop cluster consists on a group or nodes/machines. Each node acts as an Ambari Agent that runs various service components (e.g. Datanode for HDFS). One of the agents acts as an Ambari Server that takes care of the task allocation, management, gathering information about the services status and other information from the agents and giving the information to Ambari UI for display. More information about Agent-Server-Web flow is available in the following sections.&lt;br /&gt;
&lt;br /&gt;
Ambari-Web uses simple ajax polling mechanism to fetch data from Ambari-Server. Constant polling is done to show current service status, alerts, service graphs, etc on Ambari-Web. With this mechanism, the performance of Ambari-Server can be affected on a large size cluster with multiple active browser sessions due to continuous heavy requests being made. &lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/WebSocket WebSocket] is a protocol providing full-duplex communication channels over a single TCP connection. Implementing Web-Socket between Ambari-Web and Ambari-Server will be helpful to address this scenario.&lt;br /&gt;
&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
==='''Project Goals'''===&lt;br /&gt;
&amp;lt;p&amp;gt;1. Understand architecture of Ambari-Server and Ambari-web&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;2. Replace the current pull-based mechanism with the push-based mechanism via Web-Socket&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;3. Write test cases for the Web Socket implementation to test the functionalities of WebSocket Client and WebSocket Server&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==='''Project Design'''===&lt;br /&gt;
Ambari is a multi-module Maven project. The relevant modules for our project from an implementation perspective are Ambari Web and Ambari Server. Ambari Agent is another module, important functionally.&lt;br /&gt;
&lt;br /&gt;
===='''Major Components'''====&lt;br /&gt;
&amp;lt;b&amp;gt;Ambari Agent &amp;lt;/b&amp;gt; is a component that resides on every node of the cluster. Its responsibility is to collect the node's overall health which comprises of the health metrics of all the different services running on that node. Ambari Agent sends these statuses to the Ambari Server in the form of periodic messages which is termed as 'heartbeat' in the Ambari nomenclature. In return, Ambari agents receive Heartbeat responses from Ambari Server. Hearbeat responses could contain commands for the agent to perform.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Ambari Web &amp;lt;/b&amp;gt; presents a user interface to monitor and manage a Hadoop cluster. Web module is written in JavaScript using ember.js framework. During our code study, we observed this module following the [https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller MVC] design methodology. The whole motivation of this module is to make it convenient to the end-user to manage the concerned Hadoop cluster.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Ambari Server &amp;lt;/b&amp;gt; is the most central component of an Ambari ecosystem. Ambari Server exposes [https://en.wikipedia.org/wiki/Application_programming_interface APIs]] to its clients such as Ambari Web, which monitors health of a cluster. Ambari Server clients can query for node health statuses. Ambari Server persists the nodes' statuses in a [https://en.wikipedia.org/wiki/PostgreSQL PostgreSQL] database in the backend. Internally, Ambari Server has several components which help it to manage its responsibilities. Ambari Server's important responsibilities are as follows:&lt;br /&gt;
&amp;lt;p&amp;gt; 1. Collect health statuses ( heartbeats ) from Ambari agents. Process their statuses and send heartbeat responses to Ambari agents. &amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt; 2. Handle requests from Ambari Server's clients: One such use case is installing a new service on an Ambari agent. This request could be received from Ambari Web and it is the server's responsibility to send appropriate instructions to the particular agent to get the new service up and running on the agent. &amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===='''Architectural design of WebSocket client-server in Apache Ambari'''====&lt;br /&gt;
[[File:Ambari-WebSocket.png]]&lt;br /&gt;
&lt;br /&gt;
===='''Flow Diagram'''====&lt;br /&gt;
[[File:Ambari-Flow.png]]&lt;br /&gt;
&lt;br /&gt;
==='''Implementation'''===&lt;br /&gt;
===='''Design Pattern'''====&lt;br /&gt;
We have observed that Ambari project adopts various design patterns like [https://en.wikipedia.org/wiki/Singleton_pattern Singleton Pattern] in the Data Access Object Classes. For this project, we will be using [https://en.wikipedia.org/wiki/Request%E2%80%93response request-response], one of the [https://en.wikipedia.org/wiki/Messaging_pattern message exchange pattern].&lt;br /&gt;
&lt;br /&gt;
===='''UML Diagrams'''====&lt;br /&gt;
&lt;br /&gt;
[[File:Ambari-ClassDiagram.png]]&lt;br /&gt;
&lt;br /&gt;
=='''Testing Framework'''==&lt;br /&gt;
The codebase is very well supported with unit tests. Following are a few important characteristics of the testing process that we observed during our code study:&lt;br /&gt;
&lt;br /&gt;
1. A popular mocking framework, [https://en.wikipedia.org/wiki/Mockito Mockito] is used to mock responses from dependent downstream services. An in-memory cluster is also mocked using Mockito. Mocking frameworks let us have our test cases fast and independent, which is very well depicted in this project. &lt;br /&gt;
&lt;br /&gt;
2. Every controller method is tested in and out. Tests are quite extensive and cover almost all the code branches, testing each and every feature thoroughly.&lt;br /&gt;
&lt;br /&gt;
3. Only the results/responses obtained from controller methods are asserted. We do not find any significant &amp;quot;verify() / expect()&amp;quot; calls. (&amp;quot;verify/expect&amp;quot; calls are used to assert if a given method was invoked during the test method execution). This is quite a good feature followed as the tests are implemented in a result-oriented way and are not bound to the method implementation in anyway. This also goes to show the stability of the tests as if the method implementation undergoes changes in future, it won't fail our tests.&lt;br /&gt;
&lt;br /&gt;
=='''Steps to build and test Ambari-WebSocket'''==&lt;br /&gt;
1. Clone the repository to your local system&amp;lt;br&amp;gt;&lt;br /&gt;
   git clone https://github.com/nisarg64/ambari&lt;br /&gt;
&lt;br /&gt;
2. Got to ambari directory and checkout the branch &amp;quot;migration&amp;quot; using below command&amp;lt;br&amp;gt;&lt;br /&gt;
   git checkout migration&lt;br /&gt;
&lt;br /&gt;
3. You will need nodeJs, maven etc to build the ambari. Check the requirements as described in [https://cwiki.apache.org/confluence/display/AMBARI/Ambari+Development Ambari PreConfigs]&lt;br /&gt;
&lt;br /&gt;
4. After having the required configurations, run below command to build &amp;lt;br&amp;gt;&lt;br /&gt;
   mvn clean package -DskipTests -Drat.ignoreErrors=true&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Project Benefits and Challenges'''==&lt;br /&gt;
'''Benefits:'''&lt;br /&gt;
&amp;lt;p&amp;gt;1. Web Socket will allow Ambari-Server to perform robustly in a large cluster setup with multiple browser sessions and when continuous heavy requests are being made&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Challenges:'''&lt;br /&gt;
&amp;lt;p&amp;gt;1. Ambari server uses [https://en.wikipedia.org/wiki/Jetty_%28web_server%29 Jetty] 8.x version, while support for Web Socket was made available after [https://en.wikipedia.org/wiki/Jetty_%28web_server%29 Jetty] 9.x&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;2. Ambari has a huge codebase with multiple modules and multiple frameworks and design patterns adopted. Understanding the flow of the project and taking care of dependencies is a huge challenge&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;3. For testing the code requires a cluster of around 3 nodes. Running 3 virtual machines requires a high performance machine.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Learning Outcomes'''==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;2. We also noticed in one of the classes called HeartBeatHandler, that it obeys the [https://en.wikipedia.org/wiki/Law_of_Demeter Law of Demeter]&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;3. For testing, project using the [https://en.wikipedia.org/wiki/Mockito Mockito] framework to mock the heartbeat and cluster functionality&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;4. For configuration management, [https://en.wikipedia.org/wiki/Puppet_%28software%29 Puppet] configuration management tool is used&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;5. Ambari-Web is implemented in [https://en.wikipedia.org/wiki/Ember.js Ember.js] which is an open-source Javascript framework that follows [https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller MVC] pattern similar to Rails framework.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;6. Ambari-server uses [https://en.wikipedia.org/wiki/Jetty_%28web_server%29 Jetty] which is a web-server to handle all the HTTP requests made onto the ambari-server from the UI&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Github Location'''==&lt;br /&gt;
 [https://github.com/apache/ambari Ambari Project]&lt;br /&gt;
&lt;br /&gt;
Forked Repository:&lt;br /&gt;
 [https://github.com/nisarg64/ambari Forked Repo]&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;p&amp;gt;https://ambari.apache.org/&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;https://en.wikipedia.org/wiki/Apache_Ambari&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;https://cwiki.apache.org/confluence/display/AMBARI/Ambari&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;https://issues.apache.org/jira/secure/attachment/12559939/Ambari_Architecture.pdf&amp;lt;/p&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rpsingh3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Ambari-ClassDiagram.png&amp;diff=99484</id>
		<title>File:Ambari-ClassDiagram.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Ambari-ClassDiagram.png&amp;diff=99484"/>
		<updated>2015-11-12T07:57:28Z</updated>

		<summary type="html">&lt;p&gt;Rpsingh3: uploaded a new version of &amp;amp;quot;File:Ambari-ClassDiagram.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Rpsingh3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Ambari-ClassDiagram.png&amp;diff=99483</id>
		<title>File:Ambari-ClassDiagram.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Ambari-ClassDiagram.png&amp;diff=99483"/>
		<updated>2015-11-12T07:55:28Z</updated>

		<summary type="html">&lt;p&gt;Rpsingh3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Rpsingh3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_A1550_Web_Socket_Implementation_in_Apache_Ambari&amp;diff=99482</id>
		<title>CSC/ECE 517 Fall 2015 A1550 Web Socket Implementation in Apache Ambari</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_A1550_Web_Socket_Implementation_in_Apache_Ambari&amp;diff=99482"/>
		<updated>2015-11-12T07:44:28Z</updated>

		<summary type="html">&lt;p&gt;Rpsingh3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction'''==&lt;br /&gt;
&lt;br /&gt;
Apache Ambari is a software project of the [https://en.wikipedia.org/wiki/Apache_Software_Foundation Apache Software Foundation], is aimed at making [https://en.wikipedia.org/wiki/Apache_Hadoop Hadoop] management simpler by developing software for provisioning, managing, and monitoring Apache Hadoop clusters. Ambari provides an intuitive, easy-to-use [https://en.wikipedia.org/wiki/Apache_Hadoop Hadoop] management web UI backed by its [https://en.wikipedia.org/wiki/Representational_state_transfer RESTful] APIs. Ambari was a sub-project of [https://en.wikipedia.org/wiki/Apache_Hadoop Hadoop] but is now a [https://en.wikipedia.org/wiki/Apache_Software_Foundation#Projects top-level] project in its own right.&lt;br /&gt;
&lt;br /&gt;
An Apache Hadoop cluster consists on a group or nodes/machines. Each node acts as an Ambari Agent that runs various service components (e.g. Datanode for HDFS). One of the agents acts as an Ambari Server that takes care of the task allocation, management, gathering information about the services status and other information from the agents and giving the information to Ambari UI for display. More information about Agent-Server-Web flow is available in the following sections.&lt;br /&gt;
&lt;br /&gt;
Ambari-Web uses simple ajax polling mechanism to fetch data from Ambari-Server. Constant polling is done to show current service status, alerts, service graphs, etc on Ambari-Web. With this mechanism, the performance of Ambari-Server can be affected on a large size cluster with multiple active browser sessions due to continuous heavy requests being made. &lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/WebSocket WebSocket] is a protocol providing full-duplex communication channels over a single TCP connection. Implementing Web-Socket between Ambari-Web and Ambari-Server will be helpful to address this scenario.&lt;br /&gt;
&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
==='''Project Goals'''===&lt;br /&gt;
&amp;lt;p&amp;gt;1. Understand architecture of Ambari-Server and Ambari-web&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;2. Replace the current pull-based mechanism with the push-based mechanism via Web-Socket&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;3. Write test cases for the Web Socket implementation to test the functionalities of WebSocket Client and WebSocket Server&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==='''Project Design'''===&lt;br /&gt;
Ambari is a multi-module Maven project. The relevant modules for our project from an implementation perspective are Ambari Web and Ambari Server. Ambari Agent is another module, important functionally.&lt;br /&gt;
&lt;br /&gt;
===='''Major Components'''====&lt;br /&gt;
&amp;lt;b&amp;gt;Ambari Agent &amp;lt;/b&amp;gt; is a component that resides on every node of the cluster. Its responsibility is to collect the node's overall health which comprises of the health metrics of all the different services running on that node. Ambari Agent sends these statuses to the Ambari Server in the form of periodic messages which is termed as 'heartbeat' in the Ambari nomenclature. In return, Ambari agents receive Heartbeat responses from Ambari Server. Hearbeat responses could contain commands for the agent to perform.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Ambari Web &amp;lt;/b&amp;gt; presents a user interface to monitor and manage a Hadoop cluster. Web module is written in JavaScript using ember.js framework. During our code study, we observed this module following the [https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller MVC] design methodology. The whole motivation of this module is to make it convenient to the end-user to manage the concerned Hadoop cluster.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Ambari Server &amp;lt;/b&amp;gt; is the most central component of an Ambari ecosystem. Ambari Server exposes [https://en.wikipedia.org/wiki/Application_programming_interface APIs]] to its clients such as Ambari Web, which monitors health of a cluster. Ambari Server clients can query for node health statuses. Ambari Server persists the nodes' statuses in a [https://en.wikipedia.org/wiki/PostgreSQL PostgreSQL] database in the backend. Internally, Ambari Server has several components which help it to manage its responsibilities. Ambari Server's important responsibilities are as follows:&lt;br /&gt;
&amp;lt;p&amp;gt; 1. Collect health statuses ( heartbeats ) from Ambari agents. Process their statuses and send heartbeat responses to Ambari agents. &amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt; 2. Handle requests from Ambari Server's clients: One such use case is installing a new service on an Ambari agent. This request could be received from Ambari Web and it is the server's responsibility to send appropriate instructions to the particular agent to get the new service up and running on the agent. &amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===='''Architectural design of WebSocket client-server in Apache Ambari'''====&lt;br /&gt;
[[File:Ambari-WebSocket.png]]&lt;br /&gt;
&lt;br /&gt;
===='''Flow Diagram'''====&lt;br /&gt;
[[File:Ambari-Flow.png]]&lt;br /&gt;
&lt;br /&gt;
==='''Implementation'''===&lt;br /&gt;
===='''Design Pattern'''====&lt;br /&gt;
We have observed that Ambari project adopts various design patterns like [https://en.wikipedia.org/wiki/Singleton_pattern Singleton Pattern] in the Data Access Object Classes. We will be using [https://en.wikipedia.org/wiki/Request%E2%80%93response request-response], one of the [https://en.wikipedia.org/wiki/Messaging_pattern message exchange pattern], in this project.&lt;br /&gt;
&lt;br /&gt;
===='''UML Diagrams'''====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Testing Framework'''==&lt;br /&gt;
The codebase is very well supported with unit tests. Following are a few important characteristics of the testing process that we observed during our code study:&lt;br /&gt;
&lt;br /&gt;
1. A popular mocking framework, [https://en.wikipedia.org/wiki/Mockito Mockito] is used to mock responses from dependent downstream services. An in-memory cluster is also mocked using Mockito. Mocking frameworks let us have our test cases fast and independent, which is very well depicted in this project. &lt;br /&gt;
&lt;br /&gt;
2. Every controller method is tested in and out. Tests are quite extensive and cover almost all the code branches, testing each and every feature thoroughly.&lt;br /&gt;
&lt;br /&gt;
3. Only the results/responses obtained from controller methods are asserted. We do not find any significant &amp;quot;verify() / expect()&amp;quot; calls. (&amp;quot;verify/expect&amp;quot; calls are used to assert if a given method was invoked during the test method execution). This is quite a good feature followed as the tests are implemented in a result-oriented way and are not bound to the method implementation in anyway. This also goes to show the stability of the tests as if the method implementation undergoes changes in future, it won't fail our tests.&lt;br /&gt;
&lt;br /&gt;
=='''Steps to build and test Ambari-WebSocket'''==&lt;br /&gt;
1. Clone the repository to your local system&amp;lt;br&amp;gt;&lt;br /&gt;
   git clone https://github.com/nisarg64/ambari&lt;br /&gt;
&lt;br /&gt;
2. Got to ambari directory and checkout the branch &amp;quot;migration&amp;quot; using below command&amp;lt;br&amp;gt;&lt;br /&gt;
   git checkout migration&lt;br /&gt;
&lt;br /&gt;
3. You will need nodeJs, maven etc to build the ambari. Check the requirements as described in [https://cwiki.apache.org/confluence/display/AMBARI/Ambari+Development Ambari PreConfigs]&lt;br /&gt;
&lt;br /&gt;
4. After having the required configurations, run below command to build &amp;lt;br&amp;gt;&lt;br /&gt;
   mvn clean package -DskipTests -Drat.ignoreErrors=true&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Project Benefits and Challenges'''==&lt;br /&gt;
'''Benefits:'''&lt;br /&gt;
&amp;lt;p&amp;gt;1. Web Socket will allow Ambari-Server to perform robustly in a large cluster setup with multiple browser sessions and when continuous heavy requests are being made&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Challenges:'''&lt;br /&gt;
&amp;lt;p&amp;gt;1. Ambari server uses [https://en.wikipedia.org/wiki/Jetty_%28web_server%29 Jetty] 8.x version, while support for Web Socket was made available after [https://en.wikipedia.org/wiki/Jetty_%28web_server%29 Jetty] 9.x&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;2. Ambari has a huge codebase with multiple modules and multiple frameworks and design patterns adopted. Understanding the flow of the project and taking care of dependencies is a huge challenge&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;3. For testing the code requires a cluster of around 3 nodes. Running 3 virtual machines requires a high performance machine.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Learning Outcomes'''==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;2. We also noticed in one of the classes called HeartBeatHandler, that it obeys the [https://en.wikipedia.org/wiki/Law_of_Demeter Law of Demeter]&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;3. For testing, project using the [https://en.wikipedia.org/wiki/Mockito Mockito] framework to mock the heartbeat and cluster functionality&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;4. For configuration management, [https://en.wikipedia.org/wiki/Puppet_%28software%29 Puppet] configuration management tool is used&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;5. Ambari-Web is implemented in [https://en.wikipedia.org/wiki/Ember.js Ember.js] which is an open-source Javascript framework that follows [https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller MVC] pattern similar to Rails framework.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;6. Ambari-server uses [https://en.wikipedia.org/wiki/Jetty_%28web_server%29 Jetty] which is a web-server to handle all the HTTP requests made onto the ambari-server from the UI&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Github Location'''==&lt;br /&gt;
 [https://github.com/apache/ambari Ambari Project]&lt;br /&gt;
&lt;br /&gt;
Forked Repository:&lt;br /&gt;
 [https://github.com/nisarg64/ambari Forked Repo]&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;p&amp;gt;https://ambari.apache.org/&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;https://en.wikipedia.org/wiki/Apache_Ambari&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;https://cwiki.apache.org/confluence/display/AMBARI/Ambari&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;https://issues.apache.org/jira/secure/attachment/12559939/Ambari_Architecture.pdf&amp;lt;/p&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rpsingh3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_A1550_Web_Socket_Implementation_in_Apache_Ambari&amp;diff=99481</id>
		<title>CSC/ECE 517 Fall 2015 A1550 Web Socket Implementation in Apache Ambari</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_A1550_Web_Socket_Implementation_in_Apache_Ambari&amp;diff=99481"/>
		<updated>2015-11-12T07:43:15Z</updated>

		<summary type="html">&lt;p&gt;Rpsingh3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction'''==&lt;br /&gt;
&lt;br /&gt;
Apache Ambari is a software project of the [https://en.wikipedia.org/wiki/Apache_Software_Foundation Apache Software Foundation], is aimed at making [https://en.wikipedia.org/wiki/Apache_Hadoop Hadoop] management simpler by developing software for provisioning, managing, and monitoring Apache Hadoop clusters. Ambari provides an intuitive, easy-to-use [https://en.wikipedia.org/wiki/Apache_Hadoop Hadoop] management web UI backed by its [https://en.wikipedia.org/wiki/Representational_state_transfer RESTful] APIs. Ambari was a sub-project of [https://en.wikipedia.org/wiki/Apache_Hadoop Hadoop] but is now a [https://en.wikipedia.org/wiki/Apache_Software_Foundation#Projects top-level] project in its own right.&lt;br /&gt;
&lt;br /&gt;
An Apache Hadoop cluster consists on a group or nodes/machines. Each node acts as an Ambari Agent that runs various service components (e.g. Datanode for HDFS). One of the agents acts as an Ambari Server that takes care of the task allocation, management, gathering information about the services status and other information from the agents and giving the information to Ambari UI for display. More information about Agent-Server-Web flow is available in the following sections.&lt;br /&gt;
&lt;br /&gt;
Ambari-Web uses simple ajax polling mechanism to fetch data from Ambari-Server. Constant polling is done to show current service status, alerts, service graphs, etc on Ambari-Web. With this mechanism, the performance of Ambari-Server can be affected on a large size cluster with multiple active browser sessions due to continuous heavy requests being made. &lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/WebSocket WebSocket] is a protocol providing full-duplex communication channels over a single TCP connection. Implementing Web-Socket between Ambari-Web and Ambari-Server will be helpful to address this scenario.&lt;br /&gt;
&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
==='''Project Goals'''===&lt;br /&gt;
&amp;lt;p&amp;gt;1. Understand architecture of Ambari-Server and Ambari-web&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;2. Replace the current pull-based mechanism with the push-based mechanism via Web-Socket&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;3. Write test cases for the Web Socket implementation to test the functionalities of WebSocket Client and WebSocket Server&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==='''Project Design'''===&lt;br /&gt;
Ambari is a multi-module Maven project. The relevant modules for our project from an implementation perspective are Ambari Web and Ambari Server. Ambari Agent is another module, important functionally.&lt;br /&gt;
&lt;br /&gt;
===='''Major Components'''====&lt;br /&gt;
&amp;lt;b&amp;gt;Ambari Agent &amp;lt;/b&amp;gt; is a component that resides on every node of the cluster. Its responsibility is to collect the node's overall health which comprises of the health metrics of all the different services running on that node. Ambari Agent sends these statuses to the Ambari Server in the form of periodic messages which is termed as 'heartbeat' in the Ambari nomenclature. In return, Ambari agents receive Heartbeat responses from Ambari Server. Hearbeat responses could contain commands for the agent to perform.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Ambari Web &amp;lt;/b&amp;gt; presents a user interface to monitor and manage a Hadoop cluster. Web module is written in JavaScript using ember.js framework. During our code study, we observed this module following the [https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller MVC] design methodology. The whole motivation of this module is to make it convenient to the end-user to manage the concerned Hadoop cluster.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Ambari Server &amp;lt;/b&amp;gt; is the most central component of an Ambari ecosystem. Ambari Server exposes [https://en.wikipedia.org/wiki/Application_programming_interface APIs]] to its clients such as Ambari Web, which monitors health of a cluster. Ambari Server clients can query for node health statuses. Ambari Server persists the nodes' statuses in a [https://en.wikipedia.org/wiki/PostgreSQL PostgreSQL] database in the backend. Internally, Ambari Server has several components which help it to manage its responsibilities. Ambari Server's important responsibilities are as follows:&lt;br /&gt;
&amp;lt;p&amp;gt; 1. Collect health statuses ( heartbeats ) from Ambari agents. Process their statuses and send heartbeat responses to Ambari agents. &amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt; 2. Handle requests from Ambari Server's clients: One such use case is installing a new service on an Ambari agent. This request could be received from Ambari Web and it is the server's responsibility to send appropriate instructions to the particular agent to get the new service up and running on the agent. &amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===='''Architectural design of WebSocket client-server in Apache Ambari'''====&lt;br /&gt;
[[File:Ambari-WebSocket.png]]&lt;br /&gt;
&lt;br /&gt;
===='''Flow Diagram'''====&lt;br /&gt;
[[File:Ambari-Flow.png]]&lt;br /&gt;
&lt;br /&gt;
==='''Implementation'''===&lt;br /&gt;
===='''Design Pattern'''====&lt;br /&gt;
We have observed that Ambari project adopts various design patterns like [https://en.wikipedia.org/wiki/Singleton_pattern Singleton Pattern] in the Data Access Object Classes. We will be using [https://en.wikipedia.org/wiki/Request%E2%80%93response request-response], one of the [https://en.wikipedia.org/wiki/Messaging_pattern message exchange pattern], in this project.&lt;br /&gt;
&lt;br /&gt;
===='''UML Diagrams'''====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Testing Framework'''==&lt;br /&gt;
The codebase is very well supported with unit tests. Following are a few important characteristics of the testing process that we observed during our code study:&lt;br /&gt;
&lt;br /&gt;
1. A popular mocking framework, [https://en.wikipedia.org/wiki/Mockito Mockito] is used to mock responses from dependent downstream services. An in-memory cluster is also mocked using Mockito. Mocking frameworks let us have our test cases fast and independent, which is very well depicted in this project. &lt;br /&gt;
&lt;br /&gt;
2. Every controller method is tested in and out. Tests are quite extensive and cover almost all the code branches, testing each and every feature thoroughly.&lt;br /&gt;
&lt;br /&gt;
3. Only the results/responses obtained from controller methods are asserted. We do not find any significant &amp;quot;verify() / expect()&amp;quot; calls. (&amp;quot;verify/expect&amp;quot; calls are used to assert if a given method was invoked during the test method execution). This is quite a good feature followed as the tests are implemented in a result-oriented way and are not bound to the method implementation in anyway. This also goes to show the stability of the tests as if the method implementation undergoes changes in future, it won't fail our tests.&lt;br /&gt;
&lt;br /&gt;
=='''Steps to build and test Ambari-WebSocket'''==&lt;br /&gt;
1. Clone the repository to your local system&amp;lt;br&amp;gt;&lt;br /&gt;
   git clone https://github.com/nisarg64/ambari&lt;br /&gt;
&lt;br /&gt;
2. Got to ambari directory and checkout the branch &amp;quot;migration&amp;quot; using below command&amp;lt;br&amp;gt;&lt;br /&gt;
   git checkout migration&lt;br /&gt;
&lt;br /&gt;
3. You will need nodeJs, maven etc to build the ambari. Check the requirements as described in [https://cwiki.apache.org/confluence/display/AMBARI/Ambari+Development Ambari PreConfigs]&lt;br /&gt;
&lt;br /&gt;
4. After having the required configurations, run below command to build &amp;lt;br&amp;gt;&lt;br /&gt;
   mvn clean package -DskipTests -Drat.ignoreErrors=true&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Project Benefits and Challenges'''==&lt;br /&gt;
'''Benefits:'''&lt;br /&gt;
&amp;lt;p&amp;gt;1. Web Socket will allow Ambari-Server to perform robustly in a large cluster setup with multiple browser sessions and when continuous heavy requests are being made&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Challenges:'''&lt;br /&gt;
&amp;lt;p&amp;gt;1. Ambari server uses [https://en.wikipedia.org/wiki/Jetty_%28web_server%29 Jetty] 8.x version, while support for Web Socket was made available after [https://en.wikipedia.org/wiki/Jetty_%28web_server%29 Jetty] 9.x&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;2. Ambari has a huge codebase with multiple modules and multiple frameworks and design patterns adopted. Understanding the flow of the project and taking care of dependencies is a huge challenge&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;3. For testing the code requires a cluster of around 3 nodes. Running 3 virtual machines requires a high performance machine.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Learning Outcomes'''==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;2. We also noticed in one of the classes called HeartBeatHandler, that it obeys the [https://en.wikipedia.org/wiki/Law_of_Demeter Law of Demeter]&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;3. For testing, project using the [https://en.wikipedia.org/wiki/Mockito Mockito] framework to mock the heartbeat and cluster functionality&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;4. For configuration management, [https://en.wikipedia.org/wiki/Puppet_%28software%29 Puppet] configuration management tool is used&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;5. Ambari-Web is implemented in [https://en.wikipedia.org/wiki/Ember.js Ember.js] which is an open-source Javascript framework that follows [https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller MVC] pattern similar to Rails framework.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;6. Ambari-server uses [https://en.wikipedia.org/wiki/Jetty_%28web_server%29 Jetty] which is a web-server to handle all the HTTP requests made onto the ambari-server from the UI&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Github Location'''==&lt;br /&gt;
 [https://github.com/apache/ambari Ambari Project]&lt;br /&gt;
&lt;br /&gt;
Forked Repository:&lt;br /&gt;
 [https://github.com/nisarg64/ambari Forked Repo]&lt;br /&gt;
&lt;br /&gt;
Changes committed to forked repositry:&lt;br /&gt;
 [https://github.com/nisarg64/ambari/commit/f7b9131cb7324dda39b95db72673a63ab2ac109b Code changes]&lt;br /&gt;
&lt;br /&gt;
'''Major code changes:'''&lt;br /&gt;
&amp;lt;p&amp;gt;Addition of websocket client-sever files [https://github.com/nisarg64/ambari/commit/f7b9131cb7324dda39b95db72673a63ab2ac109b#diff-4ac64b666141c53eb339c0375455d311 WebSocketClient.java] and [https://github.com/nisarg64/ambari/commit/f7b9131cb7324dda39b95db72673a63ab2ac109b#diff-0d2947581a9630d9b41c77e5f0fd23b6  WebSocketServer.java]&amp;lt;br&amp;gt;&lt;br /&gt;
Changes in heartbeat handler - [https://github.com/nisarg64/ambari/commit/f7b9131cb7324dda39b95db72673a63ab2ac109b#diff-1b3d5840e204ec59cec0cc42c9de12ea HeartBeatHandler.java]&amp;lt;br&amp;gt;&lt;br /&gt;
Version changes in [https://en.wikipedia.org/wiki/Apache_Maven#Project_Object_Model POM] files.&amp;lt;/p&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Note: We are required to submit only one pull request and that too at the end of the final project.&amp;lt;/font&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;p&amp;gt;https://ambari.apache.org/&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;https://en.wikipedia.org/wiki/Apache_Ambari&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;https://cwiki.apache.org/confluence/display/AMBARI/Ambari&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;https://issues.apache.org/jira/secure/attachment/12559939/Ambari_Architecture.pdf&amp;lt;/p&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rpsingh3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_A1550_Web_Socket_Implementation_in_Apache_Ambari&amp;diff=99480</id>
		<title>CSC/ECE 517 Fall 2015 A1550 Web Socket Implementation in Apache Ambari</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_A1550_Web_Socket_Implementation_in_Apache_Ambari&amp;diff=99480"/>
		<updated>2015-11-12T07:06:16Z</updated>

		<summary type="html">&lt;p&gt;Rpsingh3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction'''==&lt;br /&gt;
&lt;br /&gt;
Apache Ambari is a software project of the [https://en.wikipedia.org/wiki/Apache_Software_Foundation Apache Software Foundation], is aimed at making [https://en.wikipedia.org/wiki/Apache_Hadoop Hadoop] management simpler by developing software for provisioning, managing, and monitoring Apache Hadoop clusters. Ambari provides an intuitive, easy-to-use [https://en.wikipedia.org/wiki/Apache_Hadoop Hadoop] management web UI backed by its [https://en.wikipedia.org/wiki/Representational_state_transfer RESTful] APIs. Ambari was a sub-project of [https://en.wikipedia.org/wiki/Apache_Hadoop Hadoop] but is now a [https://en.wikipedia.org/wiki/Apache_Software_Foundation#Projects top-level] project in its own right.&lt;br /&gt;
&lt;br /&gt;
An Apache Hadoop cluster consists on a group or nodes/machines. Each node acts as an Ambari Agent that runs various service components (e.g. Datanode for HDFS). One of the agents acts as an Ambari Server that takes care of the task allocation, management, gathering information about the services status and other information from the agents and giving the information to Ambari UI for display. More information about Agent-Server-Web flow is available in the following sections.&lt;br /&gt;
&lt;br /&gt;
Ambari-Web uses simple ajax polling mechanism to fetch data from Ambari-Server. Constant polling is done to show current service status, alerts, service graphs, etc on Ambari-Web. With this mechanism, the performance of Ambari-Server can be affected on a large size cluster with multiple active browser sessions due to continuous heavy requests being made. &lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/WebSocket WebSocket] is a protocol providing full-duplex communication channels over a single TCP connection. Implementing Web-Socket between Ambari-Web and Ambari-Server will be helpful to address this scenario.&lt;br /&gt;
&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
1. '''Project Goals'''&lt;br /&gt;
Ambari is a multi-module Maven project. The relevant modules for our project from an implementation perspective are Ambari Web and Ambari Server. Ambari Agent is another module, important functionally.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Ambari Agent &amp;lt;/b&amp;gt; is a component that resides on every node of the cluster. Its responsibility is to collect the node's overall health which comprises of the health metrics of all the different services running on that node. Ambari Agent sends these statuses to the Ambari Server in the form of periodic messages which is termed as 'heartbeat' in the Ambari nomenclature. In return, Ambari agents receive Heartbeat responses from Ambari Server. Hearbeat responses could contain commands for the agent to perform.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Ambari Web &amp;lt;/b&amp;gt; presents a user interface to monitor and manage a Hadoop cluster. Web module is written in JavaScript using ember.js framework. During our code study, we observed this module following the [https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller MVC] design methodology. The whole motivation of this module is to make it convenient to the end-user to manage the concerned Hadoop cluster.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Ambari Server &amp;lt;/b&amp;gt; is the most central component of an Ambari ecosystem. Ambari Server exposes [https://en.wikipedia.org/wiki/Application_programming_interface APIs]] to its clients such as Ambari Web, which monitors health of a cluster. Ambari Server clients can query for node health statuses. Ambari Server persists the nodes' statuses in a [https://en.wikipedia.org/wiki/PostgreSQL PostgreSQL] database in the backend. Internally, Ambari Server has several components which help it to manage its responsibilities. Ambari Server's important responsibilities are as follows:&lt;br /&gt;
&amp;lt;p&amp;gt; 1. Collect health statuses ( heartbeats ) from Ambari agents. Process their statuses and send heartbeat responses to Ambari agents. &amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt; 2. Handle requests from Ambari Server's clients: One such use case is installing a new service on an Ambari agent. This request could be received from Ambari Web and it is the server's responsibility to send appropriate instructions to the particular agent to get the new service up and running on the agent. &amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Flow Diagram'''==&lt;br /&gt;
[[File:Ambari-Flow.png]]&lt;br /&gt;
&lt;br /&gt;
=='''Testing Framework'''==&lt;br /&gt;
The codebase is very well supported with unit tests. Following are a few important characteristics of the testing process that we observed during our code study:&lt;br /&gt;
&lt;br /&gt;
1. A popular mocking framework, [https://en.wikipedia.org/wiki/Mockito Mockito] is used to mock responses from dependent downstream services. An in-memory cluster is also mocked using Mockito. Mocking frameworks let us have our test cases fast and independent, which is very well depicted in this project. &lt;br /&gt;
&lt;br /&gt;
2. Every controller method is tested in and out. Tests are quite extensive and cover almost all the code branches, testing each and every feature thoroughly.&lt;br /&gt;
&lt;br /&gt;
3. Only the results/responses obtained from controller methods are asserted. We do not find any significant &amp;quot;verify() / expect()&amp;quot; calls. (&amp;quot;verify/expect&amp;quot; calls are used to assert if a given method was invoked during the test method execution). This is quite a good feature followed as the tests are implemented in a result-oriented way and are not bound to the method implementation in anyway. This also goes to show the stability of the tests as if the method implementation undergoes changes in future, it won't fail our tests.&lt;br /&gt;
&lt;br /&gt;
=='''Steps to build and test Ambari-WebSocket'''==&lt;br /&gt;
1. Clone the repository to your local system&amp;lt;br&amp;gt;&lt;br /&gt;
   git clone https://github.com/nisarg64/ambari&lt;br /&gt;
&lt;br /&gt;
2. Got to ambari directory and checkout the branch &amp;quot;migration&amp;quot; using below command&amp;lt;br&amp;gt;&lt;br /&gt;
   git checkout migration&lt;br /&gt;
&lt;br /&gt;
3. You will need nodeJs, maven etc to build the ambari. Check the requirements as described in [https://cwiki.apache.org/confluence/display/AMBARI/Ambari+Development Ambari PreConfigs]&lt;br /&gt;
&lt;br /&gt;
4. After having the required configurations, run below command to build &amp;lt;br&amp;gt;&lt;br /&gt;
   mvn clean package -DskipTests -Drat.ignoreErrors=true&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Project Goals, Benefits and Challenges'''==&lt;br /&gt;
'''Goals:'''&lt;br /&gt;
&amp;lt;p&amp;gt;1. Understand architecture of Ambari-Server and Ambari-web&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;2. Replace the current pull-based mechanism with the push-based mechanism via Web-Socket&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;3. Write test cases for the Web Socket implementation to test the functionalities of WebSocket Client and WebSocket Server&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Benefits:'''&lt;br /&gt;
&amp;lt;p&amp;gt;1. Web Socket will allow Ambari-Server to perform robustly in a large cluster setup with multiple browser sessions and when continuous heavy requests are being made&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Challenges:'''&lt;br /&gt;
&amp;lt;p&amp;gt;1. Ambari server uses [https://en.wikipedia.org/wiki/Jetty_%28web_server%29 Jetty] 8.x version, while support for Web Socket was made available after [https://en.wikipedia.org/wiki/Jetty_%28web_server%29 Jetty] 9.x&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;2. Ambari has a huge codebase with multiple modules and multiple frameworks and design patterns adopted. Understanding the flow of the project and taking care of dependencies is a huge challenge&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;3. For testing the code requires a cluster of around 3 nodes. Running 3 virtual machines requires a high performance machine.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Learning Outcomes'''==&lt;br /&gt;
&amp;lt;p&amp;gt;1. We have observed that Ambari project adopts various design patterns like [https://en.wikipedia.org/wiki/Singleton_pattern Singleton Pattern] in the Data Access Object Classes&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;2. We also noticed in one of the classes called HeartBeatHandler, that it obeys the [https://en.wikipedia.org/wiki/Law_of_Demeter Law of Demeter]&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;3. For testing, project using the [https://en.wikipedia.org/wiki/Mockito Mockito] framework to mock the heartbeat and cluster functionality&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;4. For configuration management, [https://en.wikipedia.org/wiki/Puppet_%28software%29 Puppet] configuration management tool is used&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;5. Ambari-Web is implemented in [https://en.wikipedia.org/wiki/Ember.js Ember.js] which is an open-source Javascript framework that follows [https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller MVC] pattern similar to Rails framework.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;6. Ambari-server uses [https://en.wikipedia.org/wiki/Jetty_%28web_server%29 Jetty] which is a web-server to handle all the HTTP requests made onto the ambari-server from the UI&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Github Location'''==&lt;br /&gt;
 [https://github.com/apache/ambari Ambari Project]&lt;br /&gt;
&lt;br /&gt;
Forked Repository:&lt;br /&gt;
 [https://github.com/nisarg64/ambari Forked Repo]&lt;br /&gt;
&lt;br /&gt;
Changes committed to forked repositry:&lt;br /&gt;
 [https://github.com/nisarg64/ambari/commit/f7b9131cb7324dda39b95db72673a63ab2ac109b Code changes]&lt;br /&gt;
&lt;br /&gt;
'''Major code changes:'''&lt;br /&gt;
&amp;lt;p&amp;gt;Addition of websocket client-sever files [https://github.com/nisarg64/ambari/commit/f7b9131cb7324dda39b95db72673a63ab2ac109b#diff-4ac64b666141c53eb339c0375455d311 WebSocketClient.java] and [https://github.com/nisarg64/ambari/commit/f7b9131cb7324dda39b95db72673a63ab2ac109b#diff-0d2947581a9630d9b41c77e5f0fd23b6  WebSocketServer.java]&amp;lt;br&amp;gt;&lt;br /&gt;
Changes in heartbeat handler - [https://github.com/nisarg64/ambari/commit/f7b9131cb7324dda39b95db72673a63ab2ac109b#diff-1b3d5840e204ec59cec0cc42c9de12ea HeartBeatHandler.java]&amp;lt;br&amp;gt;&lt;br /&gt;
Version changes in [https://en.wikipedia.org/wiki/Apache_Maven#Project_Object_Model POM] files.&amp;lt;/p&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Note: We are required to submit only one pull request and that too at the end of the final project.&amp;lt;/font&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;p&amp;gt;https://ambari.apache.org/&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;https://en.wikipedia.org/wiki/Apache_Ambari&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;https://cwiki.apache.org/confluence/display/AMBARI/Ambari&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;https://issues.apache.org/jira/secure/attachment/12559939/Ambari_Architecture.pdf&amp;lt;/p&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rpsingh3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Ambari-WebSocket.png&amp;diff=99479</id>
		<title>File:Ambari-WebSocket.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Ambari-WebSocket.png&amp;diff=99479"/>
		<updated>2015-11-12T06:51:35Z</updated>

		<summary type="html">&lt;p&gt;Rpsingh3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Rpsingh3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_A1550_Web_Socket_Implementation_in_Apache_Ambari&amp;diff=99375</id>
		<title>CSC/ECE 517 Fall 2015 A1550 Web Socket Implementation in Apache Ambari</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_A1550_Web_Socket_Implementation_in_Apache_Ambari&amp;diff=99375"/>
		<updated>2015-11-10T05:06:12Z</updated>

		<summary type="html">&lt;p&gt;Rpsingh3: Created page with &amp;quot;=='''A1550 - Web Socket Implementation in Apache Ambari'''== Ambari-Web uses simple ajax polling mechanism to fetch data from Ambari-Server. Constant polling is done to show curr...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''A1550 - Web Socket Implementation in Apache Ambari'''==&lt;br /&gt;
Ambari-Web uses simple ajax polling mechanism to fetch data from Ambari-Server. Constant polling is done to show current service status, alerts, service graphs, etc on Ambari-Web. With this mechanism, the performance of Ambari-Server can be affected on a large size cluster with multiple active browser sessions due to continuous heavy requests being made. &lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/WebSocket WebSocket] is a protocol providing full-duplex communication channels over a single TCP connection. Implementing Web-Socket between Ambari-Web and Ambari-Server will be helpful to address this scenario.&lt;br /&gt;
&lt;br /&gt;
=='''What is Apache Ambari'''==&lt;br /&gt;
Apache Ambari is a software project of the [https://en.wikipedia.org/wiki/Apache_Software_Foundation Apache Software Foundation], is aimed at making [https://en.wikipedia.org/wiki/Apache_Hadoop Hadoop] management simpler by developing software for provisioning, managing, and monitoring Apache Hadoop clusters. Ambari provides an intuitive, easy-to-use [https://en.wikipedia.org/wiki/Apache_Hadoop Hadoop] management web UI backed by its [https://en.wikipedia.org/wiki/Representational_state_transfer RESTful] APIs. Ambari was a sub-project of [https://en.wikipedia.org/wiki/Apache_Hadoop Hadoop] but is now a [https://en.wikipedia.org/wiki/Apache_Software_Foundation#Projects top-level] project in its own right.&lt;br /&gt;
&lt;br /&gt;
An Apache Hadoop cluster consists on a group or nodes/machines. Each node acts as an Ambari Agent that runs various service components (e.g. Datanode for HDFS). One of the agents acts as an Ambari Server that takes care of the task allocation, management, gathering information about the services status and other information from the agents and giving the information to Ambari UI for display. More information about Agent-Server-Web flow is available in the following sections.&lt;br /&gt;
&lt;br /&gt;
=='''Current Implementation'''==&lt;br /&gt;
Ambari is a multi-module Maven project. The relevant modules for our project from an implementation perspective are Ambari Web and Ambari Server. Ambari Agent is another module, important functionally.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Ambari Agent &amp;lt;/b&amp;gt; is a component that resides on every node of the cluster. Its responsibility is to collect the node's overall health which comprises of the health metrics of all the different services running on that node. Ambari Agent sends these statuses to the Ambari Server in the form of periodic messages which is termed as 'heartbeat' in the Ambari nomenclature. In return, Ambari agents receive Heartbeat responses from Ambari Server. Hearbeat responses could contain commands for the agent to perform.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Ambari Web &amp;lt;/b&amp;gt; presents a user interface to monitor and manage a Hadoop cluster. Web module is written in JavaScript using ember.js framework. During our code study, we observed this module following the [https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller MVC] design methodology. The whole motivation of this module is to make it convenient to the end-user to manage the concerned Hadoop cluster.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Ambari Server &amp;lt;/b&amp;gt; is the most central component of an Ambari ecosystem. Ambari Server exposes [https://en.wikipedia.org/wiki/Application_programming_interface APIs]] to its clients such as Ambari Web, which monitors health of a cluster. Ambari Server clients can query for node health statuses. Ambari Server persists the nodes' statuses in a [https://en.wikipedia.org/wiki/PostgreSQL PostgreSQL] database in the backend. Internally, Ambari Server has several components which help it to manage its responsibilities. Ambari Server's important responsibilities are as follows:&lt;br /&gt;
&amp;lt;p&amp;gt; 1. Collect health statuses ( heartbeats ) from Ambari agents. Process their statuses and send heartbeat responses to Ambari agents. &amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt; 2. Handle requests from Ambari Server's clients: One such use case is installing a new service on an Ambari agent. This request could be received from Ambari Web and it is the server's responsibility to send appropriate instructions to the particular agent to get the new service up and running on the agent. &amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Testing Framework'''==&lt;br /&gt;
The codebase is very well supported with unit tests. Following are a few important characteristics of the testing process that we observed during our code study:&lt;br /&gt;
&lt;br /&gt;
1. A popular mocking framework, [https://en.wikipedia.org/wiki/Mockito Mockito] is used to mock responses from dependent downstream services. An in-memory cluster is also mocked using Mockito. Mocking frameworks let us have our test cases fast and independent, which is very well depicted in this project. &lt;br /&gt;
&lt;br /&gt;
2. Every controller method is tested in and out. Tests are quite extensive and cover almost all the code branches, testing each and every feature thoroughly.&lt;br /&gt;
&lt;br /&gt;
3. Only the results/responses obtained from controller methods are asserted. We do not find any significant &amp;quot;verify() / expect()&amp;quot; calls. (&amp;quot;verify/expect&amp;quot; calls are used to assert if a given method was invoked during the test method execution). This is quite a good feature followed as the tests are implemented in a result-oriented way and are not bound to the method implementation in anyway. This also goes to show the stability of the tests as if the method implementation undergoes changes in future, it won't fail our tests.&lt;br /&gt;
&lt;br /&gt;
==='''Steps to build and test Ambari-WebSocket'''===&lt;br /&gt;
1. Clone the repository to your local system&amp;lt;br&amp;gt;&lt;br /&gt;
   git clone https://github.com/nisarg64/ambari&lt;br /&gt;
&lt;br /&gt;
2. Got to ambari directory and checkout the branch &amp;quot;migration&amp;quot; using below command&amp;lt;br&amp;gt;&lt;br /&gt;
   git checkout migration&lt;br /&gt;
&lt;br /&gt;
3. You will need nodeJs, maven etc to build the ambari. Check the requirements as described in [https://cwiki.apache.org/confluence/display/AMBARI/Ambari+Development Ambari PreConfigs]&lt;br /&gt;
&lt;br /&gt;
4. After having the required configurations, run below command to build &amp;lt;br&amp;gt;&lt;br /&gt;
   mvn clean package -DskipTests -Drat.ignoreErrors=true&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Project Goals, Benefits and Challenges'''==&lt;br /&gt;
'''Goals:'''&lt;br /&gt;
&amp;lt;p&amp;gt;1. Understand architecture of Ambari-Server and Ambari-web&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;2. Replace the current pull-based mechanism with the push-based mechanism via Web-Socket&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;3. Write test cases for the Web Socket implementation to test the functionalities of WebSocket Client and WebSocket Server&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Benefits:'''&lt;br /&gt;
&amp;lt;p&amp;gt;1. Web Socket will allow Ambari-Server to perform robustly in a large cluster setup with multiple browser sessions and when continuous heavy requests are being made&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Challenges:'''&lt;br /&gt;
&amp;lt;p&amp;gt;1. Ambari server uses [https://en.wikipedia.org/wiki/Jetty_%28web_server%29 Jetty] 8.x version, while support for Web Socket was made available after [https://en.wikipedia.org/wiki/Jetty_%28web_server%29 Jetty] 9.x&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;2. Ambari has a huge codebase with multiple modules and multiple frameworks and design patterns adopted. Understanding the flow of the project and taking care of dependencies is a huge challenge&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;3. For testing the code requires a cluster of around 3 nodes. Running 3 virtual machines requires a high performance machine.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Learning Outcomes'''==&lt;br /&gt;
&amp;lt;p&amp;gt;1. We have observed that Ambari project adopts various design patterns like [https://en.wikipedia.org/wiki/Singleton_pattern Singleton Pattern] in the Data Access Object Classes&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;2. We also noticed in one of the classes called HeartBeatHandler, that it obeys the [https://en.wikipedia.org/wiki/Law_of_Demeter Law of Demeter]&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;3. For testing, project using the [https://en.wikipedia.org/wiki/Mockito Mockito] framework to mock the heartbeat and cluster functionality&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;4. For configuration management, [https://en.wikipedia.org/wiki/Puppet_%28software%29 Puppet] configuration management tool is used&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;5. Ambari-Web is implemented in [https://en.wikipedia.org/wiki/Ember.js Ember.js] which is an open-source Javascript framework that follows [https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller MVC] pattern similar to Rails framework.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;6. Ambari-server uses [https://en.wikipedia.org/wiki/Jetty_%28web_server%29 Jetty] which is a web-server to handle all the HTTP requests made onto the ambari-server from the UI&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Github Location'''==&lt;br /&gt;
 [https://github.com/apache/ambari Ambari Project]&lt;br /&gt;
&lt;br /&gt;
Forked Repository:&lt;br /&gt;
 [https://github.com/nisarg64/ambari Forked Repo]&lt;br /&gt;
&lt;br /&gt;
Changes committed to forked repositry:&lt;br /&gt;
 [https://github.com/nisarg64/ambari/commit/f7b9131cb7324dda39b95db72673a63ab2ac109b Code changes]&lt;br /&gt;
&lt;br /&gt;
'''Major code changes:'''&lt;br /&gt;
&amp;lt;p&amp;gt;Addition of websocket client-sever files [https://github.com/nisarg64/ambari/commit/f7b9131cb7324dda39b95db72673a63ab2ac109b#diff-4ac64b666141c53eb339c0375455d311 WebSocketClient.java] and [https://github.com/nisarg64/ambari/commit/f7b9131cb7324dda39b95db72673a63ab2ac109b#diff-0d2947581a9630d9b41c77e5f0fd23b6  WebSocketServer.java]&amp;lt;br&amp;gt;&lt;br /&gt;
Changes in heartbeat handler - [https://github.com/nisarg64/ambari/commit/f7b9131cb7324dda39b95db72673a63ab2ac109b#diff-1b3d5840e204ec59cec0cc42c9de12ea HeartBeatHandler.java]&amp;lt;br&amp;gt;&lt;br /&gt;
Version changes in [https://en.wikipedia.org/wiki/Apache_Maven#Project_Object_Model POM] files.&amp;lt;/p&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Note: We are required to submit only one pull request and that too at the end of the final project.&amp;lt;/font&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;p&amp;gt;https://ambari.apache.org/&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;https://en.wikipedia.org/wiki/Apache_Ambari&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;https://cwiki.apache.org/confluence/display/AMBARI/Ambari&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;https://issues.apache.org/jira/secure/attachment/12559939/Ambari_Architecture.pdf&amp;lt;/p&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rpsingh3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015&amp;diff=99374</id>
		<title>CSC/ECE 517 Fall 2015</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015&amp;diff=99374"/>
		<updated>2015-11-10T05:01:23Z</updated>

		<summary type="html">&lt;p&gt;Rpsingh3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Writing Assignment 2==&lt;br /&gt;
*[[CSC/ECE_517_Fall_2015/sample_page]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2015/ossE1558BGJ]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015/oss/M1502/AAAASS]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015/oss/M1503/IntegrateXMLParser]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2015/ossE1568BZHXJS]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2015/ossE1572VGA]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2015/oss_E1573_sap]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015/oss E1559 rrz]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015/oss E1570 avr]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015/oss E1556 CHM]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015/oss M1504 JJD]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015/oss E1562 APS]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015/oss M1501 GSN]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015/oss M1501 GSN]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015/oss E1550 KMM]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015/oss E1551 RGS]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015/oss E1555 GMR]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015/oss E1552 NFR]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015/oss E1565 AAJ]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015/oss E1561 WZL]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015/oss E1553 AAJ]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015/oss E1554 AAR]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015/oss E1569 JNR]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015/oss E1560 PSV]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015/oss M1505 MSV]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015/oss E1557 GXM]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015/oss E1566 ARB]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015/oss E1567 APT]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015/oss E1574 BKS]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015/ossA1550RAN]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015/oss E1571]]&lt;br /&gt;
&lt;br /&gt;
==Final Project Design Document==&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015 E1577 MayYellowRoverJump]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015 E1586 AnonymousChatBetweenAuthorAndReviewer]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015 E1582 Create integration tests for the instructor interface using capybara and rspec]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015 E1576 Refactoring submitted content (hyperlinks and files)]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015 E1590 Integration testing for Team creation]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015 E1585 Use Ajax for Add Participants, Add TA ,Edit Questionnaires Screens]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015 E1581 Integration testing for student interface]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015 E1583 Fix the CSS used for Menu Item]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015 E1591 Integration testing for peer review]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015 E1589 Automating production setup and deployment]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015 M1502 Improve HTTP monitoring devtool support]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015 M1503 Integrate xml5ever XML parser]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015 M1504 Implement support for missing XMLHttpRequest APIs]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015 M1505 Add conformance tests to unicode-bidi and fix conformance bugs]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015 M1501 Report CSS errors to the devtools, both stored and live]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015 E1579 Instructor account creation over the web]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015 A1550 Web Socket Implementation in Apache Ambari]]&lt;/div&gt;</summary>
		<author><name>Rpsingh3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_A1550_Web_Socket_Implementation_in_Apache_Ambari&amp;diff=99370</id>
		<title>CSC/ECE 517 A1550 Web Socket Implementation in Apache Ambari</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_A1550_Web_Socket_Implementation_in_Apache_Ambari&amp;diff=99370"/>
		<updated>2015-11-10T04:58:36Z</updated>

		<summary type="html">&lt;p&gt;Rpsingh3: Created page with &amp;quot;=='''A1550 - Web Socket Implementation in Apache Ambari'''== Ambari-Web uses simple ajax polling mechanism to fetch data from Ambari-Server. Constant polling is done to show curr...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''A1550 - Web Socket Implementation in Apache Ambari'''==&lt;br /&gt;
Ambari-Web uses simple ajax polling mechanism to fetch data from Ambari-Server. Constant polling is done to show current service status, alerts, service graphs, etc on Ambari-Web. With this mechanism, the performance of Ambari-Server can be affected on a large size cluster with multiple active browser sessions due to continuous heavy requests being made. &lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/WebSocket WebSocket] is a protocol providing full-duplex communication channels over a single TCP connection. Implementing Web-Socket between Ambari-Web and Ambari-Server will be helpful to address this scenario.&lt;br /&gt;
&lt;br /&gt;
=='''What is Apache Ambari'''==&lt;br /&gt;
Apache Ambari is a software project of the [https://en.wikipedia.org/wiki/Apache_Software_Foundation Apache Software Foundation], is aimed at making [https://en.wikipedia.org/wiki/Apache_Hadoop Hadoop] management simpler by developing software for provisioning, managing, and monitoring Apache Hadoop clusters. Ambari provides an intuitive, easy-to-use [https://en.wikipedia.org/wiki/Apache_Hadoop Hadoop] management web UI backed by its [https://en.wikipedia.org/wiki/Representational_state_transfer RESTful] APIs. Ambari was a sub-project of [https://en.wikipedia.org/wiki/Apache_Hadoop Hadoop] but is now a [https://en.wikipedia.org/wiki/Apache_Software_Foundation#Projects top-level] project in its own right.&lt;br /&gt;
&lt;br /&gt;
An Apache Hadoop cluster consists on a group or nodes/machines. Each node acts as an Ambari Agent that runs various service components (e.g. Datanode for HDFS). One of the agents acts as an Ambari Server that takes care of the task allocation, management, gathering information about the services status and other information from the agents and giving the information to Ambari UI for display. More information about Agent-Server-Web flow is available in the following sections.&lt;br /&gt;
&lt;br /&gt;
=='''Current Implementation'''==&lt;br /&gt;
Ambari is a multi-module Maven project. The relevant modules for our project from an implementation perspective are Ambari Web and Ambari Server. Ambari Agent is another module, important functionally.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Ambari Agent &amp;lt;/b&amp;gt; is a component that resides on every node of the cluster. Its responsibility is to collect the node's overall health which comprises of the health metrics of all the different services running on that node. Ambari Agent sends these statuses to the Ambari Server in the form of periodic messages which is termed as 'heartbeat' in the Ambari nomenclature. In return, Ambari agents receive Heartbeat responses from Ambari Server. Hearbeat responses could contain commands for the agent to perform.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Ambari Web &amp;lt;/b&amp;gt; presents a user interface to monitor and manage a Hadoop cluster. Web module is written in JavaScript using ember.js framework. During our code study, we observed this module following the [https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller MVC] design methodology. The whole motivation of this module is to make it convenient to the end-user to manage the concerned Hadoop cluster.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Ambari Server &amp;lt;/b&amp;gt; is the most central component of an Ambari ecosystem. Ambari Server exposes [https://en.wikipedia.org/wiki/Application_programming_interface APIs]] to its clients such as Ambari Web, which monitors health of a cluster. Ambari Server clients can query for node health statuses. Ambari Server persists the nodes' statuses in a [https://en.wikipedia.org/wiki/PostgreSQL PostgreSQL] database in the backend. Internally, Ambari Server has several components which help it to manage its responsibilities. Ambari Server's important responsibilities are as follows:&lt;br /&gt;
&amp;lt;p&amp;gt; 1. Collect health statuses ( heartbeats ) from Ambari agents. Process their statuses and send heartbeat responses to Ambari agents. &amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt; 2. Handle requests from Ambari Server's clients: One such use case is installing a new service on an Ambari agent. This request could be received from Ambari Web and it is the server's responsibility to send appropriate instructions to the particular agent to get the new service up and running on the agent. &amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Testing Framework'''==&lt;br /&gt;
The codebase is very well supported with unit tests. Following are a few important characteristics of the testing process that we observed during our code study:&lt;br /&gt;
&lt;br /&gt;
1. A popular mocking framework, [https://en.wikipedia.org/wiki/Mockito Mockito] is used to mock responses from dependent downstream services. An in-memory cluster is also mocked using Mockito. Mocking frameworks let us have our test cases fast and independent, which is very well depicted in this project. &lt;br /&gt;
&lt;br /&gt;
2. Every controller method is tested in and out. Tests are quite extensive and cover almost all the code branches, testing each and every feature thoroughly.&lt;br /&gt;
&lt;br /&gt;
3. Only the results/responses obtained from controller methods are asserted. We do not find any significant &amp;quot;verify() / expect()&amp;quot; calls. (&amp;quot;verify/expect&amp;quot; calls are used to assert if a given method was invoked during the test method execution). This is quite a good feature followed as the tests are implemented in a result-oriented way and are not bound to the method implementation in anyway. This also goes to show the stability of the tests as if the method implementation undergoes changes in future, it won't fail our tests.&lt;br /&gt;
&lt;br /&gt;
==='''Steps to build and test Ambari-WebSocket'''===&lt;br /&gt;
1. Clone the repository to your local system&amp;lt;br&amp;gt;&lt;br /&gt;
   git clone https://github.com/nisarg64/ambari&lt;br /&gt;
&lt;br /&gt;
2. Got to ambari directory and checkout the branch &amp;quot;migration&amp;quot; using below command&amp;lt;br&amp;gt;&lt;br /&gt;
   git checkout migration&lt;br /&gt;
&lt;br /&gt;
3. You will need nodeJs, maven etc to build the ambari. Check the requirements as described in [https://cwiki.apache.org/confluence/display/AMBARI/Ambari+Development Ambari PreConfigs]&lt;br /&gt;
&lt;br /&gt;
4. After having the required configurations, run below command to build &amp;lt;br&amp;gt;&lt;br /&gt;
   mvn clean package -DskipTests -Drat.ignoreErrors=true&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Project Goals, Benefits and Challenges'''==&lt;br /&gt;
'''Goals:'''&lt;br /&gt;
&amp;lt;p&amp;gt;1. Understand architecture of Ambari-Server and Ambari-web&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;2. Replace the current pull-based mechanism with the push-based mechanism via Web-Socket&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;3. Write test cases for the Web Socket implementation to test the functionalities of WebSocket Client and WebSocket Server&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Benefits:'''&lt;br /&gt;
&amp;lt;p&amp;gt;1. Web Socket will allow Ambari-Server to perform robustly in a large cluster setup with multiple browser sessions and when continuous heavy requests are being made&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Challenges:'''&lt;br /&gt;
&amp;lt;p&amp;gt;1. Ambari server uses [https://en.wikipedia.org/wiki/Jetty_%28web_server%29 Jetty] 8.x version, while support for Web Socket was made available after [https://en.wikipedia.org/wiki/Jetty_%28web_server%29 Jetty] 9.x&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;2. Ambari has a huge codebase with multiple modules and multiple frameworks and design patterns adopted. Understanding the flow of the project and taking care of dependencies is a huge challenge&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;3. For testing the code requires a cluster of around 3 nodes. Running 3 virtual machines requires a high performance machine.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Learning Outcomes'''==&lt;br /&gt;
&amp;lt;p&amp;gt;1. We have observed that Ambari project adopts various design patterns like [https://en.wikipedia.org/wiki/Singleton_pattern Singleton Pattern] in the Data Access Object Classes&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;2. We also noticed in one of the classes called HeartBeatHandler, that it obeys the [https://en.wikipedia.org/wiki/Law_of_Demeter Law of Demeter]&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;3. For testing, project using the [https://en.wikipedia.org/wiki/Mockito Mockito] framework to mock the heartbeat and cluster functionality&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;4. For configuration management, [https://en.wikipedia.org/wiki/Puppet_%28software%29 Puppet] configuration management tool is used&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;5. Ambari-Web is implemented in [https://en.wikipedia.org/wiki/Ember.js Ember.js] which is an open-source Javascript framework that follows [https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller MVC] pattern similar to Rails framework.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;6. Ambari-server uses [https://en.wikipedia.org/wiki/Jetty_%28web_server%29 Jetty] which is a web-server to handle all the HTTP requests made onto the ambari-server from the UI&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Github Location'''==&lt;br /&gt;
 [https://github.com/apache/ambari Ambari Project]&lt;br /&gt;
&lt;br /&gt;
Forked Repository:&lt;br /&gt;
 [https://github.com/nisarg64/ambari Forked Repo]&lt;br /&gt;
&lt;br /&gt;
Changes committed to forked repositry:&lt;br /&gt;
 [https://github.com/nisarg64/ambari/commit/f7b9131cb7324dda39b95db72673a63ab2ac109b Code changes]&lt;br /&gt;
&lt;br /&gt;
'''Major code changes:'''&lt;br /&gt;
&amp;lt;p&amp;gt;Addition of websocket client-sever files [https://github.com/nisarg64/ambari/commit/f7b9131cb7324dda39b95db72673a63ab2ac109b#diff-4ac64b666141c53eb339c0375455d311 WebSocketClient.java] and [https://github.com/nisarg64/ambari/commit/f7b9131cb7324dda39b95db72673a63ab2ac109b#diff-0d2947581a9630d9b41c77e5f0fd23b6  WebSocketServer.java]&amp;lt;br&amp;gt;&lt;br /&gt;
Changes in heartbeat handler - [https://github.com/nisarg64/ambari/commit/f7b9131cb7324dda39b95db72673a63ab2ac109b#diff-1b3d5840e204ec59cec0cc42c9de12ea HeartBeatHandler.java]&amp;lt;br&amp;gt;&lt;br /&gt;
Version changes in [https://en.wikipedia.org/wiki/Apache_Maven#Project_Object_Model POM] files.&amp;lt;/p&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Note: We are required to submit only one pull request and that too at the end of the final project.&amp;lt;/font&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;p&amp;gt;https://ambari.apache.org/&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;https://en.wikipedia.org/wiki/Apache_Ambari&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;https://cwiki.apache.org/confluence/display/AMBARI/Ambari&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;https://issues.apache.org/jira/secure/attachment/12559939/Ambari_Architecture.pdf&amp;lt;/p&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rpsingh3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/ossA1550RAN&amp;diff=98979</id>
		<title>CSC/ECE 517 Fall 2015/ossA1550RAN</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/ossA1550RAN&amp;diff=98979"/>
		<updated>2015-11-08T19:03:39Z</updated>

		<summary type="html">&lt;p&gt;Rpsingh3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''A1550 - Web Socket Implementation in Apache Ambari'''==&lt;br /&gt;
Ambari-Web uses simple ajax polling mechanism to fetch data from Ambari-Server. Constant polling is done to show current service status, alerts, service graphs, etc on Ambari-Web. With this mechanism, the performance of Ambari-Server can be affected on a large size cluster with multiple active browser sessions due to continuous heavy requests being made. &lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/WebSocket WebSocket] is a protocol providing full-duplex communication channels over a single TCP connection. Implementing Web-Socket between Ambari-Web and Ambari-Server will be helpful to address this scenario.&lt;br /&gt;
&lt;br /&gt;
=='''What is Apache Ambari'''==&lt;br /&gt;
Apache Ambari is a software project of the [https://en.wikipedia.org/wiki/Apache_Software_Foundation Apache Software Foundation], is aimed at making [https://en.wikipedia.org/wiki/Apache_Hadoop Hadoop] management simpler by developing software for provisioning, managing, and monitoring Apache Hadoop clusters. Ambari provides an intuitive, easy-to-use [https://en.wikipedia.org/wiki/Apache_Hadoop Hadoop] management web UI backed by its [https://en.wikipedia.org/wiki/Representational_state_transfer RESTful] APIs. Ambari was a sub-project of [https://en.wikipedia.org/wiki/Apache_Hadoop Hadoop] but is now a [https://en.wikipedia.org/wiki/Apache_Software_Foundation#Projects top-level] project in its own right.&lt;br /&gt;
&lt;br /&gt;
An Apache Hadoop cluster consists on a group or nodes/machines. Each node acts as an Ambari Agent that runs various service components (e.g. Datanode for HDFS). One of the agents acts as an Ambari Server that takes care of the task allocation, management, gathering information about the services status and other information from the agents and giving the information to Ambari UI for display. More information about Agent-Server-Web flow is available in the following sections.&lt;br /&gt;
&lt;br /&gt;
=='''Current Implementation'''==&lt;br /&gt;
Ambari is a multi-module Maven project. The relevant modules for our project from an implementation perspective are Ambari Web and Ambari Server. Ambari Agent is another module, important functionally.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Ambari Agent &amp;lt;/b&amp;gt; is a component that resides on every node of the cluster. Its responsibility is to collect the node's overall health which comprises of the health metrics of all the different services running on that node. Ambari Agent sends these statuses to the Ambari Server in the form of periodic messages which is termed as 'heartbeat' in the Ambari nomenclature. In return, Ambari agents receive Heartbeat responses from Ambari Server. Hearbeat responses could contain commands for the agent to perform.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Ambari Web &amp;lt;/b&amp;gt; presents a user interface to monitor and manage a Hadoop cluster. Web module is written in JavaScript using ember.js framework. During our code study, we observed this module following the [https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller MVC] design methodology. The whole motivation of this module is to make it convenient to the end-user to manage the concerned Hadoop cluster.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Ambari Server &amp;lt;/b&amp;gt; is the most central component of an Ambari ecosystem. Ambari Server exposes [https://en.wikipedia.org/wiki/Application_programming_interface APIs]] to its clients such as Ambari Web, which monitors health of a cluster. Ambari Server clients can query for node health statuses. Ambari Server persists the nodes' statuses in a [https://en.wikipedia.org/wiki/PostgreSQL PostgreSQL] database in the backend. Internally, Ambari Server has several components which help it to manage its responsibilities. Ambari Server's important responsibilities are as follows:&lt;br /&gt;
&amp;lt;p&amp;gt; 1. Collect health statuses ( heartbeats ) from Ambari agents. Process their statuses and send heartbeat responses to Ambari agents. &amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt; 2. Handle requests from Ambari Server's clients: One such use case is installing a new service on an Ambari agent. This request could be received from Ambari Web and it is the server's responsibility to send appropriate instructions to the particular agent to get the new service up and running on the agent. &amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Testing Framework'''==&lt;br /&gt;
The codebase is very well supported with unit tests. Following are a few important characteristics of the testing process that we observed during our code study:&lt;br /&gt;
&lt;br /&gt;
1. A popular mocking framework, [https://en.wikipedia.org/wiki/Mockito Mockito] is used to mock responses from dependent downstream services. An in-memory cluster is also mocked using Mockito. Mocking frameworks let us have our test cases fast and independent, which is very well depicted in this project. &lt;br /&gt;
&lt;br /&gt;
2. Every controller method is tested in and out. Tests are quite extensive and cover almost all the code branches, testing each and every feature thoroughly.&lt;br /&gt;
&lt;br /&gt;
3. Only the results/responses obtained from controller methods are asserted. We do not find any significant &amp;quot;verify() / expect()&amp;quot; calls. (&amp;quot;verify/expect&amp;quot; calls are used to assert if a given method was invoked during the test method execution). This is quite a good feature followed as the tests are implemented in a result-oriented way and are not bound to the method implementation in anyway. This also goes to show the stability of the tests as if the method implementation undergoes changes in future, it won't fail our tests.&lt;br /&gt;
&lt;br /&gt;
==='''Steps to build and test Ambari-WebSocket'''===&lt;br /&gt;
1. Clone the repository to your local system&amp;lt;br&amp;gt;&lt;br /&gt;
   git clone https://github.com/nisarg64/ambari&lt;br /&gt;
&lt;br /&gt;
2. Got to ambari directory and checkout the branch &amp;quot;migration&amp;quot; using below command&amp;lt;br&amp;gt;&lt;br /&gt;
   git checkout migration&lt;br /&gt;
&lt;br /&gt;
3. You will need nodeJs, maven etc to build the ambari. Check the requirements as described in [https://cwiki.apache.org/confluence/display/AMBARI/Ambari+Development Ambari PreConfigs]&lt;br /&gt;
&lt;br /&gt;
4. After having the required configurations, run below command to build &amp;lt;br&amp;gt;&lt;br /&gt;
   mvn clean package -DskipTests -Drat.ignoreErrors=true&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Project Goals, Benefits and Challenges'''==&lt;br /&gt;
'''Goals:'''&lt;br /&gt;
&amp;lt;p&amp;gt;1. Understand architecture of Ambari-Server and Ambari-web&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;2. Replace the current pull-based mechanism with the push-based mechanism via Web-Socket&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;3. Write test cases for the Web Socket implementation to test the functionalities of WebSocket Client and WebSocket Server&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Benefits:'''&lt;br /&gt;
&amp;lt;p&amp;gt;1. Web Socket will allow Ambari-Server to perform robustly in a large cluster setup with multiple browser sessions and when continuous heavy requests are being made&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Challenges:'''&lt;br /&gt;
&amp;lt;p&amp;gt;1. Ambari server uses [https://en.wikipedia.org/wiki/Jetty_%28web_server%29 Jetty] 8.x version, while support for Web Socket was made available after [https://en.wikipedia.org/wiki/Jetty_%28web_server%29 Jetty] 9.x&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;2. Ambari has a huge codebase with multiple modules and multiple frameworks and design patterns adopted. Understanding the flow of the project and taking care of dependencies is a huge challenge&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;3. For testing the code requires a cluster of around 3 nodes. Running 3 virtual machines requires a high performance machine.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Learning Outcomes'''==&lt;br /&gt;
&amp;lt;p&amp;gt;1. We have observed that Ambari project adopts various design patterns like [https://en.wikipedia.org/wiki/Singleton_pattern Singleton Pattern] in the Data Access Object Classes&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;2. We also noticed in one of the classes called HeartBeatHandler, that it obeys the [https://en.wikipedia.org/wiki/Law_of_Demeter Law of Demeter]&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;3. For testing, project using the [https://en.wikipedia.org/wiki/Mockito Mockito] framework to mock the heartbeat and cluster functionality&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;4. For configuration management, [https://en.wikipedia.org/wiki/Puppet_%28software%29 Puppet] configuration management tool is used&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;5. Ambari-Web is implemented in [https://en.wikipedia.org/wiki/Ember.js Ember.js] which is an open-source Javascript framework that follows [https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller MVC] pattern similar to Rails framework.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;6. Ambari-server uses [https://en.wikipedia.org/wiki/Jetty_%28web_server%29 Jetty] which is a web-server to handle all the HTTP requests made onto the ambari-server from the UI&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Github Location'''==&lt;br /&gt;
 [https://github.com/apache/ambari Ambari Project]&lt;br /&gt;
&lt;br /&gt;
Forked Repository:&lt;br /&gt;
 [https://github.com/nisarg64/ambari Forked Repo]&lt;br /&gt;
&lt;br /&gt;
Changes committed to forked repositry:&lt;br /&gt;
 [https://github.com/nisarg64/ambari/commit/f7b9131cb7324dda39b95db72673a63ab2ac109b Code changes]&lt;br /&gt;
&lt;br /&gt;
'''Major code changes:'''&lt;br /&gt;
&amp;lt;p&amp;gt;Addition of websocket client-sever files [https://github.com/nisarg64/ambari/commit/f7b9131cb7324dda39b95db72673a63ab2ac109b#diff-4ac64b666141c53eb339c0375455d311 WebSocketClient.java] and [https://github.com/nisarg64/ambari/commit/f7b9131cb7324dda39b95db72673a63ab2ac109b#diff-0d2947581a9630d9b41c77e5f0fd23b6  WebSocketServer.java]&amp;lt;br&amp;gt;&lt;br /&gt;
Changes in heartbeat handler - [https://github.com/nisarg64/ambari/commit/f7b9131cb7324dda39b95db72673a63ab2ac109b#diff-1b3d5840e204ec59cec0cc42c9de12ea HeartBeatHandler.java]&amp;lt;br&amp;gt;&lt;br /&gt;
Version changes in [https://en.wikipedia.org/wiki/Apache_Maven#Project_Object_Model POM] files.&amp;lt;/p&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Note: We are required to submit only one pull request and that too at the end of the final project.&amp;lt;/font&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;p&amp;gt;https://ambari.apache.org/&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;https://en.wikipedia.org/wiki/Apache_Ambari&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;https://cwiki.apache.org/confluence/display/AMBARI/Ambari&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;https://issues.apache.org/jira/secure/attachment/12559939/Ambari_Architecture.pdf&amp;lt;/p&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rpsingh3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/ossA1550RAN&amp;diff=98596</id>
		<title>CSC/ECE 517 Fall 2015/ossA1550RAN</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/ossA1550RAN&amp;diff=98596"/>
		<updated>2015-11-07T01:19:46Z</updated>

		<summary type="html">&lt;p&gt;Rpsingh3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''A1550 - Web Socket Implementation in Apache Ambari'''==&lt;br /&gt;
Ambari-Web uses simple ajax polling mechanism to fetch data from Ambari-Server. Constant polling is done to show current service status, alerts, service graphs, etc on Ambari-Web. With this mechanism, the performance of Ambari-Server can be affected on a large size cluster with multiple active browser sessions due to continuous heavy requests being made. &lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/WebSocket WebSocket] is a protocol providing full-duplex communication channels over a single TCP connection. Implementing Web-Socket between Ambari-Web and Ambari-Server will be helpful to address this scenario.&lt;br /&gt;
&lt;br /&gt;
=='''What is Apache Ambari'''==&lt;br /&gt;
Apache Ambari is a software project of the [https://en.wikipedia.org/wiki/Apache_Software_Foundation Apache Software Foundation], is aimed at making [https://en.wikipedia.org/wiki/Apache_Hadoop Hadoop] management simpler by developing software for provisioning, managing, and monitoring Apache Hadoop clusters. Ambari provides an intuitive, easy-to-use [https://en.wikipedia.org/wiki/Apache_Hadoop Hadoop] management web UI backed by its [https://en.wikipedia.org/wiki/Representational_state_transfer RESTful] APIs. Ambari was a sub-project of [https://en.wikipedia.org/wiki/Apache_Hadoop Hadoop] but is now a [https://en.wikipedia.org/wiki/Apache_Software_Foundation#Projects top-level] project in its own right.&lt;br /&gt;
&lt;br /&gt;
An Apache Hadoop cluster consists on a group or nodes/machines. Each node acts as an Ambari Agent that runs various service components (e.g. Datanode for HDFS). One of the agents acts as an Ambari Server that takes care of the task allocation, management, gathering information about the services status and other information from the agents and giving the information to Ambari UI for display. More information about Agent-Server-Web flow is available in the following sections.&lt;br /&gt;
&lt;br /&gt;
=='''Current Implementation'''==&lt;br /&gt;
Ambari is a multi-module Maven project. The relevant modules for our project from an implementation perspective are Ambari Web and Ambari Server. Ambari Agent is another module, important functionally.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Ambari Agent &amp;lt;/b&amp;gt; is a component that resides on every node of the cluster. Its responsibility is to collect the node's overall health which comprises of the health metrics of all the different services running on that node. Ambari Agent sends these statuses to the Ambari Server in the form of periodic messages which is termed as 'heartbeat' in the Ambari nomenclature. In return, Ambari agents receive Heartbeat responses from Ambari Server. Hearbeat responses could contain commands for the agent to perform.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Ambari Web &amp;lt;/b&amp;gt; presents a user interface to monitor and manage a Hadoop cluster. Web module is written in JavaScript using ember.js framework. During our code study, we observed this module following the [https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller MVC] design methodology. The whole motivation of this module is to make it convenient to the end-user to manage the concerned Hadoop cluster.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Ambari Server &amp;lt;/b&amp;gt; is the most central component of an Ambari ecosystem. Ambari Server exposes [https://en.wikipedia.org/wiki/Application_programming_interface APIs]] to its clients such as Ambari Web, which monitors health of a cluster. Ambari Server clients can query for node health statuses. Ambari Server persists the nodes' statuses in a [https://en.wikipedia.org/wiki/PostgreSQL PostgreSQL] database in the backend. Internally, Ambari Server has several components which help it to manage its responsibilities. Ambari Server's important responsibilities are as follows:&lt;br /&gt;
&amp;lt;p&amp;gt; 1. Collect health statuses ( heartbeats ) from Ambari agents. Process their statuses and send heartbeat responses to Ambari agents. &amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt; 2. Handle requests from Ambari Server's clients: One such use case is installing a new service on an Ambari agent. This request could be received from Ambari Web and it is the server's responsibility to send appropriate instructions to the particular agent to get the new service up and running on the agent. &amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Testing Framework'''==&lt;br /&gt;
The codebase is very well supported with unit tests. Following are a few important characteristics of the testing process that we observed during our code study:&lt;br /&gt;
&lt;br /&gt;
1. A popular mocking framework, [https://en.wikipedia.org/wiki/Mockito Mockito] is used to mock responses from dependent downstream services. An in-memory cluster is also mocked using Mockito. Mocking frameworks let us have our test cases fast and independent, which is very well depicted in this project. &lt;br /&gt;
&lt;br /&gt;
2. Every controller method is tested in and out. Tests are quite extensive and cover almost all the code branches, testing each and every feature thoroughly.&lt;br /&gt;
&lt;br /&gt;
3. Only the results/responses obtained from controller methods are asserted. We do not find any significant &amp;quot;verify() / expect()&amp;quot; calls. (&amp;quot;verify/expect&amp;quot; calls are used to assert if a given method was invoked during the test method execution). This is quite a good feature followed as the tests are implemented in a result-oriented way and are not bound to the method implementation in anyway. This also goes to show the stability of the tests as if the method implementation undergoes changes in future, it won't fail our tests.&lt;br /&gt;
&lt;br /&gt;
==='''Steps to build and test Ambari-WebSocket'''===&lt;br /&gt;
1. Clone the repository to your local system&amp;lt;br&amp;gt;&lt;br /&gt;
   git clone https://github.com/nisarg64/ambari&lt;br /&gt;
&lt;br /&gt;
2. Got to ambari directory and checkout the branch &amp;quot;migration&amp;quot; using below command&amp;lt;br&amp;gt;&lt;br /&gt;
   git checkout migration&lt;br /&gt;
&lt;br /&gt;
3. You will need nodeJs, maven etc to build the ambari. Check the requirements as described in [https://cwiki.apache.org/confluence/display/AMBARI/Ambari+Development Ambari PreConfigs]&lt;br /&gt;
&lt;br /&gt;
4. After having the required configurations, run below command to build &amp;lt;br&amp;gt;&lt;br /&gt;
   mvn clean package -DskipTests -Drat.ignoreErrors=true&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Project Goals, Benefits and Challenges'''==&lt;br /&gt;
'''Goals:'''&lt;br /&gt;
&amp;lt;p&amp;gt;1. Understand architecture of Ambari-Server and Ambari-web&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;2. Replace the current pull-based mechanism with the push-based mechanism via Web-Socket&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;3. Write test cases for the Web Socket implementation to test the functionalities of WebSocket Client and WebSocket Server&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Benefits:'''&lt;br /&gt;
&amp;lt;p&amp;gt;1. Web Socket will allow Ambari-Server to perform robustly in a large cluster setup with multiple browser sessions and when continuous heavy requests are being made&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Challenges:'''&lt;br /&gt;
&amp;lt;p&amp;gt;1. Ambari server uses [https://en.wikipedia.org/wiki/Jetty_%28web_server%29 Jetty] 8.x version, while support for Web Socket was made available after [https://en.wikipedia.org/wiki/Jetty_%28web_server%29 Jetty] 9.x&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;2. Ambari has a huge codebase with multiple modules and multiple frameworks and design patterns adopted. Understanding the flow of the project and taking care of dependencies is a huge challenge&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;3. For testing the code requires a cluster of around 3 nodes. Running 3 virtual machines requires a high performance machine.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Learning Outcomes'''==&lt;br /&gt;
&amp;lt;p&amp;gt;1. We have observed that Ambari project adopts various design patterns like [https://en.wikipedia.org/wiki/Singleton_pattern Singleton Pattern] in the Data Access Object Classes&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;2. We also noticed in one of the classes called HeartBeatHandler, that it obeys the [https://en.wikipedia.org/wiki/Law_of_Demeter Law of Demeter]&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;3. For testing, project using the [https://en.wikipedia.org/wiki/Mockito Mockito] framework to mock the heartbeat and cluster functionality&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;4. For configuration management, [https://en.wikipedia.org/wiki/Puppet_%28software%29 Puppet] configuration management tool is used&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;5. Ambari-Web is implemented in [https://en.wikipedia.org/wiki/Ember.js Ember.js] which is an open-source Javascript framework that follows [https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller MVC] pattern similar to Rails framework.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;6. Ambari-server uses [https://en.wikipedia.org/wiki/Jetty_%28web_server%29 Jetty] which is a web-server to handle all the HTTP requests made onto the ambari-server from the UI&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Github Location'''==&lt;br /&gt;
 [https://github.com/apache/ambari Ambari Project]&lt;br /&gt;
&lt;br /&gt;
Forked Repository:&lt;br /&gt;
 [https://github.com/nisarg64/ambari Forked Repo]&lt;br /&gt;
&lt;br /&gt;
Changes committed to forked repositry:&lt;br /&gt;
 [https://github.com/nisarg64/ambari/commit/f7b9131cb7324dda39b95db72673a63ab2ac109b Code changes]&lt;br /&gt;
&lt;br /&gt;
'''Major code changes:'''&lt;br /&gt;
&amp;lt;p&amp;gt;Addition of websocket client-sever files [https://github.com/nisarg64/ambari/commit/f7b9131cb7324dda39b95db72673a63ab2ac109b#diff-4ac64b666141c53eb339c0375455d311 WebSocketClient.java] and [https://github.com/nisarg64/ambari/commit/f7b9131cb7324dda39b95db72673a63ab2ac109b#diff-0d2947581a9630d9b41c77e5f0fd23b6  WebSocketServer.java]&amp;lt;br&amp;gt;&lt;br /&gt;
Changes in heartbeat handler - [https://github.com/nisarg64/ambari/commit/f7b9131cb7324dda39b95db72673a63ab2ac109b#diff-1b3d5840e204ec59cec0cc42c9de12ea HeartBeatHandler.java]&amp;lt;br&amp;gt;&lt;br /&gt;
Version changes in [https://en.wikipedia.org/wiki/Apache_Maven#Project_Object_Model POM] files.&amp;lt;/p&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Note: We are required to submit only one pull request and that too at the end of the final project.&amp;lt;/font&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are version issues because of which the build is unsuccessful after applying our changes. The main issue is because of mismatch between jetty versions - version which is supported by ambari and version after which web socket was made available. &amp;lt;br&amp;gt;We are in touch with the other contributors and are working on how to resolve the issue.&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;p&amp;gt;https://ambari.apache.org/&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;https://en.wikipedia.org/wiki/Apache_Ambari&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;https://cwiki.apache.org/confluence/display/AMBARI/Ambari&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;https://issues.apache.org/jira/secure/attachment/12559939/Ambari_Architecture.pdf&amp;lt;/p&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rpsingh3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/ossA1550RAN&amp;diff=98584</id>
		<title>CSC/ECE 517 Fall 2015/ossA1550RAN</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/ossA1550RAN&amp;diff=98584"/>
		<updated>2015-11-07T01:13:31Z</updated>

		<summary type="html">&lt;p&gt;Rpsingh3: Add steps to build ambari&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''A1550 - Web Socket Implementation in Apache Ambari'''==&lt;br /&gt;
Ambari-Web uses simple ajax polling mechanism to fetch data from Ambari-Server. Constant polling is done to show current service status, alerts, service graphs, etc on Ambari-Web. With this mechanism, the performance of Ambari-Server can be affected on a large size cluster with multiple active browser sessions due to continuous heavy requests being made. &lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/WebSocket WebSocket] is a protocol providing full-duplex communication channels over a single TCP connection. Implementing Web-Socket between Ambari-Web and Ambari-Server will be helpful to address this scenario.&lt;br /&gt;
&lt;br /&gt;
=='''What is Apache Ambari'''==&lt;br /&gt;
Apache Ambari is a software project of the [https://en.wikipedia.org/wiki/Apache_Software_Foundation Apache Software Foundation], is aimed at making [https://en.wikipedia.org/wiki/Apache_Hadoop Hadoop] management simpler by developing software for provisioning, managing, and monitoring Apache Hadoop clusters. Ambari provides an intuitive, easy-to-use [https://en.wikipedia.org/wiki/Apache_Hadoop Hadoop] management web UI backed by its [https://en.wikipedia.org/wiki/Representational_state_transfer RESTful] APIs. Ambari was a sub-project of [https://en.wikipedia.org/wiki/Apache_Hadoop Hadoop] but is now a [https://en.wikipedia.org/wiki/Apache_Software_Foundation#Projects top-level] project in its own right.&lt;br /&gt;
&lt;br /&gt;
An Apache Hadoop cluster consists on a group or nodes/machines. Each node acts as an Ambari Agent that runs various service components (e.g. Datanode for HDFS). One of the agents acts as an Ambari Server that takes care of the task allocation, management, gathering information about the services status and other information from the agents and giving the information to Ambari UI for display. More information about Agent-Server-Web flow is available in the following sections.&lt;br /&gt;
&lt;br /&gt;
=='''Current Implementation'''==&lt;br /&gt;
Ambari is a multi-module Maven project. The relevant modules for our project from an implementation perspective are Ambari Web and Ambari Server. Ambari Agent is another module, important functionally.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Ambari Agent &amp;lt;/b&amp;gt; is a component that resides on every node of the cluster. Its responsibility is to collect the node's overall health which comprises of the health metrics of all the different services running on that node. Ambari Agent sends these statuses to the Ambari Server in the form of periodic messages which is termed as 'heartbeat' in the Ambari nomenclature. In return, Ambari agents receive Heartbeat responses from Ambari Server. Hearbeat responses could contain commands for the agent to perform.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Ambari Web &amp;lt;/b&amp;gt; presents a user interface to monitor and manage a Hadoop cluster. Web module is written in JavaScript using ember.js framework. During our code study, we observed this module following the [https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller MVC] design methodology. The whole motivation of this module is to make it convenient to the end-user to manage the concerned Hadoop cluster.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Ambari Server &amp;lt;/b&amp;gt; is the most central component of an Ambari ecosystem. Ambari Server exposes [https://en.wikipedia.org/wiki/Application_programming_interface APIs]] to its clients such as Ambari Web, which monitors health of a cluster. Ambari Server clients can query for node health statuses. Ambari Server persists the nodes' statuses in a [https://en.wikipedia.org/wiki/PostgreSQL PostgreSQL] database in the backend. Internally, Ambari Server has several components which help it to manage its responsibilities. Ambari Server's important responsibilities are as follows:&lt;br /&gt;
&amp;lt;p&amp;gt; 1. Collect health statuses ( heartbeats ) from Ambari agents. Process their statuses and send heartbeat responses to Ambari agents. &amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt; 2. Handle requests from Ambari Server's clients: One such use case is installing a new service on an Ambari agent. This request could be received from Ambari Web and it is the server's responsibility to send appropriate instructions to the particular agent to get the new service up and running on the agent. &amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Testing Framework'''==&lt;br /&gt;
The codebase is very well supported with unit tests. Following are a few important characteristics of the testing process that we observed during our code study:&lt;br /&gt;
&lt;br /&gt;
1. A popular mocking framework, [https://en.wikipedia.org/wiki/Mockito Mockito] is used to mock responses from dependent downstream services. An in-memory cluster is also mocked using Mockito. Mocking frameworks let us have our test cases fast and independent, which is very well depicted in this project. &lt;br /&gt;
&lt;br /&gt;
2. Every controller method is tested in and out. Tests are quite extensive and cover almost all the code branches, testing each and every feature thoroughly.&lt;br /&gt;
&lt;br /&gt;
3. Only the results/responses obtained from controller methods are asserted. We do not find any significant &amp;quot;verify() / expect()&amp;quot; calls. (&amp;quot;verify/expect&amp;quot; calls are used to assert if a given method was invoked during the test method execution). This is quite a good feature followed as the tests are implemented in a result-oriented way and are not bound to the method implementation in anyway. This also goes to show the stability of the tests as if the method implementation undergoes changes in future, it won't fail our tests.&lt;br /&gt;
&lt;br /&gt;
==='''Steps to build and test Ambari-WebSocket'''===&lt;br /&gt;
1. Clone the repository to your local system&amp;lt;br&amp;gt;&lt;br /&gt;
   git clone https://github.com/nisarg64/ambari&lt;br /&gt;
&lt;br /&gt;
2. Got to ambari directory and checkout the branch &amp;quot;migration&amp;quot; using below command&amp;lt;br&amp;gt;&lt;br /&gt;
   git checkout migration&lt;br /&gt;
&lt;br /&gt;
3. You will need nodeJs, maven etc to build the ambari. Check the requirements as described in [https://cwiki.apache.org/confluence/display/AMBARI/Ambari+Development Ambari PreConfigs]&lt;br /&gt;
&lt;br /&gt;
4. After having the required configurations, run below command to build &amp;lt;br&amp;gt;&lt;br /&gt;
   mvn clean package -DskipTests -Drat.ignoreErrors=true&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Project Goals, Benefits and Challenges'''==&lt;br /&gt;
'''Goals:'''&lt;br /&gt;
&amp;lt;p&amp;gt;1. Understand architecture of Ambari-Server and Ambari-web&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;2. Replace the current pull-based mechanism with the push-based mechanism via Web-Socket&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;3. Write test cases for the Web Socket implementation to test the functionalities of WebSocket Client and WebSocket Server&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Benefits:'''&lt;br /&gt;
&amp;lt;p&amp;gt;1. Web Socket will allow Ambari-Server to perform robustly in a large cluster setup with multiple browser sessions and when continuous heavy requests are being made&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Challenges:'''&lt;br /&gt;
&amp;lt;p&amp;gt;1. Ambari server uses [https://en.wikipedia.org/wiki/Jetty_%28web_server%29 Jetty] 8.x version, while support for Web Socket was made available after [https://en.wikipedia.org/wiki/Jetty_%28web_server%29 Jetty] 9.x&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;2. Ambari has a huge codebase with multiple modules and multiple frameworks and design patterns adopted. Understanding the flow of the project and taking care of dependencies is a huge challenge&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;3. For testing the code requires a cluster of around 3 nodes. Running 3 virtual machines requires a high performance machine.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Learning Outcomes'''==&lt;br /&gt;
&amp;lt;p&amp;gt;1. We have observed that Ambari project adopts various design patterns like [https://en.wikipedia.org/wiki/Singleton_pattern Singleton Pattern] in the Data Access Object Classes&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;2. We also noticed in one of the classes called HeartBeatHandler, that it obeys the [https://en.wikipedia.org/wiki/Law_of_Demeter Law of Demeter]&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;3. For testing, project using the [https://en.wikipedia.org/wiki/Mockito Mockito] framework to mock the heartbeat and cluster functionality&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;4. For configuration management, [https://en.wikipedia.org/wiki/Puppet_%28software%29 Puppet] configuration management tool is used&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;5. Ambari-Web is implemented in [https://en.wikipedia.org/wiki/Ember.js Ember.js] which is an open-source Javascript framework that follows [https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller MVC] pattern similar to Rails framework.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;6. Ambari-server uses [https://en.wikipedia.org/wiki/Jetty_%28web_server%29 Jetty] which is a web-server to handle all the HTTP requests made onto the ambari-server from the UI&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Github Location'''==&lt;br /&gt;
 [https://github.com/apache/ambari Ambari Project]&lt;br /&gt;
&lt;br /&gt;
Forked Repository:&lt;br /&gt;
 [https://github.com/nisarg64/ambari Forked Repo]&lt;br /&gt;
&lt;br /&gt;
Changes committed to forked repositry:&lt;br /&gt;
 [https://github.com/nisarg64/ambari/commit/f7b9131cb7324dda39b95db72673a63ab2ac109b Code changes]&lt;br /&gt;
&lt;br /&gt;
'''Major code changes:'''&lt;br /&gt;
&amp;lt;p&amp;gt;Addition of websocket client-sever files [https://github.com/nisarg64/ambari/commit/f7b9131cb7324dda39b95db72673a63ab2ac109b#diff-4ac64b666141c53eb339c0375455d311 WebSocketClient.java] and [https://github.com/nisarg64/ambari/commit/f7b9131cb7324dda39b95db72673a63ab2ac109b#diff-0d2947581a9630d9b41c77e5f0fd23b6  WebSocketServer.java]&amp;lt;br&amp;gt;&lt;br /&gt;
Changes in heartbeat handler - [https://github.com/nisarg64/ambari/commit/f7b9131cb7324dda39b95db72673a63ab2ac109b#diff-1b3d5840e204ec59cec0cc42c9de12ea HeartBeatHandler.java]&amp;lt;br&amp;gt;&lt;br /&gt;
Version changes in [https://en.wikipedia.org/wiki/Apache_Maven#Project_Object_Model POM] files.&amp;lt;/p&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Note: Pull request is yet to be submitted.&amp;lt;/font&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are version issues because of which the build is unsuccessful after applying our changes. The main issue is because of mismatch between jetty versions - version which is supported by ambari and version after which web socket was made available. &amp;lt;br&amp;gt;We are in touch with the other contributors and are working on how to resolve the issue.&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;p&amp;gt;https://ambari.apache.org/&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;https://en.wikipedia.org/wiki/Apache_Ambari&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;https://cwiki.apache.org/confluence/display/AMBARI/Ambari&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;https://issues.apache.org/jira/secure/attachment/12559939/Ambari_Architecture.pdf&amp;lt;/p&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rpsingh3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/ossA1550RAN&amp;diff=98120</id>
		<title>CSC/ECE 517 Fall 2015/ossA1550RAN</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/ossA1550RAN&amp;diff=98120"/>
		<updated>2015-11-04T02:09:57Z</updated>

		<summary type="html">&lt;p&gt;Rpsingh3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''A1550 - Web Socket Implementation in Apache Ambari'''==&lt;br /&gt;
Ambari-Web uses simple ajax polling mechanism to fetch data from Ambari-Server. Constant polling is done to show current service status, alerts, service graphs, etc on Ambari-Web. With this mechanism, the performance of Ambari-Server can be affected on a large size cluster with multiple active browser sessions due to continuous heavy requests being made. &lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/WebSocket WebSocket] is a protocol providing full-duplex communication channels over a single TCP connection. Implementing Web-Socket between Ambari-Web and Ambari-Server will be helpful to address this scenario.&lt;br /&gt;
&lt;br /&gt;
=='''What is Apache Ambari'''==&lt;br /&gt;
Apache Ambari is a software project of the [https://en.wikipedia.org/wiki/Apache_Software_Foundation Apache Software Foundation], is aimed at making [https://en.wikipedia.org/wiki/Apache_Hadoop Hadoop] management simpler by developing software for provisioning, managing, and monitoring Apache Hadoop clusters. Ambari provides an intuitive, easy-to-use [https://en.wikipedia.org/wiki/Apache_Hadoop Hadoop] management web UI backed by its [https://en.wikipedia.org/wiki/Representational_state_transfer RESTful] APIs. Ambari was a sub-project of [https://en.wikipedia.org/wiki/Apache_Hadoop Hadoop] but is now a [https://en.wikipedia.org/wiki/Apache_Software_Foundation#Projects top-level] project in its own right.&lt;br /&gt;
&lt;br /&gt;
An Apache Hadoop cluster consists on a group or nodes/machines. Each node acts as an Ambari Agent that runs various service components (e.g. Datanode for HDFS). One of the agents acts as an Ambari Server that takes care of the task allocation, management, gathering information about the services status and other information from the agents and giving the information to Ambari UI for display. More information about Agent-Server-Web flow is available in the following sections.&lt;br /&gt;
&lt;br /&gt;
=='''Current Implementation'''==&lt;br /&gt;
Ambari is a multi-module Maven project. The relevant modules for our project from an implementation perspective are Ambari Web and Ambari Server. Ambari Agent is another module, important functionally.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Ambari Agent &amp;lt;/b&amp;gt; is a component that resides on every node of the cluster. Its responsibility is to collect the node's overall health which comprises of the health metrics of all the different services running on that node. Ambari Agent sends these statuses to the Ambari Server in the form of periodic messages which is termed as 'heartbeat' in the Ambari nomenclature. In return, Ambari agents receive Heartbeat responses from Ambari Server. Hearbeat responses could contain commands for the agent to perform.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Ambari Web &amp;lt;/b&amp;gt; presents a user interface to monitor and manage a Hadoop cluster. Web module is written in JavaScript using ember.js framework. During our code study, we observed this module following the [https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller MVC] design methodology. The whole motivation of this module is to make it convenient to the end-user to manage the concerned Hadoop cluster.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Ambari Server &amp;lt;/b&amp;gt; is the most central component of an Ambari ecosystem. Ambari Server exposes [https://en.wikipedia.org/wiki/Application_programming_interface APIs]] to its clients such as Ambari Web, which monitors health of a cluster. Ambari Server clients can query for node health statuses. Ambari Server persists the nodes' statuses in a [https://en.wikipedia.org/wiki/PostgreSQL PostgreSQL] database in the backend. Internally, Ambari Server has several components which help it to manage its responsibilities. Ambari Server's important responsibilities are as follows:&lt;br /&gt;
&amp;lt;p&amp;gt; 1. Collect health statuses ( heartbeats ) from Ambari agents. Process their statuses and send heartbeat responses to Ambari agents. &amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt; 2. Handle requests from Ambari Server's clients: One such use case is installing a new service on an Ambari agent. This request could be received from Ambari Web and it is the server's responsibility to send appropriate instructions to the particular agent to get the new service up and running on the agent. &amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Testing Framework'''==&lt;br /&gt;
The codebase is very well supported with unit tests. Following are a few important characteristics of the testing process that we observed during our code study:&lt;br /&gt;
&lt;br /&gt;
1. A popular mocking framework, [https://en.wikipedia.org/wiki/Mockito Mockito] is used to mock responses from dependent downstream services. An in-memory cluster is also mocked using Mockito. Mocking frameworks let us have our test cases fast and independent, which is very well depicted in this project. &lt;br /&gt;
&lt;br /&gt;
2. Every controller method is tested in and out. Tests are quite extensive and cover almost all the code branches, testing each and every feature thoroughly.&lt;br /&gt;
&lt;br /&gt;
3. Only the results/responses obtained from controller methods are asserted. We do not find any significant &amp;quot;verify() / expect()&amp;quot; calls. (&amp;quot;verify/expect&amp;quot; calls are used to assert if a given method was invoked during the test method execution). This is quite a good feature followed as the tests are implemented in a result-oriented way and are not bound to the method implementation in anyway. This also goes to show the stability of the tests as if the method implementation undergoes changes in future, it won't fail our tests.&lt;br /&gt;
&lt;br /&gt;
=='''Project Goals, Benefits and Challenges'''==&lt;br /&gt;
'''Goals:'''&lt;br /&gt;
&amp;lt;p&amp;gt;1. Understand architecture of Ambari-Server and Ambari-web&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;2. Replace the current pull-based mechanism with the push-based mechanism via Web-Socket&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;3. Write test cases for the Web Socket implementation to test the functionalities of WebSocket Client and WebSocket Server&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Benefits:'''&lt;br /&gt;
&amp;lt;p&amp;gt;1. Web Socket will allow Ambari-Server to perform robustly in a large cluster setup with multiple browser sessions and when continuous heavy requests are being made&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Challenges:'''&lt;br /&gt;
&amp;lt;p&amp;gt;1. Ambari server uses [https://en.wikipedia.org/wiki/Jetty_%28web_server%29 Jetty] 8.x version, while support for Web Socket was made available after [https://en.wikipedia.org/wiki/Jetty_%28web_server%29 Jetty] 9.x&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;2. Ambari has a huge codebase with multiple modules and multiple frameworks and design patterns adopted. Understanding the flow of the project and taking care of dependencies is a huge challenge&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;3. For testing the code requires a cluster of around 3 nodes. Running 3 virtual machines requires a high performance machine.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Learning Outcomes'''==&lt;br /&gt;
&amp;lt;p&amp;gt;1. We have observed that Ambari project adopts various design patterns like [https://en.wikipedia.org/wiki/Singleton_pattern Singleton Pattern] in the Data Access Object Classes&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;2. We also noticed in one of the classes called HeartBeatHandler, that it obeys the [https://en.wikipedia.org/wiki/Law_of_Demeter Law of Demeter]&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;3. For testing, project using the [https://en.wikipedia.org/wiki/Mockito Mockito] framework to mock the heartbeat and cluster functionality&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;4. For configuration management, [https://en.wikipedia.org/wiki/Puppet_%28software%29 Puppet] configuration management tool is used&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;5. Ambari-Web is implemented in [https://en.wikipedia.org/wiki/Ember.js Ember.js] which is an open-source Javascript framework that follows [https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller MVC] pattern similar to Rails framework.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;6. Ambari-server uses [https://en.wikipedia.org/wiki/Jetty_%28web_server%29 Jetty] which is a web-server to handle all the HTTP requests made onto the ambari-server from the UI&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Github Location'''==&lt;br /&gt;
 [https://github.com/apache/ambari Ambari Project]&lt;br /&gt;
&lt;br /&gt;
Forked Repository:&lt;br /&gt;
 [https://github.com/nisarg64/ambari Forked Repo]&lt;br /&gt;
&lt;br /&gt;
Changes committed to forked repositry:&lt;br /&gt;
 [https://github.com/nisarg64/ambari/commit/f7b9131cb7324dda39b95db72673a63ab2ac109b Code changes]&lt;br /&gt;
&lt;br /&gt;
'''Major code changes:'''&lt;br /&gt;
&amp;lt;p&amp;gt;Addition of websocket client-sever files [https://github.com/nisarg64/ambari/commit/f7b9131cb7324dda39b95db72673a63ab2ac109b#diff-4ac64b666141c53eb339c0375455d311 WebSocketClient.java] and [https://github.com/nisarg64/ambari/commit/f7b9131cb7324dda39b95db72673a63ab2ac109b#diff-0d2947581a9630d9b41c77e5f0fd23b6  WebSocketServer.java]&amp;lt;br&amp;gt;&lt;br /&gt;
Changes in heartbeat handler - [https://github.com/nisarg64/ambari/commit/f7b9131cb7324dda39b95db72673a63ab2ac109b#diff-1b3d5840e204ec59cec0cc42c9de12ea HeartBeatHandler.java]&amp;lt;br&amp;gt;&lt;br /&gt;
Version changes in [https://en.wikipedia.org/wiki/Apache_Maven#Project_Object_Model POM] files.&amp;lt;/p&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Note: Pull request is yet to be submitted.&amp;lt;/font&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are version issues because of which the build is unsuccessful after applying our changes. The main issue is because of mismatch between jetty versions - version which is supported by ambari and version after which web socket was made available. &amp;lt;br&amp;gt;We are in touch with the other contributors and are working on how to resolve the issue.&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;p&amp;gt;https://ambari.apache.org/&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;https://en.wikipedia.org/wiki/Apache_Ambari&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;https://cwiki.apache.org/confluence/display/AMBARI/Ambari&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;https://issues.apache.org/jira/secure/attachment/12559939/Ambari_Architecture.pdf&amp;lt;/p&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rpsingh3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/ossA1550RAN&amp;diff=98119</id>
		<title>CSC/ECE 517 Fall 2015/ossA1550RAN</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/ossA1550RAN&amp;diff=98119"/>
		<updated>2015-11-04T01:12:27Z</updated>

		<summary type="html">&lt;p&gt;Rpsingh3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''A1550 - Web Socket Implementation in Apache Ambari'''==&lt;br /&gt;
Ambari-Web uses simple ajax polling mechanism to fetch data from Ambari-Server. Constant polling is done to show current service status, alerts, service graphs, etc on Ambari-Web. With this mechanism, the performance of Ambari-Server can be affected on a large size cluster with multiple active browser sessions due to continuous heavy requests being made. &lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/WebSocket WebSocket] is a protocol providing full-duplex communication channels over a single TCP connection. Implementing Web-Socket between Ambari-Web and Ambari-Server will be helpful to address this scenario.&lt;br /&gt;
&lt;br /&gt;
=='''What is Apache Ambari'''==&lt;br /&gt;
Apache Ambari is a software project of the [https://en.wikipedia.org/wiki/Apache_Software_Foundation Apache Software Foundation], is aimed at making [https://en.wikipedia.org/wiki/Apache_Hadoop Hadoop] management simpler by developing software for provisioning, managing, and monitoring Apache Hadoop clusters. Ambari provides an intuitive, easy-to-use [https://en.wikipedia.org/wiki/Apache_Hadoop Hadoop] management web UI backed by its [https://en.wikipedia.org/wiki/Representational_state_transfer RESTful] APIs. Ambari was a sub-project of [https://en.wikipedia.org/wiki/Apache_Hadoop Hadoop] but is now a [https://en.wikipedia.org/wiki/Apache_Software_Foundation#Projects top-level] project in its own right.&lt;br /&gt;
&lt;br /&gt;
An Apache Hadoop cluster consists on a group or nodes/machines. Each node acts as an Ambari Agent that runs various service components (e.g. Datanode for HDFS). One of the agents acts as an Ambari Server that takes care of the task allocation, management, gathering information about the services status and other information from the agents and giving the information to Ambari UI for display. More information about Agent-Server-Web flow is available in the following sections.&lt;br /&gt;
&lt;br /&gt;
=='''Current Implementation'''==&lt;br /&gt;
Ambari is a multi-module Maven project. The relevant modules for our project from an implementation perspective are Ambari Web and Ambari Server. Ambari Agent is another module, important functionally.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Ambari Agent &amp;lt;/b&amp;gt; is a component that resides on every node of the cluster. Its responsibility is to collect the node's overall health which comprises of the health metrics of all the different services running on that node. Ambari Agent sends these statuses to the Ambari Server in the form of periodic messages which is termed as 'heartbeat' in the Ambari nomenclature. In return, Ambari agents receive Heartbeat responses from Ambari Server. Hearbeat responses could contain commands for the agent to perform.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Ambari Web &amp;lt;/b&amp;gt; presents a user interface to monitor and manage a Hadoop cluster. Web module is written in JavaScript using ember.js framework. During our code study, we observed this module following the [https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller MVC] design methodology. The whole motivation of this module is to make it convenient to the end-user to manage the concerned Hadoop cluster.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Ambari Server &amp;lt;/b&amp;gt; is the most central component of an Ambari ecosystem. Ambari Server exposes [https://en.wikipedia.org/wiki/Application_programming_interface APIs]] to its clients such as Ambari Web, which monitors health of a cluster. Ambari Server clients can query for node health statuses. Ambari Server persists the nodes' statuses in a [https://en.wikipedia.org/wiki/PostgreSQL PostgreSQL] database in the backend. Internally, Ambari Server has several components which help it to manage its responsibilities. Ambari Server's important responsibilities are as follows:&lt;br /&gt;
&amp;lt;p&amp;gt; 1. Collect health statuses ( heartbeats ) from Ambari agents. Process their statuses and send heartbeat responses to Ambari agents. &amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt; 2. Handle requests from Ambari Server's clients: One such use case is installing a new service on an Ambari agent. This request could be received from Ambari Web and it is the server's responsibility to send appropriate instructions to the particular agent to get the new service up and running on the agent. &amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Testing Framework'''==&lt;br /&gt;
The codebase is very well supported with unit tests. Following are a few important characteristics of the testing process that we observed during our code study:&lt;br /&gt;
&lt;br /&gt;
1. A popular mocking framework, [https://en.wikipedia.org/wiki/Mockito Mockito] is used to mock responses from dependent downstream services. An in-memory cluster is also mocked using Mockito. Mocking frameworks let us have our test cases fast and independent, which is very well depicted in this project. &lt;br /&gt;
&lt;br /&gt;
2. Every controller method is tested in and out. Tests are quite extensive and cover almost all the code branches, testing each and every feature thoroughly.&lt;br /&gt;
&lt;br /&gt;
3. Only the results/responses obtained from controller methods are asserted. We do not find any significant &amp;quot;verify() / expect()&amp;quot; calls. (&amp;quot;verify/expect&amp;quot; calls are used to assert if a given method was invoked during the test method execution). This is quite a good feature followed as the tests are implemented in a result-oriented way and are not bound to the method implementation in anyway. This also goes to show the stability of the tests as if the method implementation undergoes changes in future, it won't fail our tests.&lt;br /&gt;
&lt;br /&gt;
=='''Project Goals, Benefits and Challenges'''==&lt;br /&gt;
'''Goals:'''&lt;br /&gt;
&amp;lt;p&amp;gt;1. Understand architecture of Ambari-Server and Ambari-web&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;2. Replace the current pull-based mechanism with the push-based mechanism via Web-Socket&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;3. Write test cases for the Web Socket implementation to test the functionalities of WebSocket Client and WebSocket Server&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Benefits:'''&lt;br /&gt;
&amp;lt;p&amp;gt;1. Web Socket will allow Ambari-Server to perform robustly in a large cluster setup with multiple browser sessions and when continuous heavy requests are being made&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Challenges:'''&lt;br /&gt;
&amp;lt;p&amp;gt;1. Ambari server uses [https://en.wikipedia.org/wiki/Jetty_%28web_server%29 Jetty] 8.x version, while support for Web Socket was made available after [https://en.wikipedia.org/wiki/Jetty_%28web_server%29 Jetty] 9.x&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;2. Ambari has a huge codebase with multiple modules and multiple frameworks and design patterns adopted. Understanding the flow of the project and taking care of dependencies is a huge challenge&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;3. For testing the code requires a cluster of around 3 nodes. Running 3 virtual machines requires a high performance machine.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Learning Outcomes'''==&lt;br /&gt;
&amp;lt;p&amp;gt;1. We have observed that Ambari project adopts various design patterns like [https://en.wikipedia.org/wiki/Singleton_pattern Singleton Pattern] in the Data Access Object Classes&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;2. We also noticed in one of the classes called HeartBeatHandler, that it obeys the [https://en.wikipedia.org/wiki/Law_of_Demeter Law of Demeter]&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;3. For testing, project using the [https://en.wikipedia.org/wiki/Mockito Mockito] framework to mock the heartbeat and cluster functionality&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;4. For configuration management, [https://en.wikipedia.org/wiki/Puppet_%28software%29 Puppet] configuration management tool is used&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;5. Ambari-Web is implemented in [https://en.wikipedia.org/wiki/Ember.js Ember.js] which is an open-source Javascript framework that follows [https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller MVC] pattern similar to Rails framework.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;6. Ambari-server uses [https://en.wikipedia.org/wiki/Jetty_%28web_server%29 Jetty] which is a web-server to handle all the HTTP requests made onto the ambari-server from the UI&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Github Location'''==&lt;br /&gt;
 [https://github.com/apache/ambari Ambari Project]&lt;br /&gt;
&lt;br /&gt;
Forked Repository:&lt;br /&gt;
 [https://github.com/nisarg64/ambari Forked Repo]&lt;br /&gt;
&lt;br /&gt;
Changes committed to forked repositry:&lt;br /&gt;
 [https://github.com/nisarg64/ambari/commit/f7b9131cb7324dda39b95db72673a63ab2ac109b Code changes]&lt;br /&gt;
&lt;br /&gt;
'''Major code changes:'''&lt;br /&gt;
&amp;lt;p&amp;gt;Addition of websocket sever-client files [https://github.com/nisarg64/ambari/commit/f7b9131cb7324dda39b95db72673a63ab2ac109b#diff-0d2947581a9630d9b41c77e5f0fd23b6  WebSocketServer.java] and [https://github.com/nisarg64/ambari/commit/f7b9131cb7324dda39b95db72673a63ab2ac109b#diff-4ac64b666141c53eb339c0375455d311 WebSocketClient.java]&amp;lt;br&amp;gt;&lt;br /&gt;
Changes in heartbeat handler - [https://github.com/nisarg64/ambari/commit/f7b9131cb7324dda39b95db72673a63ab2ac109b#diff-1b3d5840e204ec59cec0cc42c9de12ea HeartBeatHandler.java]&amp;lt;br&amp;gt;&lt;br /&gt;
Version changes in pom files.&amp;lt;/p&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Note: Pull request is yet to be submitted.&amp;lt;/font&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are version issues because of which the build is unsuccessful after applying our changes. The main issue is because of mismatch between jetty versions - version which is supported by ambari and version after which web socket was made available. &amp;lt;br&amp;gt;We are in touch with the other contributors and are working on how to resolve the issue.&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;p&amp;gt;https://ambari.apache.org/&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;https://en.wikipedia.org/wiki/Apache_Ambari&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;https://cwiki.apache.org/confluence/display/AMBARI/Ambari&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;https://issues.apache.org/jira/secure/attachment/12559939/Ambari_Architecture.pdf&amp;lt;/p&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rpsingh3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/ossA1550RAN&amp;diff=98118</id>
		<title>CSC/ECE 517 Fall 2015/ossA1550RAN</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/ossA1550RAN&amp;diff=98118"/>
		<updated>2015-11-04T01:10:52Z</updated>

		<summary type="html">&lt;p&gt;Rpsingh3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''A1550 - Web Socket Implementation in Apache Ambari'''==&lt;br /&gt;
Ambari-Web uses simple ajax polling mechanism to fetch data from Ambari-Server. Constant polling is done to show current service status, alerts, service graphs, etc on Ambari-Web. With this mechanism, the performance of Ambari-Server can be affected on a large size cluster with multiple active browser sessions due to continuous heavy requests being made. &lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/WebSocket WebSocket] is a protocol providing full-duplex communication channels over a single TCP connection. Implementing Web-Socket between Ambari-Web and Ambari-Server will be helpful to address this scenario.&lt;br /&gt;
&lt;br /&gt;
=='''What is Apache Ambari'''==&lt;br /&gt;
Apache Ambari is a software project of the [https://en.wikipedia.org/wiki/Apache_Software_Foundation Apache Software Foundation], is aimed at making [https://en.wikipedia.org/wiki/Apache_Hadoop Hadoop] management simpler by developing software for provisioning, managing, and monitoring Apache Hadoop clusters. Ambari provides an intuitive, easy-to-use [https://en.wikipedia.org/wiki/Apache_Hadoop Hadoop] management web UI backed by its [https://en.wikipedia.org/wiki/Representational_state_transfer RESTful] APIs. Ambari was a sub-project of [https://en.wikipedia.org/wiki/Apache_Hadoop Hadoop] but is now a [https://en.wikipedia.org/wiki/Apache_Software_Foundation#Projects top-level] project in its own right.&lt;br /&gt;
&lt;br /&gt;
An Apache Hadoop cluster consists on a group or nodes/machines. Each node acts as an Ambari Agent that runs various service components (e.g. Datanode for HDFS). One of the agents acts as an Ambari Server that takes care of the task allocation, management, gathering information about the services status and other information from the agents and giving the information to Ambari UI for display. More information about Agent-Server-Web flow is available in the following sections.&lt;br /&gt;
&lt;br /&gt;
=='''Current Implementation'''==&lt;br /&gt;
Ambari is a multi-module Maven project. The relevant modules for our project from an implementation perspective are Ambari Web and Ambari Server. Ambari Agent is another module, important functionally.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Ambari Agent &amp;lt;/b&amp;gt; is a component that resides on every node of the cluster. Its responsibility is to collect the node's overall health which comprises of the health metrics of all the different services running on that node. Ambari Agent sends these statuses to the Ambari Server in the form of periodic messages which is termed as 'heartbeat' in the Ambari nomenclature. In return, Ambari agents receive Heartbeat responses from Ambari Server. Hearbeat responses could contain commands for the agent to perform.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Ambari Web &amp;lt;/b&amp;gt; presents a user interface to monitor and manage a Hadoop cluster. Web module is written in JavaScript using ember.js framework. During our code study, we observed this module following the [https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller MVC] design methodology. The whole motivation of this module is to make it convenient to the end-user to manage the concerned Hadoop cluster.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Ambari Server &amp;lt;/b&amp;gt; is the most central component of an Ambari ecosystem. Ambari Server exposes [https://en.wikipedia.org/wiki/Application_programming_interface APIs]] to its clients such as Ambari Web, which monitors health of a cluster. Ambari Server clients can query for node health statuses. Ambari Server persists the nodes' statuses in a [https://en.wikipedia.org/wiki/PostgreSQL PostgreSQL] database in the backend. Internally, Ambari Server has several components which help it to manage its responsibilities. Ambari Server's important responsibilities are as follows:&lt;br /&gt;
&amp;lt;p&amp;gt; 1. Collect health statuses ( heartbeats ) from Ambari agents. Process their statuses and send heartbeat responses to Ambari agents. &amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt; 2. Handle requests from Ambari Server's clients: One such use case is installing a new service on an Ambari agent. This request could be received from Ambari Web and it is the server's responsibility to send appropriate instructions to the particular agent to get the new service up and running on the agent. &amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Testing Framework'''==&lt;br /&gt;
The codebase is very well supported with unit tests. Following are a few important characteristics of the testing process that we observed during our code study:&lt;br /&gt;
&lt;br /&gt;
1. A popular mocking framework, [https://en.wikipedia.org/wiki/Mockito Mockito] is used to mock responses from dependent downstream services. An in-memory cluster is also mocked using Mockito. Mocking frameworks let us have our test cases fast and independent, which is very well depicted in this project. &lt;br /&gt;
&lt;br /&gt;
2. Every controller method is tested in and out. Tests are quite extensive and cover almost all the code branches, testing each and every feature thoroughly.&lt;br /&gt;
&lt;br /&gt;
3. Only the results/responses obtained from controller methods are asserted. We do not find any significant &amp;quot;verify() / expect()&amp;quot; calls. (&amp;quot;verify/expect&amp;quot; calls are used to assert if a given method was invoked during the test method execution). This is quite a good feature followed as the tests are implemented in a result-oriented way and are not bound to the method implementation in anyway. This also goes to show the stability of the tests as if the method implementation undergoes changes in future, it won't fail our tests.&lt;br /&gt;
&lt;br /&gt;
=='''Project Goals, Benefits and Challenges'''==&lt;br /&gt;
'''Goals:'''&lt;br /&gt;
&amp;lt;p&amp;gt;1. Understand architecture of Ambari-Server and Ambari-web&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;2. Replace the current pull-based mechanism with the push-based mechanism via Web-Socket&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;3. Write test cases for the Web Socket implementation to test the functionalities of WebSocket Client and WebSocket Server&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Benefits:'''&lt;br /&gt;
&amp;lt;p&amp;gt;1. Web Socket will allow Ambari-Server to perform robustly in a large cluster setup with multiple browser sessions and when continuous heavy requests are being made&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Challenges:'''&lt;br /&gt;
&amp;lt;p&amp;gt;1. Ambari server uses [https://en.wikipedia.org/wiki/Jetty_%28web_server%29 Jetty] 8.x version, while support for Web Socket was made available after [https://en.wikipedia.org/wiki/Jetty_%28web_server%29 Jetty] 9.x&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;2. Ambari has a huge codebase with multiple modules and multiple frameworks and design patterns adopted. Understanding the flow of the project and taking care of dependencies is a huge challenge&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;3. For testing the code requires a cluster of around 3 nodes. Running 3 virtual machines requires a high performance machine.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Learning Outcomes'''==&lt;br /&gt;
&amp;lt;p&amp;gt;1. We have observed that Ambari project adopts various design patterns like [https://en.wikipedia.org/wiki/Singleton_pattern Singleton Pattern] in the Data Access Object Classes&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;2. We also noticed in one of the classes called HeartBeatHandler, that it obeys the [https://en.wikipedia.org/wiki/Law_of_Demeter Law of Demeter]&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;3. For testing, project using the [https://en.wikipedia.org/wiki/Mockito Mockito] framework to mock the heartbeat and cluster functionality&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;4. For configuration management, [https://en.wikipedia.org/wiki/Puppet_%28software%29 Puppet] configuration management tool is used&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;5. Ambari-Web is implemented in [https://en.wikipedia.org/wiki/Ember.js Ember.js] which is an open-source Javascript framework that follows [https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller MVC] pattern similar to Rails framework.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;6. Ambari-server uses Jetty which is a web-server to handle all the HTTP requests made onto the ambari-server from the UI&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Github Location'''==&lt;br /&gt;
 [https://github.com/apache/ambari Ambari Project]&lt;br /&gt;
&lt;br /&gt;
Forked Repository:&lt;br /&gt;
 [https://github.com/nisarg64/ambari Forked Repo]&lt;br /&gt;
&lt;br /&gt;
Changes committed to forked repositry:&lt;br /&gt;
 [https://github.com/nisarg64/ambari/commit/f7b9131cb7324dda39b95db72673a63ab2ac109b Code changes]&lt;br /&gt;
&lt;br /&gt;
'''Major code changes:'''&lt;br /&gt;
&amp;lt;p&amp;gt;Addition of websocket sever-client files [https://github.com/nisarg64/ambari/commit/f7b9131cb7324dda39b95db72673a63ab2ac109b#diff-0d2947581a9630d9b41c77e5f0fd23b6  WebSocketServer.java] and [https://github.com/nisarg64/ambari/commit/f7b9131cb7324dda39b95db72673a63ab2ac109b#diff-4ac64b666141c53eb339c0375455d311 WebSocketClient.java]&amp;lt;br&amp;gt;&lt;br /&gt;
Changes in heartbeat handler - [https://github.com/nisarg64/ambari/commit/f7b9131cb7324dda39b95db72673a63ab2ac109b#diff-1b3d5840e204ec59cec0cc42c9de12ea HeartBeatHandler.java]&amp;lt;br&amp;gt;&lt;br /&gt;
Version changes in pom files.&amp;lt;/p&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Note: Pull request is yet to be submitted.&amp;lt;/font&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are version issues because of which the build is unsuccessful after applying our changes. The main issue is because of mismatch between jetty versions - version which is supported by ambari and version after which web socket was made available. &amp;lt;br&amp;gt;We are in touch with the other contributors and are working on how to resolve the issue.&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;p&amp;gt;https://ambari.apache.org/&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;https://en.wikipedia.org/wiki/Apache_Ambari&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;https://cwiki.apache.org/confluence/display/AMBARI/Ambari&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;https://issues.apache.org/jira/secure/attachment/12559939/Ambari_Architecture.pdf&amp;lt;/p&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rpsingh3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/ossA1550RAN&amp;diff=98117</id>
		<title>CSC/ECE 517 Fall 2015/ossA1550RAN</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/ossA1550RAN&amp;diff=98117"/>
		<updated>2015-11-04T01:09:32Z</updated>

		<summary type="html">&lt;p&gt;Rpsingh3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''A1550 - Web Socket Implementation in Apache Ambari'''==&lt;br /&gt;
Ambari-Web uses simple ajax polling mechanism to fetch data from Ambari-Server. Constant polling is done to show current service status, alerts, service graphs, etc on Ambari-Web. With this mechanism, the performance of Ambari-Server can be affected on a large size cluster with multiple active browser sessions due to continuous heavy requests being made. &lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/WebSocket WebSocket] is a protocol providing full-duplex communication channels over a single TCP connection. Implementing Web-Socket between Ambari-Web and Ambari-Server will be helpful to address this scenario.&lt;br /&gt;
&lt;br /&gt;
=='''What is Apache Ambari'''==&lt;br /&gt;
Apache Ambari is a software project of the [https://en.wikipedia.org/wiki/Apache_Software_Foundation Apache Software Foundation], is aimed at making [https://en.wikipedia.org/wiki/Apache_Hadoop Hadoop] management simpler by developing software for provisioning, managing, and monitoring Apache Hadoop clusters. Ambari provides an intuitive, easy-to-use [https://en.wikipedia.org/wiki/Apache_Hadoop Hadoop] management web UI backed by its [https://en.wikipedia.org/wiki/Representational_state_transfer RESTful] APIs. Ambari was a sub-project of [https://en.wikipedia.org/wiki/Apache_Hadoop Hadoop] but is now a [https://en.wikipedia.org/wiki/Apache_Software_Foundation#Projects top-level] project in its own right.&lt;br /&gt;
&lt;br /&gt;
An Apache Hadoop cluster consists on a group or nodes/machines. Each node acts as an Ambari Agent that runs various service components (e.g. Datanode for HDFS). One of the agents acts as an Ambari Server that takes care of the task allocation, management, gathering information about the services status and other information from the agents and giving the information to Ambari UI for display. More information about Agent-Server-Web flow is available in the following sections.&lt;br /&gt;
&lt;br /&gt;
=='''Current Implementation'''==&lt;br /&gt;
Ambari is a multi-module Maven project. The relevant modules for our project from an implementation perspective are Ambari Web and Ambari Server. Ambari Agent is another module, important functionally.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Ambari Agent &amp;lt;/b&amp;gt; is a component that resides on every node of the cluster. Its responsibility is to collect the node's overall health which comprises of the health metrics of all the different services running on that node. Ambari Agent sends these statuses to the Ambari Server in the form of periodic messages which is termed as 'heartbeat' in the Ambari nomenclature. In return, Ambari agents receive Heartbeat responses from Ambari Server. Hearbeat responses could contain commands for the agent to perform.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Ambari Web &amp;lt;/b&amp;gt; presents a user interface to monitor and manage a Hadoop cluster. Web module is written in JavaScript using ember.js framework. During our code study, we observed this module following the [https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller MVC] design methodology. The whole motivation of this module is to make it convenient to the end-user to manage the concerned Hadoop cluster.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Ambari Server &amp;lt;/b&amp;gt; is the most central component of an Ambari ecosystem. Ambari Server exposes [https://en.wikipedia.org/wiki/Application_programming_interface APIs]] to its clients such as Ambari Web, which monitors health of a cluster. Ambari Server clients can query for node health statuses. Ambari Server persists the nodes' statuses in a [https://en.wikipedia.org/wiki/PostgreSQL PostgreSQL] database in the backend. Internally, Ambari Server has several components which help it to manage its responsibilities. Ambari Server's important responsibilities are as follows:&lt;br /&gt;
&amp;lt;p&amp;gt; 1. Collect health statuses ( heartbeats ) from Ambari agents. Process their statuses and send heartbeat responses to Ambari agents. &amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt; 2. Handle requests from Ambari Server's clients: One such use case is installing a new service on an Ambari agent. This request could be received from Ambari Web and it is the server's responsibility to send appropriate instructions to the particular agent to get the new service up and running on the agent. &amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Testing Framework'''==&lt;br /&gt;
The codebase is very well supported with unit tests. Following are a few important characteristics of the testing process that we observed during our code study:&lt;br /&gt;
&lt;br /&gt;
1. A popular mocking framework, [https://en.wikipedia.org/wiki/Mockito Mockito] is used to mock responses from dependent downstream services. An in-memory cluster is also mocked using Mockito. Mocking frameworks let us have our test cases fast and independent, which is very well depicted in this project. &lt;br /&gt;
&lt;br /&gt;
2. Every controller method is tested in and out. Tests are quite extensive and cover almost all the code branches, testing each and every feature thoroughly.&lt;br /&gt;
&lt;br /&gt;
3. Only the results/responses obtained from controller methods are asserted. We do not find any significant &amp;quot;verify() / expect()&amp;quot; calls. (&amp;quot;verify/expect&amp;quot; calls are used to assert if a given method was invoked during the test method execution). This is quite a good feature followed as the tests are implemented in a result-oriented way and are not bound to the method implementation in anyway. This also goes to show the stability of the tests as if the method implementation undergoes changes in future, it won't fail our tests.&lt;br /&gt;
&lt;br /&gt;
=='''Project Goals, Benefits and Challenges'''==&lt;br /&gt;
'''Goals:'''&lt;br /&gt;
&amp;lt;p&amp;gt;1. Understand architecture of Ambari-Server and Ambari-web&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;2. Replace the current pull-based mechanism with the push-based mechanism via Web-Socket&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;3. Write test cases for the Web Socket implementation to test the functionalities of WebSocket Client and WebSocket Server&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Benefits:'''&lt;br /&gt;
&amp;lt;p&amp;gt;1. Web Socket will allow Ambari-Server to perform robustly in a large cluster setup with multiple browser sessions and when continuous heavy requests are being made&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Challenges:'''&lt;br /&gt;
&amp;lt;p&amp;gt;1. Ambari server uses [https://en.wikipedia.org/wiki/Jetty_%28web_server%29 Jetty] 8.x version, while support for Web Socket was made available after [https://en.wikipedia.org/wiki/Jetty_%28web_server%29 Jetty] 9.x&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;2. Ambari has a huge codebase with multiple modules and multiple frameworks and design patterns adopted. Understanding the flow of the project and taking care of dependencies is a huge challenge&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;3. For testing the code requires a cluster of around 3 nodes. Running 3 virtual machines requires a high performance machine.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Learning Outcomes'''==&lt;br /&gt;
&amp;lt;p&amp;gt;1. We have observed that Ambari project adopts various design patterns like [https://en.wikipedia.org/wiki/Singleton_pattern Singleton Pattern] in the Data Access Object Classes&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;2. We also noticed in one of the classes called HeartBeatHandler, that it obeys the Law of Demeter&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;3. For testing, project using the [https://en.wikipedia.org/wiki/Mockito Mockito] framework to mock the heartbeat and cluster functionality&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;4. For configuration management, [https://en.wikipedia.org/wiki/Puppet_%28software%29 Puppet] configuration management tool is used&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;5. Ambari-Web is implemented in [https://en.wikipedia.org/wiki/Ember.js Ember.js] which is an open-source Javascript framework that follows [https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller MVC] pattern similar to Rails framework.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;6. Ambari-server uses Jetty which is a web-server to handle all the HTTP requests made onto the ambari-server from the UI&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Github Location'''==&lt;br /&gt;
 [https://github.com/apache/ambari Ambari Project]&lt;br /&gt;
&lt;br /&gt;
Forked Repository:&lt;br /&gt;
 [https://github.com/nisarg64/ambari Forked Repo]&lt;br /&gt;
&lt;br /&gt;
Changes committed to forked repositry:&lt;br /&gt;
 [https://github.com/nisarg64/ambari/commit/f7b9131cb7324dda39b95db72673a63ab2ac109b Code changes]&lt;br /&gt;
&lt;br /&gt;
'''Major code changes:'''&lt;br /&gt;
&amp;lt;p&amp;gt;Addition of websocket sever-client files [https://github.com/nisarg64/ambari/commit/f7b9131cb7324dda39b95db72673a63ab2ac109b#diff-0d2947581a9630d9b41c77e5f0fd23b6  WebSocketServer.java] and [https://github.com/nisarg64/ambari/commit/f7b9131cb7324dda39b95db72673a63ab2ac109b#diff-4ac64b666141c53eb339c0375455d311 WebSocketClient.java]&amp;lt;br&amp;gt;&lt;br /&gt;
Changes in heartbeat handler - [https://github.com/nisarg64/ambari/commit/f7b9131cb7324dda39b95db72673a63ab2ac109b#diff-1b3d5840e204ec59cec0cc42c9de12ea HeartBeatHandler.java]&amp;lt;br&amp;gt;&lt;br /&gt;
Version changes in pom files.&amp;lt;/p&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Note: Pull request is yet to be submitted.&amp;lt;/font&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are version issues because of which the build is unsuccessful after applying our changes. The main issue is because of mismatch between jetty versions - version which is supported by ambari and version after which web socket was made available. &amp;lt;br&amp;gt;We are in touch with the other contributors and are working on how to resolve the issue.&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;p&amp;gt;https://ambari.apache.org/&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;https://en.wikipedia.org/wiki/Apache_Ambari&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;https://cwiki.apache.org/confluence/display/AMBARI/Ambari&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;https://issues.apache.org/jira/secure/attachment/12559939/Ambari_Architecture.pdf&amp;lt;/p&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rpsingh3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/ossA1550RAN&amp;diff=98114</id>
		<title>CSC/ECE 517 Fall 2015/ossA1550RAN</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/ossA1550RAN&amp;diff=98114"/>
		<updated>2015-11-04T00:37:06Z</updated>

		<summary type="html">&lt;p&gt;Rpsingh3: Added links to main topics&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''A1550 - Web Socket Implementation in Apache Ambari'''==&lt;br /&gt;
Ambari-Web uses simple ajax polling mechanism to fetch data from Ambari-Server. Constant polling is done to show current service status, alerts, service graphs, etc on Ambari-Web. With this mechanism, the performance of Ambari-Server can be affected on a large size cluster with multiple active browser sessions due to continuous heavy requests being made. &lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/WebSocket WebSocket] is a protocol providing full-duplex communication channels over a single TCP connection. Implementing Web-Socket between Ambari-Web and Ambari-Server will be helpful to address this scenario.&lt;br /&gt;
&lt;br /&gt;
=='''What is Apache Ambari'''==&lt;br /&gt;
Apache Ambari is a software project of the [https://en.wikipedia.org/wiki/Apache_Software_Foundation Apache Software Foundation], is aimed at making [https://en.wikipedia.org/wiki/Apache_Hadoop Hadoop] management simpler by developing software for provisioning, managing, and monitoring Apache Hadoop clusters. Ambari provides an intuitive, easy-to-use [https://en.wikipedia.org/wiki/Apache_Hadoop Hadoop] management web UI backed by its [https://en.wikipedia.org/wiki/Representational_state_transfer RESTful] APIs. Ambari was a sub-project of [https://en.wikipedia.org/wiki/Apache_Hadoop Hadoop] but is now a [https://en.wikipedia.org/wiki/Apache_Software_Foundation#Projects top-level] project in its own right.&lt;br /&gt;
&lt;br /&gt;
An Apache Hadoop cluster consists on a group or nodes/machines. Each node acts as an Ambari Agent that runs various service components (e.g. Datanode for HDFS). One of the agents acts as an Ambari Server that takes care of the task allocation, management, gathering information about the services status and other information from the agents and giving the information to Ambari UI for display. More information about Agent-Server-Web flow is available in the following sections.&lt;br /&gt;
&lt;br /&gt;
=='''Current Implementation'''==&lt;br /&gt;
Ambari is a multi-module Maven project. The relevant modules for our project from an implementation perspective are Ambari Web and Ambari Server. Ambari Agent is another module, important functionally.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Ambari Agent &amp;lt;/b&amp;gt; is a component that resides on every node of the cluster. Its responsibility is to collect the node's overall health which comprises of the health metrics of all the different services running on that node. Ambari Agent sends these statuses to the Ambari Server in the form of periodic messages which is termed as 'heartbeat' in the Ambari nomenclature. In return, Ambari agents receive Heartbeat responses from Ambari Server. Hearbeat responses could contain commands for the agent to perform.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Ambari Web &amp;lt;/b&amp;gt; presents a user interface to monitor and manage a Hadoop cluster. Web module is written in JavaScript using ember.js framework. During our code study, we observed this module following the [https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller MVC] design methodology. The whole motivation of this module is to make it convenient to the end-user to manage the concerned Hadoop cluster.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Ambari Server &amp;lt;/b&amp;gt; is the most central component of an Ambari ecosystem. Ambari Server exposes [https://en.wikipedia.org/wiki/Application_programming_interface APIs]] to its clients such as Ambari Web, which monitors health of a cluster. Ambari Server clients can query for node health statuses. Ambari Server persists the nodes' statuses in a [https://en.wikipedia.org/wiki/PostgreSQL PostgreSQL] database in the backend. Internally, Ambari Server has several components which help it to manage its responsibilities. Ambari Server's important responsibilities are as follows:&lt;br /&gt;
&amp;lt;p&amp;gt; 1. Collect health statuses ( heartbeats ) from Ambari agents. Process their statuses and send heartbeat responses to Ambari agents. &amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt; 2. Handle requests from Ambari Server's clients: One such use case is installing a new service on an Ambari agent. This request could be received from Ambari Web and it is the server's responsibility to send appropriate instructions to the particular agent to get the new service up and running on the agent. &amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Testing Framework'''==&lt;br /&gt;
The codebase is very well supported with unit tests. Following are a few important characteristics of the testing process that we observed during our code study:&lt;br /&gt;
&lt;br /&gt;
1. A popular mocking framework, [https://en.wikipedia.org/wiki/Mockito Mockito] is used to mock responses from dependent downstream services. An in-memory cluster is also mocked using Mockito. Mocking frameworks let us have our test cases fast and independent, which is very well depicted in this project. &lt;br /&gt;
&lt;br /&gt;
2. Every controller method is tested in and out. Tests are quite extensive and cover almost all the code branches, testing each and every feature thoroughly.&lt;br /&gt;
&lt;br /&gt;
3. Only the results/responses obtained from controller methods are asserted. We do not find any significant &amp;quot;verify() / expect()&amp;quot; calls. (&amp;quot;verify/expect&amp;quot; calls are used to assert if a given method was invoked during the test method execution). This is quite a good feature followed as the tests are implemented in a result-oriented way and are not bound to the method implementation in anyway. This also goes to show the stability of the tests as if the method implementation undergoes changes in future, it won't fail our tests.&lt;br /&gt;
&lt;br /&gt;
=='''Project Goals, Benefits and Challenges'''==&lt;br /&gt;
'''Goals:'''&lt;br /&gt;
&amp;lt;p&amp;gt;1. Understand architecture of Ambari-Server and Ambari-web&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;2. Replace the current pull-based mechanism with the push-based mechanism via Web-Socket&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;3. Write test cases for the Web Socket implementation to test the functionalities of WebSocket Client and WebSocket Server&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Benefits:'''&lt;br /&gt;
&amp;lt;p&amp;gt;1. Web Socket will allow Ambari-Server to perform robustly in a large cluster setup with multiple browser sessions and when continuous heavy requests are being made&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Challenges:'''&lt;br /&gt;
&amp;lt;p&amp;gt;1. Ambari server uses [https://en.wikipedia.org/wiki/Jetty_%28web_server%29 Jetty] 8.x version, while support for Web Socket was made available after [https://en.wikipedia.org/wiki/Jetty_%28web_server%29 Jetty] 9.x&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;2. Ambari has a huge codebase with multiple modules and multiple frameworks and design patterns adopted. Understanding the flow of the project and taking care of dependencies is a huge challenge&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;3. For testing the code requires a cluster of around 3 nodes. Running 3 virtual machines requires a high performance machine.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Learning Outcomes'''==&lt;br /&gt;
&amp;lt;p&amp;gt;1. We have observed that Ambari project adopts various design patterns like [https://en.wikipedia.org/wiki/Singleton_pattern Singleton Pattern] in the Data Access Object Classes&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;2. We also noticed in one of the classes called HeartBeatHandler, that it obeys the Law of Demeter&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;3. For testing, project using the [https://en.wikipedia.org/wiki/Mockito Mockito] framework to mock the heartbeat and cluster functionality&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;4. For configuration management, [https://en.wikipedia.org/wiki/Puppet_%28software%29 Puppet] configuration management tool is used&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;5. Ambari-Web is implemented in [https://en.wikipedia.org/wiki/Ember.js Ember.js] which is an open-source Javascript framework that follows [https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller MVC] pattern similar to Rails framework.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;6. Ambari-server uses Jetty which is a web-server to handle all the HTTP requests made onto the ambari-server from the UI&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Github Location'''==&lt;br /&gt;
 [https://github.com/apache/ambari Ambari Project]&lt;br /&gt;
&lt;br /&gt;
Forked Repository:&lt;br /&gt;
 [https://github.com/nisarg64/ambari Forked Repo]&lt;br /&gt;
&lt;br /&gt;
Changes committed to forked repositry:&lt;br /&gt;
 [https://github.com/nisarg64/ambari/commit/f7b9131cb7324dda39b95db72673a63ab2ac109b Code changes]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Note: No pull request is submitted.&amp;lt;/font&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are version issues because of which the build is unsuccessful after applying our changes. The main issue is because of mismatch between jetty versions - version which is supported by ambari and version after which web socket was made available. &amp;lt;br&amp;gt;We are in touch with the other contributors and are working on how to resolve the issue.&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;p&amp;gt;https://ambari.apache.org/&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;https://en.wikipedia.org/wiki/Apache_Ambari&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;https://cwiki.apache.org/confluence/display/AMBARI/Ambari&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;https://issues.apache.org/jira/secure/attachment/12559939/Ambari_Architecture.pdf&amp;lt;/p&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rpsingh3</name></author>
	</entry>
</feed>