Wednesday, February 20, 2013

Web Services

Web services are client and server applications that communicate over the World Wide Web’s (WWW) HyperText Transfer Protocol (HTTP)

Web services can be combined in a loosely coupled way to achieve complex operations. Programs providing simple services can interact with each other to deliver sophisticated added-value services.

Types of Web Services
"Big" Web Services
"RESTful" Web services

Tuesday, February 19, 2013

Couple of design patterns or architectural pattern most people know already


“Design patterns are recurring solutions to design problems.”

Patterns: According to commonly known practices, there are 23 design patterns in Java. These patterns are grouped under three heads:
1. Creational Patterns
2. Structural Patterns
3. Behavioral Patterns



Intercepting Filter : Facilitates preprocessing and post-processing of a request.

View Helper : Encapsulates logic that is not related to presentation formatting into Helper components. 

Business Delegate :Reduces coupling between presentation-tier clients and business services. It hides the underlying implementation details of the business service, such as lookup and access details of the EJB architecture.

Data Access Object : Abstracts and encapsulate all access to the data source. The DAO manages the connection with the data source to obtain and store data.

Factory Pattern : The factory method pattern is an object-oriented creational design pattern to implement the concept of factories and deals with the problem of creating objects (products) without specifying the exact class of object that will be created. Inheritance also a factory pattern.

The factory pattern can be used when:
  • The creation of an object precludes its reuse without significant duplication of code.
  • The creation of an object requires access to information or resources that should not be contained within the composing class.
  • The lifetime management of the generated objects must be centralized to ensure a consistent behavior within the application.


Model–view–controller (MVC) is a software architecture pattern that separates the representation of information from the user's interaction with it.[1][2] The model consists of application data, business rules, logic, and functions. A view can be any output representation of data, such as a chart or a diagram. Multiple views of the same data are possible, such as a pie chart for management and a tabular view for accountants. The controller mediates input, converting it to commands for the model or view.[3] The central ideas behind MVC are code reusability and separation of concerns.[4]

Reference : http://www.allappforum.com/j2ee_design_patterns/j2ee_design_patterns.htm

Thursday, February 7, 2013

About Ganglia and steps to install in CentOS


Ganglia is a scalable distributed system monitor tool for high-performance computing systems such as clusters and grids. It allows the user to remotely view live or historical statistics (such as CPU load averages or network utilization) for all machines that are being monitored.[1]

It has 2 operations

Ganglia Meta Daemon (gmetad)
The meta node: one machine that receives all measurements and presents it to a client through a website.

Ganglia Monitoring Daemon (gmond)
The monitoring nodes: machines that run only the monitoring daemon and send the measurements to the meta node

Installation below will be in metanode and monitoring daemon: 

CentOS 6 and above :
1. Download : Add the EPEL (Extra Package Enterprise Linux) repository to your system. By downloading epel-release-6-8.noarch.rpm

2. Install rpm  

$ rpm -ivh epel-release-6-8.noarch.rpm
Note : Once its installed under /etc/yum.repos.d/ you can see epel repo. This repo contains ganglia packages to install.

MetaNode Machine (Ganglia Server)
Before you proceed, Make sure you downloaded and installed RPM following above mentioned steps.
$ yum install ganglia ganglia-gmetad ganglia-web ganglia-gmond
Note : ganglia-web is for web. Ganglia runs in Apache Webserver. It has php front-end. The message transfer in UDP (unified data protocol) XML.

Update Ganglia Client / Server configuration
$ vi /etc/ganglia/gmond.conf
cluster {
name = "my servers"
owner = "unspecified"
latlong = "unspecified"
url = "unspecified"
}

udp_send_channel {
host = collector.mycompany.com
port = 8649
}

udp_recv_channel {
port = 8649
}

tcp_accept_channel {
port = 8649
}

Note : This allows collector.mycompany.com to receive monitoring data from every node on port 8649(UDP). The cluster name and gmetad.conf datasource name should be same. Remove mcast_join and put host in gmond.conf

Update Apache Configuration - ServerName
Uncomment serverName in apache configuration and update.
$ vi /etc/httpd/conf/httpd.conf
ServerName example.com:80
Update Ganglia Server Configuration
Change ganglia Configuration in location tag from 'All' to 'Allow'
$ vi /etc/httpd/conf.d/ganglia.conf
Command to Start Ganglia & Gmond & apache Service in Ganglia Server
$ /etc/init.d/gmond start
$ /etc/init.d/gmetad start
$ /etc/init.d/httpd start

Steps to Install Ganglia Client Services in Clusters (Ganglia Client Nodes)
Before you proceed, Make sure you downloaded and installed RPM following above mentioned steps.
$ yum install ganglia ganglia-gmond
Update Ganglia Client (Gmond) Configuration
$ vi /etc/ganglia/gmond.conf 
cluster {
name = "PRODUCTION"
owner = "unspecified"
latlong = "unspecified"
url = "unspecified"
}

udp_send_channel {
host = collector.mycompany.com
port = 8649
}

/*udp_recv_channel {
}
tcp_accept_channel {
}*/
Note : This tells gmond to send the info to ganglia server (master) host ip(collector.mycompany.com) on port 8649(UDP). Cluster Name assigned value can be hostname or dataSourceName of ganglia server (Master). Remove udp_recv_channel and tcp_accept_channel from gmond configuration. Also, Remove mcast_join and put host in gmond.conf
Restart gmond service in ganglia client
$ service gmond restart
Access Ganglia Server through your browser using URL as configured: collector.mycompany.com/ganglia
// Below script tag for SyntaxHighLighter