APACHE2+TOMCAT6 Integration and actual combat notes

Source: Internet
Author: User

APACHE2+TOMCAT6 Integration and actual combat notes, Tomcat optimization communication

Also send this kind of environment configuration essay, nor I am interested in these configurations, but in the current deployment of problems and needs, is resolved, is helpless.
This is the difference between amateur and professional. I guess I'm a little more professional. I have written the latest edition of apache_2.2.11 and apache-tomcat-6.0.18 integration program is
With Tomcat as the main, the Apache integration in, but the effect is not what I want, in the formal need to use when found that such a solution does not reach the requirements. There have been several multiport and
Multi-virtual host of the essay TOMCAT6 configuration multiple virtual host, multiple domain name binding an IP, Tomcat6.0 configuration multiport access. These are the school resource constraints that require a server deployment
Multiple projects.

In order to improve the access performance of the site, we often choose the appropriate deployment environment on the server side. The simplest is a tomcat, but in the case of high concurrency, very
Easy to be a machine. Because the tomcat configuration is not optimized. I did not pay attention to these details at the earliest, because I know that the performance of a project is not reflected by building the environment, but the efficiency of the algorithm, the code real
Now the rationality, as well as the reasonable use of the database, optimize the use of technology and so on. However, by optimizing the deployment environment, it should be the most straightforward scenario. Now I know of a tomcat optimization
The scenario is to use the Tomcat thread pool. Only need to change in the Server.xml configuration on it. Core Configuration code:

<executor name= "Tomcatthreadpool" nameprefix= "catalina-exec-" maxthreads= "1000" 
        minsparethreads= "50" Maxidletime= "600000"/>
    
    
    <!--A "Connector" represents A endpoint by which requests are and
         received Es are returned. Documentation at:
         java HTTP Connector:/docs/config/http.html (Blocking & non-blocking)
         java AJP  Connector:/docs/config/ajp.html
         APR (HTTP/AJP) Connector:/docs/apr.html Define
         a Non-ssl http/1.1 On port 8080
    -->
    <!--
    <connector port= "8086" protocol= "http/1.1" connectiontimeout= " 
               20000 " 
               redirectport=" 8443 "uriencoding=" UTF-8 "/>
    -->
    <!--A" Connector "using the shared Thread pool-->

    <connector executor= "Tomcatthreadpool" 
               port= "8080" protocol= "http/1.1" connectiontimeout= "20000" 
               redirectport= "8443"/>

This performance response can be much higher than the default configuration. Other options I have not studied, I hope that the experience of friends can give some advice. Thank you.
Then there is the integration of Apache+tomcat, the first one I wrote around Tomcat configuration. This is a more convenient and more scientific realization,
Do integration around Apache.

The tools to download or the three, the first step to achieve is the same as my last article.

1. Copy mod_jk-1.2.28-httpd-2.2.3.so to C:\Apache2.2\modules (my Apache installation directory), I changed the name to make it easier to follow

renamed to Mod_jk.so.

2. Under the Tomcat Config directory, create a new Workers.properties file with the following contents:

Workers.tomcat_home=c:\tomcat 
workers.java_home=c:\program files\java\jre1.5.0_05

worker.list=ajp13
worker.ajp13.port=8009
worker.ajp13.host=localhost
worker.ajp13.type=ajp13 


3. Add the configuration at the bottom of the Apache httpd.conf content:

loadmodule jk_module modules/mod_jk.so jkworkersfile "C:/tomcat/conf/workers.properties" Jklogfile "C:/tomcat/logs/mod_jk2.log" jkloglevel info <virtualhost localhost> ServerAdmin @hbu. CN documentroot D
:/ ServerName localhost directoryindex index.html index.htm index.jsp ErrorLog logs/shsc-error_log.txt customlog logs/  Shsc-access_log.txt Common jkmount/servlet/* ajp13 jkmount/*.jsp ajp13 jkmount/*.do ajp13 </virtualhost> 

The


configuration is complete, and the test Apache will have the jsp,servlet,.do request handled by Tomcat. Other files are handled by Apache, because Apache stability and
security, as well as fast static page processing speed relative to Tomcat, can also increase the load capacity of the Web site, provided there are more static pages, such as static. The last request sent by

to Tomcat can be added continuously. For example, I do the station has FCKEDITOR,DWR, I need to add the two filter. The
format is consistent, for example: jkmount/dwr/* ajp13.

This can be solved by the failure of the functionality caused by the Apache and Tomcat integrations. This is a more perfect integration solution.
Some static requests are handled by Apache, and dynamic requests are handled by Tomcat.

The home page has a Web site's development process, that is, why the database and the site are deployed on two separate servers. Did some textual research, I think writes very good, considered the
reads and writes and transmits the data the speed, although the data basically is the theory level.
I have also seen the history of the evolution of Web architecture in this area at the earliest. I do not like dawdling, so directly with the most concise words outlined. The following list of numbers, from early to late to talk about the development of the site process.

1. A server, a database, and a Web site are all on this shelf. I think it's expensive to do the following before adding a server. The
first is to optimize the code, refactor, and refine the algorithm. Then optimize the SQL query and so on database operations, reasonable use of transactions. Establish a database index,
optimize the service environment, turn off unnecessary services, and optimize the delivery environment. followed by static, caching (page fragment caching, database caching, object-level caching),
data persistence.
2. The site is separated from the database and requires two servers.
3. Load balancing of the carrying environment. Disperse requests and improve fault tolerance.
4. Database cluster
5. Web site distributed, take read and write separation, the site is a large proportion of the request is in the search data.
6. Improve the hardware configuration of the server.
7. Still not enough, then add the server ...

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.