[Original] Evaluation Tomcat5 Load Balance and Cluster

xiaoxiao2021-03-06  72

Hardware system:

CPU: Athlonxp 2500

Memory: HY 1GB DDR333 SDRAM

Hard disk: Matrox Gold Diamond 40GB (7200RPM, 2MB Cache)

Motherboard: ASRock K7VM4

Software system:

Operating system: Microsoft Windows XP with Service Pack 2

Load balancer: Apache httpd server

2.0.52

MOD_JK 2.0.4 Cluster Node: Tomcat

5.5.4

× 4

Test application: Struts-blank.war /welcome.do

Test client: Apachebench

Test Results:

frequency

Treatment requests per second

Processing request number balance load per second

Cluster

And send 1 request, the total number of requests is 40000

1 263.61 1 72.26 2 263.96 2 84.82 3 263.32 3 85.03 Concurrent 200 requests, the total number of requests is 40000

1 529.55 1 94.89 *** 2 534.42 2 93.11 3 529.76 3 91.22 Concurrent 500 request, the total number of requests is 100000 *

1 522.44 1 86.33 ** / *** 2 511.26 2 86.87 ** / *** 3 521.48 3 86.51 ** / ***

annotation:

*: In the test of the five hundred connections, the load balancer will throw the "Specify the network name unavailable" error, which is here:

[Mon Nov 17 01:43:39 2003] [WARN] (OS 64) The Specified Network Name is no longer available.: Winer_accept: asynchronous access.

There is such a problem, my solution is to prohibit using AcceptEx, and the method adds Win32DisableAccePtex tags in httpd.conf files, for example:

...

Win32DisableAcceptex

...

Although this will reduce the performance of the load balancer, but in sum, it is also tested by strict concurrent five hundred connections.

**: The data is tested on this unit that provides a cluster service.

***: Restart the cluster node and load balancer before testing.

in conclusion

1. Balanced load

This test uses the mod_jk default to balance the load in a rotation mode, in this test example: If there are 10 requests, the four nodes accept the request number, respectively:

Node 1

Node 2

Node 3

Node 4

1

2

3

4

5

6

Seduce

8

9

10

The following clusters are also balanced using this method.

As can be seen from the test results, the load balance is prepared for websites with high and release. It is also 40,000 requests, using concurrent two hundred connections than twice as high as single connection execution efficiency. The heavy test performance of the five hundred requests is not much lower than the number of concurrent connections.

Therefore, balancing loads are still a more practical solution for websites that are not very demanding in traffic and high availability (mainly session services).

2. Cluster

The cluster principle in Tomcat is to find a node in a multicast method and use the TCP connection to copy replication.

Here, this is, the processing of each request, Tomcat will be copied, and the replication session will slowly become huge, such as the group test of the five hundred connected cluster tests, the session size of the copied after test is 70MB The total memory used is more than 1GB, so if the next test is performed, the system must be restarted to initialize the memory to get the correct data, which is that there is "***" symbol inside the test data. the reason. Compared to simple load balancing, due to the constant session replication between the cluster service, its resource usage is very high, which also reduces the processing speed of the connection request, but increasing the system's high availability .

Therefore, for hardware performance, especially memory is demanding, high availability demand for users (no need to repeat data in the session, such as users connected to any node server, do not need to re-enter the password), select the cluster mode Can meet the needs.

转载请注明原文地址:https://www.9cbs.com/read-91104.html

New Post(0)