适当的日志记录和监控:日志和监控有助于分析和排错。
是基于HTTP协议,支持HTTP1.1,它使tomcat服务器扮演一个独立 服务器和JSP/servlet功能的服务器。
JAVA AJP是基于Apache JServ 协议的,该连接器常常是在你不想暴露自己的Java servlet容器到Internet.
Apache Portable Runtime(APR)是在扩容,性能和不同web服务器之间的兼容最好 的。它提供了比如OPENSSL,共享内存,Unix大套接字等。
线程沲定义了web服务器连接请求连接的数量,可以定义两种线程沲:一是共享沲,二是专用沲。该配置在TOMCAT_HOME/conf/server.xml文件中定义的。
假如你配置了四个连接器,那么你可以共享使用这个线程沲。
配置如下:
<Executor name="tomcatThreadPool"
namePrefix="catalina-exec-"
maxThreads="150"
minSpareThreads="4"/>
<Connector executor="tomcatThreadPool"
port="8080"
protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
<Connector port="8443" protocol="HTTP/1.1"
SSLEnabled="true"
maxThreads="150"
scheme="https"
secure="true"
clientAuth="false" sslProtocol="TLS" />
默认定义的最大线程沲是150个,在生产环境中,可以根据服务器的性能来调下该参数。
也相当于并发数一样,默认值是1,也就是相当于关闭。
JMAP显示共享JAVA虚拟机内存信息,对查看共享内存的状态有用的。下面是一些常用选项:
Options Description
./jmap --heap <process id>
比如我们的JAVA的ID是4306,那么就执行./jmap -heap 4306
Attaching to process ID 4306, please wait...
Debugger attached successfully.
Client compiler detected.
JVM version is 19.1-b02
using thread-local object allocation.
Mark Sweep Compact GC
Heap Configuration:
MinHeapFreeRatio = 40
MaxHeapFreeRatio = 70
MaxHeapSize = 268435456 (256.0MB)
NewSize = 1048576 (1.0MB)
MaxNewSize = 4294901760 (4095.9375MB)
OldSize = 4194304 (4.0MB)
NewRatio = 2
SurvivorRatio = 8
PermSize = 12582912 (12.0MB)
MaxPermSize = 67108864 (64.0MB)
Heap Usage:
New Generation (Eden + 1 Survivor Space):
capacity = 5111808 (4.875MB)
used = 3883008 (3.703125MB)
free = 1228800 (1.171875MB)
75.96153846153847% used
Eden Space:
capacity = 4587520 (4.375MB)
used = 3708360 (3.5365676879882812MB)
free = 879160 (0.8384323120117188MB)
80.83583286830357% used
From Space:
capacity = 524288 (0.5MB)
used = 174648 (0.16655731201171875MB)
free = 349640 (0.33344268798828125MB)
33.31146240234375% used
To Space:
capacity = 524288 (0.5MB)
used = 0 (0.0MB)
free = 524288 (0.5MB)
0.0% used
tenured generation:
capacity = 11206656 (10.6875MB)
used = 3280712 (3.1287307739257812MB)
free = 7925944 (7.558769226074219MB)
29.274673908077485% used
Perm Generation:
capacity = 12582912 (12.0MB)
used = 6639016 (6.331459045410156MB)
free = 5943896 (5.668540954589844MB)
52.762158711751304% used
在catalina.sh中JAVA_OPTS的选项。JAVA_OPTS="-Xms128m -Xmx512m -XX:MaxPermSize=256m"
主要有以下选项:
[%T %B->%A(%C), %D]
%D: It is the duration of the collection in seconds.
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。