port: 服务端口
protocol: 服务协议
connectionTimeout: 超时时间单位是ms,并发要求高的话,将此值减少!
redirectPort: 重定向端口 需要安全通信的场合,将把客户请求转发至SSL的redirectPort端口
acceptCount: 当指定的连接数被用尽时,可放到出列队列中的数量,也即可接受的排队数量.
maxThreads: Tomcat可创建的最大的线程数(每一个线程对应一个请求), maxThreads决定了tomcat的最大线程阀值,需要设置的大一些
minSpareThreads: 最小备用(空闲)线程数
maxSpareThreads: 最大备用(空闲)线程数,如果空闲线程超过这个值,Tomcat就会关闭不活动线程;
enableLookups: 关闭DNS查询
URIEncoding: 设置tomcat默认的转码格式 查看$TOMCAT_HOME/webapps/tomcat-docs/config/http.html这个说明文档,有如下说明:
URIEncoding:This specifies the character encoding used to decode the URI bytes, after %xx decoding the URL. If not specified, ISO-8859-1 will be used.
也就是说,如果没有设置URIEncoding, Tomcat默认是按ISO-8859-1进行URL解码,ISO-8859-1并未包括中文字符,这样的话中文字符肯定就不能被正确解析了。
useURIValidationHack: 如果把useURIValidationHack设成"false",可以减少它对一些url的不必要的检查从而减省开销。
disableUploadTimeout:
maxKeepAliveRequests:
表示该连接最大支持的请求次数。超过该请求数的连接也将被关闭(此时就会返回一个Connection: close头给客户端)
keepAliveTimeout:
表示在下次请求过来之前,tomcat保持该连接多久。这就是说假如客户端不断有请求过来,且每次连接间隔不超过这个值设置的时间,则该连接将一直保持。
compression、compressionMinSize、 compressableMimeType:omcat配置gzip压缩(HTTP压缩)功能
1)compression=“on” 打开压缩功能
2)compressionMinSize=“2048” 启用压缩的输出内容大小,这里面默认为2KB
3)noCompressionUserAgents=“gozilla, traviata” 对于以下的浏览器,不启用压缩
4)compressableMimeType=“text/html,text/xml” 压缩类型
在bin目录下执行jps命令
3366:是Tomcat的进程号。
然后执行jmap查看相关内存配置
[root@bogon bin]# jmap -heap 3366
Attaching to process ID 3366, please wait…
Debugger attached successfully.
Server compiler detected.
JVM version is 25.181-b13
using thread-local object allocation.
Mark Sweep Compact GC
Heap Configuration:
MinHeapFreeRatio = 40
MaxHeapFreeRatio = 70
MaxHeapSize = 257949696 (246.0MB) //最大堆内存
NewSize = 5570560 (5.3125MB)
MaxNewSize = 85983232 (82.0MB)
OldSize = 11206656 (10.6875MB)
NewRatio = 2
SurvivorRatio = 8
MetaspaceSize = 21807104 (20.796875MB)
CompressedClassSpaceSize = 1073741824 (1024.0MB)
MaxMetaspaceSize = 17592186044415 MB
G1HeapRegionSize = 0 (0.0MB)
Heap Usage:
New Generation (Eden + 1 Survivor Space):
capacity = 27525120 (26.25MB)
used = 4892816 (4.6661529541015625MB)
free = 22632304 (21.583847045898438MB)
17.775820777529763% used
Eden Space:
capacity = 24510464 (23.375MB)
used = 4592952 (4.380180358886719MB)
free = 19917512 (18.99481964111328MB)
18.73873950325869% used
From Space:
capacity = 3014656 (2.875MB)
used = 299864 (0.28597259521484375MB)
free = 2714792 (2.5890274047851562MB)
9.946872877038043% used
To Space:
capacity = 3014656 (2.875MB)
used = 0 (0.0MB)
free = 3014656 (2.875MB)
0.0% used
tenured generation:
capacity = 61005824 (58.1796875MB)
used = 46092496 (43.95722961425781MB)
free = 14913328 (14.222457885742188MB)
75.5542552789714% used
25155 interned Strings occupying 3070328 bytes.