性能调优step by step (五) -遇到的有关问题(内存)

性能调优step by step (五) --遇到的问题(内存)


1. free 查看内存,使用超过16G(累积出来的)。而生产环境只有一驱四 25G内存,有内存溢出危险。

解决方法:修改jboss 启动脚本虚拟机配置,修改回收机制,改为CMS回收。

JAVA_OPTS="-server -Xmx2g -Xms2g -Xmn256m -XX:PermSize=128m -Xss256k -XX:MaxTenuringThreshold=31  -XX:+UseConcMarkSweepGC -XX:+UseParNewGC  -XX
:+CMSParallelRemarkEnabled -XX:+UseCMSCompactAtFullCollection -XX:LargePageSizeInBytes=128m  -XX:+UseFastAccessorMethods"




2. 内存使用始终很大,在2G多,tps 也上不去。ps –aux 没有发现apache日志占用内存。
解决方法:apache access log  是apache的访问日志,每次访问都会记录,占用了46M,删除后内存占用降低了很多 从2G多降低到300M,最终在httpd.conf中去掉access_log配置


   #DeflateFilterNote ratio
   #LogFormat '"%r" %b (%{ratio}n) "%{User-agent}i"' deflate
   #CustomLog /home/admin/pc2/logs/deflate_log deflate 

   #LogFormat "%h %l %u %t \"%m /%{HOST}i%U%q %H\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %T" combined
   #LogFormat "%h %l %u %t \"%r\" %>s %b" common
   #LogFormat "%{Referer}i -> %U" referer
   #LogFormat "%{User-agent}i" agent
   #CustomLog /home/admin/pc2/logs/access_log combined