Java EE cluster technology

Source: Internet
Author: User

Java EE cluster technology

Part 1 (Interpretation of some terms)


 
More and more mission-critical and large-scale applications are running on Java EE technology. Some applications, such as banking or fee-based systems, require higher and higher availability (HA), while others, such as Google or Yahoo, require better scalability. Ebay crashed in 22 hours in 2.3 million, resulting in 9.2% transaction interruptions, affecting its share price down. This example proves that high availability and scalability are becoming more and more important today.
 
Java EE cluster technology is designed to provide highly available and fault-tolerant scalable services. However, Java EE lacks this specification, so Java EE vendors use different technologies to implement clusters. This poses some problems to developers and architects, for example:
 
Why is the Java EE server with cluster function options so expensive? (May be 10 times more expensive than none)
My program is written in accordance with standard Java EE specifications. Why cannot I run it in a cluster environment?
Why is my program running slower in the cluster environment?
Why is it so complicated to transplant programs in a cluster environment?
 
Therefore, we can understand and solve the above problems by exploring the implementation of the Java EE cluster environment.
 
 
Some Basic Concepts
Before we really start to explore implementation technologies, we should first understand some basic concepts. Understanding these concepts is not only the basis for understanding the Java EE cluster technology, but also outlines the key points for the implementation of different technologies for building clusters, making it easier to understand the implementation.
 
Scalability)
In some large-scale systems, it is not good to estimate the exact number of online users and their behaviors. Scalability refers to the situation where the system can support a surge in user numbers. The immediate way to improve Scalability (online concurrent sessions) is to increase resources (memory, CPU...) on the server ......). Cluster technology is another way to solve this problem. The cluster supports running a group of servers logically as separate servers, but shares the system load together.
 
High Availability)
The use of a single server solution (increased memory, CPU, etc.) to solve the scalability problem is not perfect, because the system failure is concentrated on one point (Single Server. Mission-critical applications (banking or billing systems) cannot tolerate even one minute of downtime. Therefore, these services must be accessible at any time. Cluster technology is a solution that meets these high availability requirements. It provides additional servers in the cluster to ensure service continuity when one of the servers goes down.
 
Load Balance)
Server Load balancer is an important part of cluster technology. By distributing requests to different servers, it provides a way to simultaneously obtain high availability and higher performance services. A Simple Server Load balancer can be a servlet or some plug-ins. A complex Server Load balancer may be a hardware device embedded with an SSL accelerator. In addition to distributing requests, the Server Load balancer is also responsible for executing some important tasks:
Session persistence is used to ensure the integrity of the user's session lifecycle on a server.
"Heartbeat" to check failed servers.
In some cases, the Server Load balancer needs to participate in the "failover" process, which will be mentioned below.
 
Fault Tolerance)
Data in a high-availability environment is not necessarily correct. In a Java EE cluster, when a server instance goes down (hereinafter referred to as "failed"), the service is still available through other servers in the cluster. However, the requests being processed on the server that failed may not be able to obtain the correct data. Therefore, Fault Tolerance Technology can always ensure that the correct behavior can be performed in a specific error environment.
 
Failed transfer (Failover)
Failover is another important technology in the cluster for fault tolerance. You can select another node in the cluster to continue the service on the failed node. Failover can be automatically switched through the code or through the communication link of the underlying platform.
 
Idempotent method (idempotent methods)
Idempotent functions, or idempotent methods, are functions that can be executed repeatedly with the same parameters and get the same results. These functions do not affect the system status, and do not worry that repeated execution will cause changes to the system. For example, the "GetUserName ()" function is a idempotent function, and the "deletefile ()" function is not. Idempotence is an important concept in HTTP session and EJB failover.

 

Part 2 What is a Java EE Cluster

 

Java EE ClusterIn general, Java EE cluster technology includes "Load Balancing" and "failover. In, "Server Load balancer" means that many client objects simultaneously request target objects ). The server Load balancer is located between the caller and the called party. requests can be distributed to target objects with the same functions but different locations. High performance and high availability can be achieved through this method. For example, the "failover" method is different from that of Server Load balancer. Generally, the client object can successfully request the target object. If the target object fails during the request process, the "Transfer failed" system will monitor the failure and redirect subsequent requests to another available object. Fault tolerance can be achieved through this method. So what types of objects can be cluster? In Java code, how does one reflect the load balancing and Failover points? In fact, not all objects can be clustered, and load balancing and Failover cannot happen on any line of Java code. View the above Code. Can the code of the business () method in Class A be transferred by Server Load balancer or failure? The answer is no. For load balancing and failover, a listener between the caller and the called party is required to distribute or redirect method calls to different objects. Class A and Class B objects run in the same JVM and are closely related. It is difficult to add distribution logic between method calls. So what types of objects can be cluster-ready? The answer is only those component objects that can be deployed in the distributed topology environment. So when will load balancing and Failover occur? The answer is only when the distributed object method is called. As shown in, in a distributed environment, the caller and the called party are clearly separated in different runtime containers. Different JVMs, processes, or computers can be used to separate them. When the client calls the target object, it executes the method (so it is called "distributed") in the container of the target object "). The client communicates with the target object through the standard network protocol. Through these features, some mechanisms can be used to intervene in the method call path to achieve load balancing and failover. In, the browser may call remote JSP objects through the HTTP protocol. JSP is executed on the Web server. The browser does not care about the execution process. It only waits for the result. In this case, you can add components that can achieve load balancing and failover between the browser and the web server. In Java EE, distributed technologies include JSP (servlet), JDBC, EJB, JNDI, and Web services. Server Load balancer and Failover occur when these distributed methods are called. Next, we will discuss these technical details in depth.


 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.