Static Tomcat Cluster become unresponsive on a JDBC procedure call -
stackoverflow has been way of life me time question rather looking answer have exhausted options.
apologies long description of issue !
we have spring mvc application + tomcat 7 running on windows 2012 server on aws .being analytics application invoking heavy duty procedure calls doing statistical calculations in backed .
with a high availability requirement need setup cluster .now no multicasting on aws resorted 2 other options .(i must first foray aws , tomcat in production environment )
1.static tomcat cluster deltamanager session replication 2.redis based session replication (will long shot windows server , sticky session )
starting static tomcat cluster ,which did set out fuss , went on configure apache httpd mod_proxy load balancer .
<cluster classname="org.apache.catalina.ha.tcp.simpletcpcluster" channelsendoptions="8" channelstartoptions="3"><!--startoption 3 added disable multicast ,channel send option 8 async replication--> <manager classname="org.apache.catalina.ha.session.deltamanager" expiresessionsonshutdown="false" notifylistenersonreplication="true"/> <channel classname="org.apache.catalina.tribes.group.groupchannel"> <receiver classname="org.apache.catalina.tribes.transport.nio.nioreceiver" address="auto" port="4002" autobind="9" selectortimeout="5000" maxthreads="6"/> <sender classname="org.apache.catalina.tribes.transport.replicationtransmitter"> <transport classname="org.apache.catalina.tribes.transport.nio.pooledparallelsender"/> </sender> <interceptor classname="org.apache.catalina.tribes.group.interceptors.tcppinginterceptor"/><!--added ,this interceptor pings other nodes sothat nodes can recognize when other nodes have left cluster. without class, cluster may appear work fine, session replication can break down when nodes removed , re-introduced--> <interceptor classname="org.apache.catalina.tribes.group.interceptors.tcpfailuredetector"/> <interceptor classname="org.apache.catalina.tribes.group.interceptors.messagedispatch15interceptor"/> <interceptor classname="org.apache.catalina.tribes.group.interceptors.staticmembershipinterceptor"> <member classname="org.apache.catalina.tribes.membership.staticmember" port="4000" host="localhost" domain="delta-static" uniqueid="{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,0}" /> </interceptor> </channel> <valve classname="org.apache.catalina.ha.tcp.replicationvalve" filter=""/> <valve classname="org.apache.catalina.ha.session.jvmroutebindervalve"/> <clusterlistener classname="org.apache.catalina.ha.session.jvmroutesessionidbinderlistener"/> <clusterlistener classname="org.apache.catalina.ha.session.clustersessionlistener"/> </cluster>
the mod proxy httpd.conf configuration ajp connector relevant modules uncommented
<proxy balancer://iocluster stickysession=jsessionid> balancermember ajp://127.0.0.1:8009 route=tcruntime8009 loadfactor=1 balancermember ajp://127.0.0.1:8012 route=tcruntime8012 loadfactor=1 </proxy> proxypreservehost on proxystatus on proxypass "/io" "balancer://iocluster/io" proxypassreverse "/io" "balancer://iocluster/io"
the mod proxy httpd.conf configuration http connector relevant modules uncommented
<ifmodule proxy_module> proxyrequests off proxypass /io balancer://iocluster stickysession=jsessionid proxypassreverse /io balancer://iocluster <proxy balancer://iocluster> balancermember http://localhost:8092/io route=tcruntime8092 balancermember http://localhost:8091/io route=tcruntime8091 </proxy> </ifmodule>
the load balancer worked in both cases .the issue session replication wasn't working , see no sign of same in logs .if shut down 1 instance balancer redirect other node see login page ,which proof of same .
as per 18835014 question added tag applications web.xml , moved delta manager tag context.xml
<context> <manager classname="org.apache.catalina.ha.session.deltamanager" expiresessionsonshutdown="false" notifylistenersonreplication="true"/> <!-- default set of monitored resources --> <watchedresource>web-inf/web.xml</watchedresource> <!--<context distributable="true"></context>--> <!-- uncomment disable session persistence across tomcat restarts --> <!-- <manager pathname="" /> --> <!-- uncomment enable comet connection tacking (provides events on session expiration webapp lifecycle) --> <!-- <valve classname="org.apache.catalina.valves.cometconnectionmanagervalve" /> --> </context>
and see session replication active on console enter image description here
the issue when log application the page becomes unresponsive despite queries fired on application !i can see 504(gateway timed out )message on access logs see request return .but first queries fired after submit login page database queries fire application becomes unresponsive .
if move deltamanager inside server.xml application becomes responsive without session replication .
some other tweaks tried the httpd.conf prefork module ,keepalive ,timeout etc after see 500 on access log on apache server nothing worked . appreciate !
<ifmodule mpm_prefork_module> startservers 10 minspareservers 10 maxspareservers 20 maxclients 50 serverlimit 50 maxrequestsperchild 500 </ifmodule> proxyrequests on proxytimeout 600 <proxy *> adddefaultcharset off order deny,allow allow </proxy> <proxy balancer://iocluster stickysession=jsessionid> balancermember ajp://127.0.0.1:8009 min=10 max=100 route=tcruntime8009 loadfactor=1 keepalive=on timeout=600 balancermember ajp://127.0.0.1:8012 min=10 max=100 route=tcruntime8012 loadfactor=1 keepalive=on timeout=600 </proxy> proxypreservehost on proxystatus on proxypass "/io" "balancer://iocluster/io" proxypassreverse "/io" "balancer://iocluster/io"
Comments
Post a Comment