Java heap space is divided into the new generation, the old generation, the persistence of their own garbage collection algorithm
Eden Zone: The newborn object is stored in this often recycled
From, to survival zone
In the old age, the frequency of recycling is not very high
Jdk8, there's no persistence. Duplicate name as meta data
Default JDK has too little memory space to optimize
Common optimization configurations for tomcat:
(1) Memory space:
/etc/sysconfig/tomcat
Java_opts= "-SERVER-XMS32G-XMX32G"
Access: Tomcat Home---Server status
2) thread pool settings:
<connector port= "8080" protocol= "http/1.1" connectiontimeout= "20000" redirectport= "8443"/>
Common Properties:
MaxThreads: Maximum number of threads;
Minsparethreads: Minimum number of idle threads;
Maxsparethreads: Maximum number of idle threads;
Acceptcount: The maximum length of the wait queue;
Uriencoding:uri address encoding format, it is recommended to use UTF-8;
Enablelookups: Whether to enable DNS resolution, it is recommended to disable;
Compression: Whether to enable the transport compression mechanism, the proposed "on";
Compressionminsize: The minimum value of the data stream to enable compression transmission, in bytes;
Compressablemimetype: Defines the MIME type that enables the compression feature;
Text/html, Text/xml, Text/css, Text/javascript
(3) Disable 8005 ports;
<server port= "-1" shutdown= "Shutdown" >
4) Hide version information:
<connector port= "8080" protocol= "http/1.1" connectiontimeout= "20000" redirectport= "8443"/>
server= "SOME STRING"
Tomcat Session Server (memcached)
Https://github.com/magro/memcached-session-manager
Supported Session server types:
Some of the tools provided by Java itself
Analysis tools commonly used by the JVM:
JPS: Used to view all JVM processes running;
Jinfo: View the running environment parameters of the process, mainly the JVM command line parameters;
Jstat: Real-time monitoring of the resource and performance of JVM applications;
Jstack: View the running status of all threads;
Jmap: View
JPS [-Q] [-MLVV] [
-Q: Silent mode;
-V: Displays command-line arguments passed to the JVM;
-M: Outputs the parameters of the incoming main method;
-L: Outputs the fully qualified name of the main class or jar;
-V: Displays the parameters passed to the JVM through the flag file;
[
Jinfo: Outputs all configuration information for a given Java process;
jinfo [option] <pid>
-flags:to Print VM Flags
-sysprops:to Print Java System Properties
-flag <name>:to Print the value of the named VM flag
Jstack: View information about the line stacks of the specified Java process;
Jstack [-l] <pid>
Jstack-f [-M] [-l] <pid>
-l:long listings, additional lock information is displayed, so a deadlock occurs often with this option;
-M: Mixed mode, both output Java stack information, also output C + + stack information;
-F: When using "Jstack-l PID" no response, you can use-f force output information;
Jstat: Output
Statistics for the specified Java process
Jstat-help|-options
Jstat-<option> [-t] [-h<lines>] <vmid> [<interval> [<count>]
Jstat-options
-class:class Loader
-compiler:jit
-gc:gc
-gccapacity: The capacity of generations in the statistical heap
-gccause:
-gcmetacapacity
-gcnew: Cenozoic
-gcnewcapacity
-gcold: The old age
-gcoldcapacity
-gcutil
-printcompilation
[<interval> [<count>]]
Interval: time interval, unit is milliseconds;
Count: The number of times displayed;
Such as
JSTAT-GC 2169 View JAV memory status
-GC:
YGC: The number of garbage collection in the Cenozoic;
YGCT: The amount of time spent in the new generation of garbage collection;
The number of GC Fgc:full;
Fgct:full The amount of time the GC consumes;
GCT:GC the total amount of time consumed;
JVISUALVM and jconsole two X image interface
#jconsole-H
Tomcat Optimizer, Java view