Tomcat 7 Performance comparison before and after optimization
Tomcat 7 is used in our daily development, testing, and production environments, but for most developers there is little understanding of their performance. In this paper, we do a performance test to compare the performance difference before and after optimization.
First, the operating environment
Cpu:intel (R) Pentium (r) [email protected]?;
Memory: 4G, installed is 32-bit Win7, only recognize 3G, did not take the time to ramdisk the whole thing;
Operating system: Win7 32-bit;
Jdk:1.7.0_55
tomcat:7.0.53
Everyone do not laugh, the company computer, to match such, Slow death, tragedy!
All of the tests below are based on 1000 requests and are all accessed by the Tomcat default root homepage
Second, not tuned before
The number of concurrent users is tested from 10-1000, and the test results are as follows:
From the test results above, the throughput and request processing times are stable except when the 200 users are in concurrency (which may be done at this time), but the request waiting time goes up in the back. After observation, the CPU load is below 80%.
?
Third, after the 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 online, there should be a lot of
Set? java_opts=
-server?
-xms1000m?
-xmx1000m??? The #-xms is set to the same value as the-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
- JVM faster recovery rate without compromising system response
- JVM Maximum 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= "25"?
??????????? maxsparethreads= "75"
??????????? Enablelookups= "false"?
??????????? Disableuploadtimeout= "true"?
??????????? connectiontimeout= "20000"
??????????? Acceptcount= "???"
??????????? maxthreads= "300"?
??????????? maxprocessors= "1000"?
??????????? 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.
You may also be interested in the following things: ?
Nginx Chinese Documents nginx installation in Windows and Linux environments ? nginx Configuration file Detailed description ? linux WebLogic 11g R1 installation and configuration ? Weblogic 10.1 Configuring the Jndi data source ? Tuning WebSphere Application Server V7 performance ? Configuring Oracle Data Sources and deployment in websphere7.0 ? the difference between WebLogic, WebSphere, JBOSS, Tomcat ? use war packages to publish projects under Tomcat ? Configuring WebLogic Server 11g Cluster, session replication (Windows) ? WEBLOGIC12 Cluster Configuration ? WebLogic Server 11g (10.3.6) and 12c (12.1.1) installation steps ? full tutorial on configuring WEB+FTP server under Linux (Fedora, Redhat) ? j2sdk1.4.2 Download installation and use tutorial ? |
Resolve startup WebLogic Enter user name password problem & password reset Green version of Tomcat 7.0 installation configuration Guide Tomcat7.0 memory Configuration WebLogic Configuring the JDBC Data source detailed WebLogic Memory allocation Nginx to do WebLogic front load balancer Explanation: Nginx+tomcat Configuring cluster load Balancing How WebSphere uses port 80 to access 9080 applications LINUX FTP Installation and configuration Detailed schematic tutorials for installing Nginx under Linux install nginx+php environment on Ubuntu/debian ? use XAMPP to build a local jsp+php environment ? Nginx-based Linux Web server configuration ? |
phone QR code access: ?
?
Tomcat 7 Performance comparison before and after optimization