Apache mod_proxy, tomcat 5.5 - sometimes no response
Running tomcat 5.5 with (64 bit centos, 8 gb ram), mysql, apache
"-server -Xss1M -Xms2G -Xmx3550m -XX:+UseConcMarkSweepGC -XX:NewSize=1G -XX:MaxPermSize=512m XX:CMSInitiatingOccupancyFraction=70"
running multiple application on tomcat via apache as front end (almost 10 domains for various context paths on 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$ [开发者_如何学GoNC]
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]
Everything works great, including response time and all 10 instances (various domains), but 3-4 times a day: http://test.web.com does not give any response, it throws blank page (completely blank) while at the time when its blank, direct url: http://127.0.0.1:8080/demo
works fine. It means tomcat still works fine, it seems apache is not able to forward the request to tomcat - right now load on per instance is 20 per minute.
Sometime everything works for 3-4 days, then it happens, sometimes it keeps on happening. Blank page comes for some time - and after 3-4 minutes - page starts coming.
Try using JKMount rather than your proxy config?
I have something similar with 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>
then in 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
finally in tomcat:
<!-- Define an AJP 1.3 Connector on port 8009 -->
<Connector port="8009"
enableLookups="true" redirectPort="8443" protocol="AJP/1.3" URIEncoding="UTF-8" />
as far as i know, i never have any lost requests.
Are you using Load Balancer? Please make sure its not PING based. Sometimes hosting provider rejects pings based network load.
精彩评论