Tomcat7.0.22 installation Configuration
1. Download tomcat7.0.22:http://tomcat.apache.org/download-70.cgi
2, add system environment variables, my computer, properties---Advanced system settings, environment variables (Operation IBID.)
(1) Variable name: Catalina_base variable Value: D:\Program files\apache-tomcat-7.0.22 (the directory that Tomcat extracted to)
(2) Variable name: Catalina_home variable value: D:\Program files\apache-tomcat-7.0.22
(3) Variable name: Catalina_tmpdir variable value: D:\Program files\apache-tomcat-7.0.22\temp
(4) Variable name: Path variable value: D:\Program files\apache-tomcat-7.0.22\bin
3, run Tomcat7.0.22, "Start", "Run", input cmd, enter startup.bat at the command prompt, then pop up the tomcat Command box, output the startup log; open Browser input http://localhost : 8080/, if you enter the Tomcat welcome interface, then congratulations, the configuration is successful.
after the Tomcat installation is complete, the directory has
Bin------to hold Tomcat scripts for startup and shutdown
Conf-----contain different configuration files
Work----Store the class file generated by the JSP after compilation
WebApp the directory where the application is stored
Log file-----
LIB------the jar files needed to store Tomcat
Doc-----Store various tomcat documents
Run the Tomcat server with the Bin/startup.bat command (you can also start with a small circle icon)
tomcat7.0 The configuration of the virtual directory:
1. First enter the Tomcat 7.0conf directory
2. Then click on the Tomcat 7.0confCatalinalocalhost directory
3. Finally create a virtual directory with the name of the XML file as follows: First name. xml
The code is as follows:
<context path= "/name" docbase= "D:tomcat 7.0 folder name" debug= "5" reloadable= "true" crosscontext= "true"/>
The virtual directory is created. In the future, you can do this in this virtual directory.
(The above and previous versions of the virtual directory configuration is different, please treat differently)
If the software is used, the default is to publish the project to Tomcat's WebApp folder, which is inconvenient and affects each other (such as MyEclipse).
Write a simple HelloWorld and feel the JSP:
12345678 |
<title>简单的程序</title>
<body> <%= "chenhailong,hello world" %> </body>
|
After optimization
Optimization is mainly done for Tomcat, there are two main aspects:
1, add the following parameters to the Bin/catalina.bat file, optimize the JVM, as for the role of the large camel parameters and instructions, we look for online, there should be a lot of, such as: http://www.mzone.cc/article/321.html
Set java_opts=-server-xms1000m-xmx1000m #-xms is set to the same value as-XMX, preventing the JVM from causing performance fluctuations due to frequent GC-xss512k-xx:+aggressiveopts-xx:+ usebiasedlocking-xx:permsize=64m-xx:maxpermsize=300m-xx:+disableexplicitgc-xx:maxtenuringthreshold=31-xx:+ USECONCMARKSWEEPGC-XX:+USEPARNEWGC-XX:+CMSPARALLELREMARKENABLED-XX:+USECMSCOMPACTATFULLCOLLECTION-XX: Largepagesizeinbytes=128m-xx:+usefastaccessormethods-xx:+usecmsinitiatingoccupancyonly-djava.awt.headless=true
The above configuration, basically can achieve:
Faster system response Time
The JVM recovers faster and does not affect the system's response rate
Maximized JVM Memory Utilization
Minimized thread blocking situation
2, tomcat connection parameter optimization, mainly for the throughput optimization:
Modify the Conf/server.xml file to bring the original
<connector port= "8080" protocol= "http/1.1"/>
Change to the following content
<connector port= "8080" protocol= "http/1.1" uriencoding= "UTF-8" minsparethreads= " " maxsparethreads= "" enablelookups= "false" disableuploadtimeout= "true" connectiontimeout= "20000" acceptcount= " " maxthreads= " " maxprocessors= " " minprocessors= "5" useurivalidationhack= "false" compression= "on" compressionminsize= "2048" compressablemimetype= "Text/html,text/xml,text/javascript,text/css,text/plain" redirectport= "8443"/>
Then let's take a look at the performance of the 10-1000 concurrent users who initiated 1000 requests.
As you can see, after optimization, the throughput rate has reached an average of about 1800-1900, while the processing time is basically stable at 0.6ms, while the waiting time is up to 600ms.
Iv. Summary
Through the comparison of two results can be seen, throughput and server processing time has a great change, of course, in my broken machine also on such an effect, and then optimize the estimation will not "fly" up, interested friends can find the machine of the B point of the cow to try. Try to tell me the result, let me also happy.
Tomcat, those things.