Tomcat's JVM tuning combat

Source: Internet
Author: User

Some of the advantages of the notes have been written in the previous log, do not explain

Tuning test throughput directly using JMeter
Code

package cn; import java.io.ioexception;import java.util.map;import  java.util.weakhashmap; import javax.servlet.servletexception;import  javax.servlet.annotation.webservlet;import javax.servlet.http.httpservlet;import  Javax.servlet.http.httpservletrequest;import javax.servlet.http.httpservletresponse; import com . user;  @WebServlet ("/testlogin") public class testlogin extends httpservlet {         private static final long serialversionuid  = 1l;    private map<user,byte[]> userdata = new  WeakHashMap<User,byte[]> (     protected void doget); Httpservletrequest request, httpservletresponse response)  throws servletexception,  IOException {            User user = new user ();             user.setid (1);             user.setname (" Renlu ");             user.setpwd (" 123 ");             userdata.put (user,new byte[1024]);             system.out.println ("HELLO&NBSP;BF   ");             request.getrequestdispatcher ( "Success.jsp"). Forward (Request, response);    }         protected void dopost (httpservletrequest request, httpservletresponse  Response)  throws ServletException, IOException {         this.doget (Request, respOnse);    }}   Entity
 package com; public class User {    private int  id;    private string name;    private string pwd;         public int getid ()  {         return id;    }    public void  SetId (Int id)  {        this.id = id;     }    public string getname ()  {         return name;    }    public void  SetName (String name)  {        this.name = name;     }    public string getpwd ()  {         Return pwd;    }    public void setpwd (STRING&NBSP;PWD)  {        this.pwd = pwd;    }  }    test Environment Apache-tomcat-7.0.67,java version "1.8.0_60", apache-jmeter-2.13, test 3 times per throughput, take intermediate value
Number of test threads 10, thread Group 200

Default pre-tuning throughput

Throughput: 317


Tuning One:




Throughput 508

Tuning Two:

The Cenozoic parallel recycler, which is a collector of concern throughput, can minimize GC time in the old age also using the parallel recycle collector.




Throughput 681

Tuning Test Three:

Using-XX:+USECONCMARKSWEEPGC



Summarize:
The JVM tuning process is to determine the heap memory size (-XMX-XMS), reasonably allocate the Cenozoic and older generations (-xx:newratio,-xmn,-xx:survivorratio) to determine the size of the permanent zone (-xx:permsize,-xx: MaxPermSize), select the garbage collector, and make reasonable settings for the garbage collector. Of course, disable display GC, disable class metadata collection, disable class validation, and so on. Can be adjusted according to their actual situation.

Tomcat's JVM tuning combat

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.