User Tools

Site Tools


tomcat

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
tomcat [2019/07/12 09:45]
zengfanjiang [常见问题]
tomcat [2023/03/08 16:05] (current)
xujianglong ↷ Page moved from 内部资料:tomcat to tomcat
Line 1: Line 1:
-常见问题 +====== 常见问题 ======
-# 相关知识+
  
-## java.lang.outofmemoryerror java heap space+===== java.lang.OutOfMemoryError:Java heap space =====
  
-增加tomcat的java内存即可具体修改`/etc/default/tomcat7`将`JAVA_OPTS="-Djava.awt.headless=true -Xmx1280m -XX:+UseConcMarkSweepGC"`中Xmx后的数字改大即可(以MB为单位)+==== 解决方案: ==== 
 + 
 +tomcat内存配置: 在bin下catalina.bat文件中echo Using CATALINA_BASE: "%CATALINA_BASE%"的前一行加入如下代码。 set JAVA_OPTS=%JAVA_OPTS% -server -Xms8192m -Xmx8192m -Xmn1890m windows安装版的Tomcat直接在启动器里配置最大内存值。 
 + 
 +Tomcat并发优化、内存配置、垃圾回收、宕机预防 知识学习 (1) tomcat并发参数 //maxThreads:最大的并发请求数当cpu利用率高的时候,不宜增加线程的个数,当cpu利用率不高,大部分io阻塞类的操作时,可以适当增加该值。 //maxSpareThreads:Tomcat连接器的最大空闲 socket 线程数 //acceptCount:当处理任务的线程数达到最大时接受排队的请求个数 //connectionTimeout:网络连接超时,单位毫秒 //enableLookups:若为false则不进行DNS查询,提高业务能力应设置为false //disableUploadTimeout:若为true则禁用上传超时\\ 
 +--------------------- 原文及相关知识学习:https:%%//%%blog.csdn.net/u010133338/article/details/81142902 
 + 
 +===== Tomcat Get请求 出现中文乱码 ===== 
 + 
 +==== 解决方案: ==== 
 + 
 +就目前所遇到的问题来看,大部分乱码,在Tomcat server.xml 文件中对编码参数进行配置 在HTTP/1.1中增加URIEncoding="utf-8; <html><Connector port="8098" protocol="HTTP/1.1" 
 +  connectionTimeout="20000" 
 +  redirectPort="8443" URIEncoding="utf-8"/></html> 
 + 
 +=== apache tomcat官方网站对这两个关于配置编码参数解释: === 
 + 
 +关于tomcat编码参含义解释:[[https:%%//%%blog.csdn.net/thomassamul/article/details/82149496]]  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. useBodyEncodingForURI: This specifies if the encoding specified in contentType should be used for URI query parameters, instead of using the URIEncoding. This setting is present for compatibility with Tomcat 4.1.x, where the encoding specified in the contentType, or explicitly set using Request.setCharacterEncoding method was also used for the parameters from the URL. The default value is false . ---------------------
  
-(1) tomcat内存参数 
  
-  *-server:一定要作为第一个参数,在多个CPU时性能佳 
-  *-Xms:java Heap初始大小。 默认是物理内存的1/64。 
-  *-Xmx:java heap最大值。建议均设为物理内存的一半。不可超过物理内存。 
-  *-XX:PermSize:设定内存的永久保存区初始大小。缺省值为64M。 
-  *-XX:MaxPermSize:设定内存的永久保存区最大 大小。缺省值为64M。 
-  *-Xmn:young generation(年轻代)的heap大小。一般设置为Xmx的3、4分之一 
----------------------  
-  *原文及Tomcat并发优化、内存配置、垃圾回收、宕机预防学习地址:https://blog.csdn.net/u010133338/article/details/81142902  
tomcat.1562895942.txt.gz · Last modified: 2021/02/10 21:29 (external edit)