使用(64 位 centos,8 gb ram)、mysql、apache 运行 tomcat 5.5
"-server -Xss1M -Xms2G -Xmx3550m -XX:+UseConcMarkSweepGC -XX:NewSize=1G -XX:MaxPermSize=512m XX:CMSInitiatingOccupancyFraction=70"
通过 apache 作为前端在 tomcat 上运行多个应用程序(几乎 10 个域用于 tomcat 上的各种上下文路径)
apache config:
httpd.conf:
KeepAlive On
ProxyRequests Off
ProxyPreserveHost On
Timeout 1800
ProxyPass /demo http : //127.0.0.1:8080/demo
ProxyPassReverse /demo http :// 127.0.0.1.22:8080/demo
ProxyPass /demo2 http :// 127.0.0.1:8080/demo2
ProxyPassReverse /demo2 http :// 127.0.0.1.22:8080/demo2
SetEnv force-proxy-request-1.0 1
SetEnv proxy-nokeepalive 1
.htaccess
RewriteEngine on
RewriteCond %{HTTP_HOST} ^test\.web\.com$ [NC]
RewriteRule (.*) http : //test.web.com/demo/$1 [L,R=301]
RewriteCond %{HTTP_HOST} ^test2\.web\.com$ [NC]
RewriteRule (.*) http : //test2.web.com/demo2/$1 [L,R=301]
一切都很好,包括响应时间和所有 10 个实例(各种域),但每天 3-4 次:http: //test.web.com没有给出任何响应,它在空白的时间,直接 url:http://127.0.0.1:8080/demo
工作正常。这意味着 tomcat 仍然可以正常工作,似乎 apache 无法将请求转发给 tomcat - 现在每个实例的负载是每分钟 20 个。
有时一切工作 3-4 天,然后它发生,有时它继续发生。空白页出现了一段时间 - 3-4 分钟后 - 页面开始出现。