How to configure a Tomcat connector for a high-load site (connector)

Source: Internet
Author: User
Tags tomcat

Introduction

Recently to use these content, so I found a more weighty article, reasoning, or try to write a translation. In fact, LZ's English is very rotten (four level did not have LZ tears fall down), so this article translates the level LZ oneself also dare not compliment. You ape friends roughly reference can be, which "" symbol is the LZ callout, () inside is the original. If you do not understand where you are, may be LZ translation problem, you can go ape friends to see the original content, address: http://people.apache.org/~mturk/docs/article/ftwai.html.

Summary

If you want to achieve maximum performance and stability, then running the Tomcat cluster after the Web server is the only way to describe the best practice for accomplishing this.

Before Tomcat

Some people may ask, "Why do you want to put a Web server in front of Tomcat?" "Because of the recent JVM technology and the Tomcat core itself, the performance of a single Tomcat is already very close to the local Web server, and even when static text is sent, Tomcat is only 10% slower than the current Apache2web server." So the answer is: extensibility.

Tomcat can serve concurrent access for many users by assigning separate threads to each client connection. Although this can be done well by Tomcat, there will be problems when the number of concurrent connections rises. The time it takes for the system to manage these threads lowers overall performance, and the JVM will spend more time managing and switching these threads before it can actually do some specific work on the customer's request.

In addition, connectivity (connectivity) also has a number of serious problems when the application runs directly on Tomcat. A typical application might process user data, access the database, or do some calculations and return the results to the client. All of these are time-consuming tasks, but in order for the user to feel that this is a functioning application, most of the time it has to be done in half a second (500ms). If the response time of the application is 10ms, then your application can only serve 50 concurrent users at the same time before your customer complains, "That's a bit awkward, 0.0, but the general meaning is understandable". So what do you do to support more users? The easiest way is to buy a faster hardware, add more CPUs or more boxes (boxes) "Boxes?" Box? 】。 Two two-way boxes are generally cheaper than a four-way, so adding more boxes is generally more economical than buying a server. "It seems that this box can replace the server, in the end what is something, there is a good translation of English."

The first thing to reduce the tomcat load is to use Web server to work with static text, just like the following illustration.

The simplest possible configuration scheme is given in the above diagram. Web server is used to deliver static text, and Tomcat only handles specific work, namely, application services. In most cases, this will satisfy you. If you use a four-way box "another box, 0.0", and the response time is 10ms, then you will be able to serve 200 users at the same time, that is to say, can support 3.5 million of the traffic day "do not know 3.5 million this number how to calculate out, with 200*60*60* 24 is not 3.5 million, 0.0 ", which is already a fairly respectable number.

In the case of this level of load, you may not need to put the Web server before Tomcat. But there is a second reason to do so, and that is to create a control area (demilitarized zone). Placing a Web server on a host is equivalent to inserting a quarantine zone (neutral zone) between the company's private network and the Internet or other external public networks, which allows the application on Tomcat to secure access to other private resources, as well as access to the company's private data.

In addition to having control areas and having access to private networks securely, there are other reasons, such as the need to meet custom authorizations.

If more load is required, then you will have to add more Tomcat application server, which may be because the client's load has been unable to be a simple box "rely on, until now have not guessed what the box is" processing, it may be because when a certain node downtime, You need a mechanism for failure recovery.

Deploying a schema that includes multiple Tomcat application servers requires a load balancer to be added between the Web server and tomcat. In apache1.3, apache2.0, and IIS, you can use Jakarta Tomcat Connector because it provides load balancing and sticky session mechanisms. In future apache2.1/2.2, you can use Advanced mod_proxy_balancer, a newly designed module that is integrated into the core of Apache httpd.

Back to the column page: http://www.bianceng.cnhttp://www.bianceng.cn/Programming/Java/

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.