Architect of the depth MySql JAVA, Nginx, Tomcat, JVM tuning

I. Background
use of HTTP interface JMeter stress test, response is slow.

Second, the positioning of ideas
1, positioning and time-consuming SQL
View Druid Monitor

2, positioning jvm parameters
(1) View linux server configuration information
# Linux operating system kernel to see the current version information
uname -a
# Linux operating system to view the current version information
cat / proc / Version
# Linux view the current version of the operating system release information
cat / etc / issue or CAT / etc / RedHat-release
# View cpu Linux-related information, including the type, frequency, and other core information
CAT / proc / cpuinfo
# Linux view the release notes for the current CPU running in 32bit mode, but it does not mean CPU does not support the 64bit
the getconf LONG_BIT
# Check the hard disk usage
DF -H
# view memory usage
Free -m
. 1
2
. 3
. 4
. 5
. 6
. 7
. 8
. 9
10
. 11
12 is
13 is
14
memory usage (2) of the JVM
JPS
jstat-
jinfo
the jmap
the jhat
jstack
. 1
2
. 3
. 4
. 5
. 6
III tuning idea
(1) mysql
build the primary key
index

(2) tomcat intermediate
adjustment server.xml parameters, such as the configuration -Xms4096M -Xmx4096M

# Register custom URL handlers
# Do this here so custom URL handles (specifically 'war:...') can be used in the security policy
JAVA_OPTS="$JAVA_OPTS -Djava.protocol.handler.pkgs=org.apache.catalina.webresources -Xms4096M -Xmx4096M"
1
2
3
(3)jvm
调整catalina.sh的Xmx和Xms

<! - modify the connection limit ->
<the Executor
name = "tomcatThreadPool"
namePrefix = "Catalina-Exec-"
the maxThreads = "300"
minSpareThreads = "50"
maxIdleTime = "60000"
prestartminSpareThreads = "to true"
maxQueueSize = "100 "
/>

<-!
maxThreads: the maximum number of concurrent, 200 default settings is generally recommended 500 to 800, depending on the hardware facilities and operations to determine
minSpareThreads: the number of threads created when initializing Tomcat, the default setting 25
maxIdleTime: if the current thread is greater than initialize the thread, and that thread is free survival time, in milliseconds, default 60,000 = 60 seconds = 1 minute.
prestartminSpareThreads: When Tomcat initialization parameter values minSpareThreads initialized if a value is not equal to true, lacks effects on the minSpareThreads
maxQueueSize: maximum number of queue, exceeds the request is rejected
->

<!-- A "Connector" represents an endpoint by which requests are received
and responses are returned. Documentation at :
Java HTTP Connector: /docs/config/http.html
Java AJP Connector: /docs/config/ajp.html
APR (HTTP/AJP) Connector: /docs/apr.html
Define a non-SSL/TLS HTTP/1.1 Connector on port 8080
-->

<!-- 参数优化配置-->
<Connector
executor="tomcatThreadPool"
port="8081"
protocol="org.apache.coyote.http11.Http11NioProtocol"
connectionTimeout="60000"
maxConnections="10000"
redirectPort="8443"
enableLookups="false"
acceptCount="100"
maxPostSize="10485760"
maxHttpHeaderSize="8192"
compression="on"
disableUploadTimeout="true"
compressionMinSize="2048"
acceptorThreadCount="2"
compressableMimeType="text/html,text/plain,text/css,application/javascript,application/json,application/x-font-ttf,application/x-font-otf,image/svg+xml,image/jpeg,image/png,image/gif,audio/mpeg,video/mp4"
URIEncoding="utf-8"
processorCache="20000"
tcpNoDelay="true"
connectionLinger="5"/>

<-!
Executor: thread pool mode
port: application port
protocol: Tomcat 8 disposed nio2 better
connectionTimeout: Connector receiving time (milliseconds) after waiting for a connection, the default value is 60,000.
maxConnections: This value represents a maximum number of socket connections to the tomcat
the redirectPort: https port redirector
enableLookups: Disable DNS query
acceptCount: tomcat start when the number of threads when the maximum number of accepted requests queued, the default value is 100.
maxPostSize: URL argument resolved by the container maximum length, 1 (less than 0) to disable this property, the default is 2097152 (2M)
maxHttpHeaderSize: HTTP request header to the maximum extent, part of this length exceeds disregarded. General 8K.
compression: whether to enable GZIP compression on is enabled (text data compression) off is not enabled, force compresses all data
disableUploadTimeout: This flag allows the servlet container to use a different, usually longer upload data connection timeout. If not specified, this property is set to true, it disables the timeout.
compressionMinSize: only when the data size exceeds the minimum compressed
acceptorThreadCount: number of threads to accept connections. Increasing this value on multi-CPU machines, although you never really need more than two. There are also many non maintain the connection, you may want to increase this value. The default value is 1.
compressableMimeType: Configuration Data compression types like
URIEncoding: sites generally use UTF-8 as a default encoding.
processorCache: protocol handler object processor cache to improve performance. This setting determines how much cache these objects. -1 means unlimited, the default is 200. If you do not use the Servlet 3.0 asynchronous processing, the default is to use the same maxThreads settings. If you are using Servlet 3.0 asynchronous processing, the default is the maximum number (synchronous and asynchronous) and the expected large maxThreads concurrent requests.
tcpNoDelay: If set to true, TCP_NO_DELAY options will be set at the server socket, and improve performance in most cases. This is the default setting is true.
connectionLinger: seconds off the socket connector when the continuous use. The default value is -1, the delay time disabling socket.
->
. 1
2
. 3
. 4
. 5
. 6
. 7
. 8
. 9
10
. 11
12 is
13 is
14
15
16
. 17
18 is
. 19
20 is
21 is
22 is
23 is
24
25
26 is
27
28
29
30
31 is
32
33 is
34 is
35
36
37 [
38 is
39
40
41 is
42 is
43 is
44 is
45
46 is
47
48
49
50
51 is
52 is
53 is
54 is
55
56 is
57 is
58
59
60
61 is
62 is
63 is
64
65
66
67
68
69
70
(4) Code
for loop

Large Objects

sql statement

Guess you like

Origin www.cnblogs.com/java889/p/12163921.html