运行tomcat 5.5(64位centos,8 gb ram),mysql,apache
"-server -Xss1M -Xms2G -Xmx3550m -XX:+UseConcMarkSweepGC -XX:NewSize=1G -XX:MaxPermSize=512m XX:CMSInitiatingOccupancyFraction=70"
通过apache作为前端在tomcat上运行多个应用程序(tomcat上各种上下文路径的近10个域)
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没有给出任何响应,它在当时抛出空白页面(完全空白)当它空白时,直接网址:http://127.0.0.1:8080/demo
正常工作。这意味着tomcat仍然可以正常工作,似乎apache无法将请求转发给tomcat - 现在每个实例的加载速度为每分钟20个。
有时候一切都会工作3-4天,然后就会发生,有时会继续发生。空白页面出现一段时间 - 3-4分钟后 - 页面开始播放。
答案 0 :(得分:0)
尝试使用JKMount而不是代理配置?
我和apache config有类似的东西:
#
# Mod_jk settings
#
JkWorkersFile "conf/workers.properties"
JkLogFile "logs/mod_jk.log"
JkLogLevel info
# Select the log format
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
# JkOptions indicate to send SSL KEY SIZE,
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
# JkRequestLogFormat set the request format
JkRequestLogFormat "%w %V %T"
<VirtualHost 127.0.0.1:8443>
SSLEngine On
SSLCertificateFile conf/ssl/domainacom.cert
SSLCertificateKeyFile conf/ssl/domainacom.key
ServerAdmin boss@domain.com
ServerName wwwdomainacom
ErrorLog logs/wwwdomainacom-error_log
CustomLog logs/wwwdomainacom-access_log common
JkMount /* wwwdomainacom
</VirtualHost>
然后在conf / workers.properties中:
worker.list=domainacom,domainbcom
# Set properties for domainacom (ajp13)
worker.domainacom.port=8009
worker.domainacom.host=localhost
worker.domainacom.type=ajp13
worker.domainacom.lbfactor=50
worker.domainacom.cachesize=10
worker.domainacom.cache_timeout=600
worker.domainacom.socket_keepalive=1
worker.domainacom.reclycle_timeout=300
# Set properties for domainbcom (ajp13)
worker.domainbcom.port=8011
worker.domainbcom.host=localhost
worker.domainbcom.type=ajp13
worker.domainbcom.lbfactor=50
worker.domainbcom.cachesize=10
worker.domainbcom.cache_timeout=600
worker.domainbcom.socket_keepalive=1
worker.domainbcom.reclycle_timeout=300
最后在tomcat:
<!-- Define an AJP 1.3 Connector on port 8009 -->
<Connector port="8009"
enableLookups="true" redirectPort="8443" protocol="AJP/1.3" URIEncoding="UTF-8" />
据我所知,我从来没有丢失任何请求。
答案 1 :(得分:0)
您使用的是Load Balancer吗?请确保它不是基于PING的。有时托管服务提供商拒绝基于ping的网络负载。