Apache+tomcat load balance Setup method detailed

Source: Internet
Author: User
Tags split tomcat

First, Introduction:

Each tomcat worker is a tomcat instance that serves the Web server and waits for the servlet to execute. For example, we often use Web servers like Apache to forward Sevlet requests to a Tomcat process that is located behind it (that is, the worker mentioned earlier). This article describes in detail how to configure various types of worker and loadbalance, and explains the characteristics of various types of worker and the rationale for LoadBalance configuration.

Second, why use Tomcat workers:

Described above is a very simple structure that can in fact configure multiple Tomcat workers to handle the servlet requests forwarded by the Web server. The reasons for this configuration are the following hypothetical environments:

* We publish different Tomcat workers for their different applications in the development environment. Of course the developers in the development environment share the same Web server, but each Tomcat Worke serves the developer who owns it.

* We define our own virtual hosts on different Tomcat processes so that different companies can use their own web site so that their web site is split up reasonably.

* We provide a load-balanced web site, which means that multiple Tomcat workers are used simultaneously, and each tomcat worker has a separate host and assigns requests forwarded over the Web server between workers.

Of course, these scenarios may not cover all the situations where multiple workers are used.

Three, workers.properties configuration description:

The way to define tomcat workers is to write a property file named "Workers.properties" under the Apache Conf directory. This article will explain in detail how to configure:

1. Define Workers list:

The way to define workers is to write a workers.properties file in Apache's conf directory, making it work as an Apache plug-in.

To define the format of the workers list:

Worker.list =< Use the "," split list of worker names >

For example:

Worker.list= Worker1, Worker2

When Apache starts, workers.properties initializes the workers that appears in the Worker.list list as a plug-in.

2. Define the type of workers:

Each named worker should have some additional information about itself. This information includes the type of worker and other relevant information. The workers types defined in JK1.2.5 are discussed here.

Define the format of the worker type:

Worker. Worker name. Type =

The naming of worker names is best followed by Java naming conventions.

The worker type is evaluated in the following table:

Defines a worker named "local" who communicates with the Tomcat process using the AJPV12 protocol:

Worker.local.type=ajp12

Defines a worker named "remote" that communicates with the Tomcat process using the AJPV13 protocol:

Worker.remote.type=ajp13

Defines a worker named "Fast" who communicates with the Tomcat process in a jni manner:

Worker.fast.type=jni

Defines a worker named "LoadBalancer", which is used as load balancing for multiple Tomcat processes:

Worker.loadbalancer.type=lb

Each type has a different behavior, which we will explain in more detail below.

3. Set worker properties:

After you define worker, you also need to provide the properties of each worker, which are defined in the following way:

Worker. < property >=< Property value >

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.