7
9/4/13 Apache JK Tomcat load balancing configuration www.360doc.com/content/07/0316/10/7147_399335.shtml 1/7 Log in Registration 搜文章 找馆友 From: floating in the Northern Wolf > Apache Color: Font Size: big middle small 2007-03-16 | Viewed: 1637 | Share More >> A RoR site performance optimization of the story (4 ... A RoR site performance optimization of the story (3 ... A RoR site performance optimization of the story (2 ... A RoR site performance optimization of the story (1 ... MySpace, six reconstruction | ityum.net Understand the program manager - CSAI.cn Project Management My Maven trip (1) - Why use ma ... Servlet 2.5 new features - JSP Chinese network Summary of the various perspectives domain model Actual articles: Design your own Annotation ... Java Annotation Advanced Applications Java Annotation Manual - Fuko - ... Landlords Egg cure sore throat, immediate Good habit to cultivate children 91 Beautiful coral Apache JK Tomcat load balancing configuration Online on Apache + JK + Tomcat cluster configuration of many examples, according to an example configuration down, basically to run, but, in some important places but no further explanation. The company is the use of a product Apache + JK + Tomcat cluster, the entire configuration, testing process, encountered many problems, through constant testing, trial and error, but finally was buttoned up, performance is also achieved the expected goals. For example online, I feel it is necessary to re-introduce my detailed configuration process, paying particular attention to some place supplement. Unlike distributed cluster solution, which is used in each server running the same policies applied by the server responsible for balancing shunt, which improve overall system concurrency and throughput is more effective way. The processing of the request have clustered in two different ways: load balancing, state replication ( ie, clusters ) , state replication between the servers need to copy the application state, and load balancing is not, each server is independent. Practice has proved that the application server is not required between the various state replication, the load balancing can be achieved and the higher the performance of concurrent linear growth requirements. For other clusters basics, this is not to do cumbersome. Following on the Apache + JK + Tomcat load balancing configuration summary, focusing on the entire configuration and precautions. Preparation software 1, Tomcat or JBoss (this document is used in JBoss4.0.2); 2, Apache2.0.54Is an open source Web server, download address is: http://www.apache.org/dist/httpd/binaries/ ; 3, mod_jk-1.2.14-Apache-2.0.54.so module , jk is mod_jserv replacement, it is the Tomcat-Apache plug-in for Apache and Tomcat connectors, handle Tomcat and Apache communication between the cluster configuration to act as load balancer role in the current latest version is 1.2.15 , but different JK versions with different Apache versions there are some differences between the mix, and some even come Pei Buqi. JK2 is consistent apache2.x series of new products, but because of its configuration too much trouble, very few people use, so the current has stopped development, so we use the jk connector, download address: http://www.apache.org / dist / Tomcat / Tomcat-Connectors / JK / binaries / . Clustering and load balancing Using mod_jk default to Round Robin load balancing, assuming there are four 服务器集群 框架设计 服务器技巧 Floating in the Northern Wolf Collection: 366 Me: 37 ¥ 118.00 销量:29Popular Articles Home Reading room Museum Friends My Library rpm: 17 Latest Articles

Apache JK Tomcat load balancing configuration.pdf

Embed Size (px)

DESCRIPTION

Tomcat

Citation preview

9/4/13 Apache JK Tomcat load balancing configuration

www.360doc.com/content/07/0316/10/7147_399335.shtml 1/7

Log in Registration搜文章 找馆友

From: floating in the Northern Wolf > ApacheColor:

Font Size: big

middle small

2007-03-16 | Viewed: 1637 | Share

More >>

A RoR site performance

optimization of the story (4 ...A RoR site performance

optimization of the story (3 ...A RoR site performance

optimization of the story (2 ...A RoR site performance

optimization of the story (1 ...MySpace, six reconstruction |

ityum.netUnderstand the program manager -

CSAI.cn Project ManagementMy Maven trip (1) - Why use ma ...

Servlet 2.5 new features - JSP

Chinese networkSummary of the various

perspectives domain modelActual articles: Design your own

Annotation ...Java Annotation Advanced

ApplicationsJava Annotation Manual - Fuko - ...

Landlords

Egg cure sore throat, immediate

Good habit to cultivate children 91

Beautiful coral

Apache JK Tomcat load balancing configuration

Online on Apache + JK + Tomcat cluster configuration of many examples, according

to an example configuration down, basically to run, but, in some important places

but no further explanation. The company is the use of a product Apache + JK +

Tomcat cluster, the entire configuration, testing process, encountered many

problems, through constant testing, trial and error, but finally was buttoned up,

performance is also achieved the expected goals. For example online, I feel it is

necessary to re-introduce my detailed configuration process, paying particular

attention to some place supplement.

Unlike distributed cluster solution, which is used in each server running the

same policies applied by the server responsible for balancing shunt, which improve

overall system concurrency and throughput is more effective way. The processing of

the request have clustered in two different ways: load balancing, state replication

( ie, clusters ) , state replication between the servers need to copy the

application state, and load balancing is not, each server is independent. Practice

has proved that the application server is not required between the various state

replication, the load balancing can be achieved and the higher the performance of

concurrent linear growth requirements.

For other clusters basics, this is not to do cumbersome. Following on the

Apache + JK + Tomcat load balancing configuration summary, focusing on the entire

configuration and precautions.

Preparation software

1, Tomcat or JBoss (this document is used in JBoss4.0.2);

2, Apache2.0.54Is an open source Web server, download address is:

http://www.apache.org/dist/httpd/binaries/ ;

3, mod_jk-1.2.14-Apache-2.0.54.so module , jk is mod_jserv replacement, it is the

Tomcat-Apache plug-in for Apache and Tomcat connectors, handle Tomcat and Apache

communication between the cluster configuration to act as load balancer role in

the current latest version is 1.2.15 , but different JK versions with different

Apache versions there are some differences between the mix, and some even come

Pei Buqi. JK2 is consistent apache2.x series of new products, but because of its

configuration too much trouble, very few people use, so the current has stopped

development, so we use the jk connector, download address: http://www.apache.org

/ dist / Tomcat / Tomcat-Connectors / JK / binaries / .

Clustering and load balancing

Using mod_jk default to Round Robin load balancing, assuming there are four

服务器集群

框架设计 服务器技巧

Floating in the

Northern WolfCollection: 366

Me: 37

¥ 118.00销量:29件

Popular Articles

HomeReading

room

Museum

FriendsMy Library

rpm: 17

Latest

Articles

9/4/13 Apache JK Tomcat load balancing configuration

www.360doc.com/content/07/0316/10/7147_399335.shtml 2/7

More >>

Computer assembly tutorial

(Figure) Xinshoubikan Figure ...Weaving techniques ---- and a

simple and practical ...Woman, you know

Precious photos - Chinese century

historical figures photoPhilosophy of life seen through the

cold, incisive sentence2013 review in Mathematics

Fast heart Vegetarian: 70 more ...

vegetarian templeLife feeling fine blend

Using mod_jk default to Round Robin load balancing, assuming there are four

server nodes, there are 10 requests, the request number four nodes were treated as

follows:Node 1

Node 2

Node 3

Node 4

1

2

3

4

5

6

7

8

9

10

The cluster approach is the use of this method for balance. Tomcat cluster in

principle is the way through the multicast nodes to find and use the TCP

connection session replication.

Unlike cluster load balancing, because the cluster service needs to handle

the session between requests constantly reproduced, copied session will slowly

become huge, so it's resources occupancy rate is very high, if the amount of

concurrent large application, copy the session size can become quite large, and the

total memory is rapidly increasing.

But the cluster session replication, increasing the system's high

availability. Because each server are stored in a user's Session information, if a

server farm units crashes, applications can be automatically switched to other

servers continue to run while the user's information is not lost, which enhances

the fault tolerance of the application.

Specific use of load balancing or clustering, depending application needs.

Install and configure Apache

1 , download Apache installer apache_2.0.54-Win32-x86-no_ssl.exe , the installation

is very simple, all the way round, thus skipped.

2 , the installation is complete, the downloaded mod_jk-1.2.14-Apache-2.0.54.so

copied to the Apache installation directory under modules subdirectory.

3 , and then enter the Apache installation directory under the conf subdirectory,

open the httpd.conf configuration file, insert the following line at the end:

Include conf / mod_jk.conf

4, in the conf subdirectory, create a new configuration file: mod_jk.conf , this file

is Apache loaded connector configuration file, the file name can be modified,

but the httpd.conf in the Include file name, and reads as follows :

# Load mod_jk module. Specify the filename

# Of the mod_jk lib you've downloaded and

# Installed in the previous section

# Load mod_jk module

LoadModule jk_module modules/mod_jk-1.2.14-Apache-2.0.54.so

# Where to find workers.properties

JkWorkersFile conf/workers2.properties

# Where to put jk logs

JkLogFile logs / mod_jk.log

9/4/13 Apache JK Tomcat load balancing configuration

www.360doc.com/content/07/0316/10/7147_399335.shtml 3/7

# Set the jk log level [debug / error / info]

JkLogLevel info

# Select the log format

JkLogStampFormat "[% a% b% d% H:% M:% S% Y]"

# JkOptions indicate to send SSL KEY SIZE,

JkOptions + ForwardKeySize + ForwardURICompat-ForwardDirectories

# JkRequestLogFormat set the request format

JkRequestLogFormat "% w% V% T"

# request distribution configuration, you can configure a number of

JkMount / * loadbalancer

# Turn off the host Lookup , if it is on , it is affecting the performance, you can

have 10 more seconds delay.

HostnameLookups Off

Note: The blue color of the two lines is the key, the first one is the Apache load

JK module used; second sentence configure which URL requests handled by the

load balancer.

5, in the conf subdirectory, create a new configuration file: workers2.properties ,

this file is load balancing configuration file, the file name can not be

modified, which is JK default name, as follows:

worker.list = loadbalancer

# Define the first node ...

worker.server99.port = 8009

worker.server99.host = 192.168.11.99

worker.server99.type = ajp13

worker.server99.lbfactor = 1

worker.server99.local_worker = 1

worker.server99.cachesize = 1000

worker.server99.cache_timeout = 600

worker.server99.socket_keepalive = 1

worker.server99.socket_timeout = 0

worker.server99.reclycle_timeout = 300

worker.server99.retries = 3

# Define the second node ...

worker.server202.port = 8009

worker.server202.host = 192.168.11.202

worker.server202.type = ajp13

worker.server202.lbfactor = 1

worker.server202.local_worker = 1

worker.server202.cachesize = 1000

worker.server202.cache_timeout = 600

worker.server202.socket_keepalive = 1

worker.server202.socket_timeout = 0

worker.server202.reclycle_timeout = 300

worker.server202.retries = 3

# Now we define the load-balancing behaviour

worker.loadbalancer.type = lb

worker.retries = 3

9/4/13 Apache JK Tomcat load balancing configuration

www.360doc.com/content/07/0316/10/7147_399335.shtml 4/7

worker.retries = 3

worker.loadbalancer.balance_workers = server99, server202

worker.loadbalancer.sticky_session = true

worker.loadbalancer.sticky_session_force = true

Note: The above definition of the two worker , one for server99 , the other is

server202 , defines a load balancing server LoadBalancer , which focus on the

blue label configuration items related details can watch the official website

documentation: zh / tomcat.apache.org / Connectors-doc / , other nodes can be

defined directly Copy , modify the node name and IP just fine.

A , worker.list = LoadBalancer

Set work load balancer, the Tomcat node can not join this list.

B , worker.server99.lbfactor

The weight ratio of load balancing, if the weight ratio is larger, the node

is assigned to this request, the more than two nodes such as the weight

ratio of 1:1 , compared to the average distribution.

C , worker.loadbalancer.balance_workers = server99, server202

Specifies the load balancer is responsible Tomcat application nodes.

D , worker.loadbalancer.sticky_session = true

Specify here whether the cluster session replication, if set to true , it

indicates that the session stickiness, do not replicate the session, when a

user requests the first distribution to which Taiwan Tomcat , the subsequent

request would have been dispatched to the Tomcat server dealt with; If set

to false , it indicates that the demand for session replication.

E , worker.loadbalancer.sticky_session_force = true

If the above sticky_session set to true , the suggestion here is also set to true

, this parameter indicates if a station cluster Tomcat server does not

respond after repeated requests, whether the current request, forwarded to

other Tomcat server process; this parameters sticky_session = true , the impact

is relatively large, will lead forwarded to other Tomcat server requests,

can not find the original session , so if there is a request at this time to

read session of certain information, it would cause the application of the

null exception.

6 , Apache server configuration file httpd.conf , by default, there are three

parameters on the performance of relatively large, but depending on the performance

requirements, performance parameters not the same, not to mention up too

complicated, too big but not good performance , recommended the project needs to be

a real test, such as concurrency requirements 800 , it can be set to:

# maximum number of requests a connection

MaxKeepAliveRequests  1000 (value is 0 , no limit number)

# number of threads per process, maximum 1920 . NT starts only son two processes

can not be set to start multiple processes

ThreadsPerChild     1000 (up to 1920 )

# Each child process can handle the maximum number of requests

MaxRequestsPerChild 1000 (value is 0 , no limit number)

These three parameters according to different needs, different servers to adjust.

Install and configure Tomcat or JBoss

1 , for Tomcat or JBoss installation, are not explained here, now we are using the

Apache + JBoss , however, JBoss also used Tomcat , so here's configuration is also

suitable for Tomcat 's;

2 , for the JBoss configuration is very simple, only need to change two places will

9/4/13 Apache JK Tomcat load balancing configuration

www.360doc.com/content/07/0316/10/7147_399335.shtml 5/7

2 , for the JBoss configuration is very simple, only need to change two places will

be able to:

First place: to enter jboss-4.0.2\ Server \ Default \ Deploy \ jbossweb-tomcat55.sar , open

server.xml , about the first 32 lines or so, there, Which included a parameter

becomes:

Second place: Entering jboss-4.0.2\ Server \ default \ deploy \ jbossweb-tomcat55.sar \

META-INF directory, open the JBoss-service.xml , in about 110 lines, withfalse,

To read:

true

There is a need to pay special attention to the place, JBoss in Tomcat , regarding

AJP connection protocol's default configuration, it is not enough for a large

amount of concurrent use, do some modifications, into the jboss-4.0.2\ Server \ Default \

Deploy \ jbossweb-tomcat55.sar , open server.xml , locate the place, here is the

definition of AJP connector where it's configuration does not maxThreads items,

default is 200 , we can make changes:

<= "" Address = "$ {jboss.bind.address}" port = "8009" />

emptySessionPath = "true" enableLookups = "false" redirectPort = "8443"

protocol = "AJP/1.3" maxThreads = "3000" />

maxThreads value depends on how much your concurrency set much is not good.

Run

At this point, the entire configuration is complete, attention to the fact

that, in each JBoss node, restart, or add a new JBoss node, you need to restart

Apache , and for the server farm to a JBoss node shutdown , Apache will

automatically detect, without restarting .

If during operation, a group JBoss node shutdown , log on to the server already

on the user's request will be wrong, this server is responsible for the session

will be lost, but the Apache server will automatically detect this shutdown , the

successor new requests will no longer boot this node.

Responsible for requesting distribution for Apache servers, you need to consume

a lot of CPU resources, so if during testing some Service Temporarily Unavailable or

Server has shut down the connection prematurely such errors, which are generally caused

by the server configuration is not good enough, or is Apache , Tomcat , and

application of some of the configuration is not enough to use, this time we should

consider for better optimization of machine or application configuration.

Frequently Asked Questions

One, Can not Connect to Server : Can not connect to the server. This is the server

configuration problems, the server can not afford too many concurrent

connections, the need to optimize the server's configuration:

Such as the operating system uses a later version, such as Windows 2003 Server

,

Optimization tomcat configuration: maxThreads = "500" minsparethreads = "400"

maxSpareThreads = "450"

But tomcat supports up to 500 concurrent access

Optimize apache configuration:

ThreadsPerChild 1900

MaxRequestsPerChild 10000

Two, Action.c (10): Error -27791: Server has Shut down the Connection prematurely

HTTP Status-Code = 503 (Service Temporarily Unavailable)

are generally caused due to server configuration is not good enough, the need

9/4/13 Apache JK Tomcat load balancing configuration

www.360doc.com/content/07/0316/10/7147_399335.shtml 6/7

Previous: Distributed deployment of Apache and Tomcat, integration experience (complete success)

Next: Apache HTTP Server and Tomcat introduction of the three connections

Flowers ( 0 )Share to:

(This article is floating in the north ... the first possession of the source text URL )

More

apache and tomcat integration solutions to the

picture can not be positive ....Apache and jboss cluster configuration

tomcat cluster

apache tomcat load cluster with three methods

Tomcat cluster, buttoned up!

Easy Apache Tomcat clustering and load

balancingApache + JK + Tomcat load balancing

configurationSummary of project maintenance - simple

Apache + Tomc ...Apache + Tomcat configuration

Exceptionally

strong libido of a

woman whose

appearance

performance

(Figure)

What are the

changes in a

woman vagina?

(Figure)

Male and female

body animation

shows the main

points

Countries most

women love

penis size

(Figure)

Sex vaginal

orgasm

[knowledge]

are generally caused due to server configuration is not good enough, the need

to optimize hardware and adjustment program.

Three, unable to process the request:

When we entered ***. do command, Apache returns an error message, but rather to

connect tomcat was no problem. There is no reason to . do command forwarded to tomcat

process. Solution as follows:

In the apache config file the following:

JkMount / *. Jsp loadbalancer

JkMount / *. Do loadbalancer

服务器集群

服务器技巧

框架设计

linux服务器 web服务器

服务器技术 架构设计

数据库集群

操作系统有哪些

pc服务器集群

框架结构设计

linux 服务器版web应用服务器

服务器管理

架构设计师

Similar articles

在这里想学习不好都难【有料有视频】

你的老师要是他们,清华北大不是问题!

免费听高中课程任意学【高中生必看】

史上最全的高中免费课程【必看】

真是绝了,再也不用找家教了

劲爆:美女老师教英语的秘密

中国人必看:这样的名师不看看可惜了

这些中学教学视频太牛了,受益终生啊!

孩子一看学习就上瘾,不信试试看!

中国人必看:这样的名师不看看可惜了

热门推荐

You might like

Baidu Recommended

·雅思考试内容官网 数十万学子

的口碑推荐4..

·西藏旅游 西藏旅游假期大优

惠!!!

·防伪商标顶尖品牌宝信科技防伪

商标021-54..·张家界五日游价格2013最新报价

·西藏旅游哪家靠谱?首选拉萨市

旅游有限公..

·电动车蓄电池修复千元投资,市

场火热!风险..·离岸账户价格实惠 诚信高效!!!·西藏旅游哪家靠谱?首选拉萨市 ·太阳网上娱乐,24小时客服

销量:5460

Close

Close

9/4/13 Apache JK Tomcat load balancing configuration

www.360doc.com/content/07/0316/10/7147_399335.shtml 7/7

Sign in using

partner sites:

Sina

microbloggingQQ Everyone

Comments:

Hello, please log in or register to comment again