Session affinity vs sticky session
Hi all, I have to raise this question because it may confuse a lot of us and the right answer can clarify something very important: Is session affinity and sticky session the same in apache + jk2 + tomcat load balancing enviroment? As I know, the sticky session means that: if you have many instances of tomcat (eg: tomcat1 tomcat2) and you start session on tomcat1, the subsequent requests will be forwarded to tomcat1 as long as tomcat1 running an up (you never reach tomcat2). It means that if tomcat1 now is down, then your subsequent request will be forwarded to tomcat2, with a different session (a new session created at tomcat1 for you). This is not very good because if your application responsing on tomcat1, then moved to tomcat2, session data will be lost, right? Now the session affinity, means you will have the same session (Id) regardless of your first or subsequent requests served by tomcat1 or tomcat2. It means that you sesison will be duplicated on both tomcat1 and tomcat2. Sometimes you served by tomcat1, sometimes you served tomcat2, although none of them is down. Is that right? Now my next question: what kind of session management (sticky or affinity) supported by (apache2 + jk2 + tomcat4)? If anything above is wrong, please correct me. I appreciate that. Tks, Dinh. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Session affinity vs sticky session
I got two answers from Filip and Ralph. Basing on what Filip said, can I think that no session replication in session affinity? Tks for yours. -Original Message- From: Filip Hanik [mailto:[EMAIL PROTECTED] Sent: Monday, October 27, 2003 2:11 PM To: Tomcat Users List Subject: Re: Session affinity vs sticky session session affinity==sticky sessions, if you need session replication, try out http://cvs.apache.org/~fhanik/ Filip - Original Message - From: Dinh Nguyen [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Sent: Sunday, October 26, 2003 11:03 PM Subject: Session affinity vs sticky session Hi all, I have to raise this question because it may confuse a lot of us and the right answer can clarify something very important: Is session affinity and sticky session the same in apache + jk2 + tomcat load balancing enviroment? As I know, the sticky session means that: if you have many instances of tomcat (eg: tomcat1 tomcat2) and you start session on tomcat1, the subsequent requests will be forwarded to tomcat1 as long as tomcat1 running an up (you never reach tomcat2). It means that if tomcat1 now is down, then your subsequent request will be forwarded to tomcat2, with a different session (a new session created at tomcat1 for you). This is not very good because if your application responsing on tomcat1, then moved to tomcat2, session data will be lost, right? Now the session affinity, means you will have the same session (Id) regardless of your first or subsequent requests served by tomcat1 or tomcat2. It means that you sesison will be duplicated on both tomcat1 and tomcat2. Sometimes you served by tomcat1, sometimes you served tomcat2, although none of them is down. Is that right? Now my next question: what kind of session management (sticky or affinity) supported by (apache2 + jk2 + tomcat4)? If anything above is wrong, please correct me. I appreciate that. Tks, Dinh. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Session affinity vs sticky session
Filip, you are a man. Thank you very much. Dinh. -Original Message- From: Filip Hanik [mailto:[EMAIL PROTECTED] Sent: Monday, October 27, 2003 2:52 PM To: Tomcat Users List Subject: Re: Session affinity vs sticky session correct - Original Message - From: Dinh Nguyen [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Sent: Sunday, October 26, 2003 11:47 PM Subject: RE: Session affinity vs sticky session I got two answers from Filip and Ralph. Basing on what Filip said, can I think that no session replication in session affinity? Tks for yours. -Original Message- From: Filip Hanik [mailto:[EMAIL PROTECTED] Sent: Monday, October 27, 2003 2:11 PM To: Tomcat Users List Subject: Re: Session affinity vs sticky session session affinity==sticky sessions, if you need session replication, try out http://cvs.apache.org/~fhanik/ Filip - Original Message - From: Dinh Nguyen [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Sent: Sunday, October 26, 2003 11:03 PM Subject: Session affinity vs sticky session Hi all, I have to raise this question because it may confuse a lot of us and the right answer can clarify something very important: Is session affinity and sticky session the same in apache + jk2 + tomcat load balancing enviroment? As I know, the sticky session means that: if you have many instances of tomcat (eg: tomcat1 tomcat2) and you start session on tomcat1, the subsequent requests will be forwarded to tomcat1 as long as tomcat1 running an up (you never reach tomcat2). It means that if tomcat1 now is down, then your subsequent request will be forwarded to tomcat2, with a different session (a new session created at tomcat1 for you). This is not very good because if your application responsing on tomcat1, then moved to tomcat2, session data will be lost, right? Now the session affinity, means you will have the same session (Id) regardless of your first or subsequent requests served by tomcat1 or tomcat2. It means that you sesison will be duplicated on both tomcat1 and tomcat2. Sometimes you served by tomcat1, sometimes you served tomcat2, although none of them is down. Is that right? Now my next question: what kind of session management (sticky or affinity) supported by (apache2 + jk2 + tomcat4)? If anything above is wrong, please correct me. I appreciate that. Tks, Dinh. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Session affinity doesn't work
Hi Klaus, The jvmRoute of the second tomcat instance is tomcat2, I forgot to said that in my first email. About the tomcatId, I modified my settings as you said but now the load balancing no longer works. Only tomcat2 responses to my request. Thank you anyway. Anyone have another idea? Thanks. Dinh. PS: The attachments are my setting files for your reference. server1.xml is server.xml for tomcat1 and server2.xml is server.xml for tomcat2 !-- Example Server Configuration File -- !-- Note that component elements are nested corresponding to their parent-child relationships with each other -- !-- A Server is a singleton element that represents the entire JVM, which may contain one or more Service instances. The Server listens for a shutdown command on the indicated port. Note: A Server is not itself a Container, so you may not define subcomponents such as Valves or Loggers at this level. -- Server port=11005 shutdown=SHUTDOWN debug=0 !-- Comment these entries out to disable JMX MBeans support -- !-- You may also configure custom components (e.g. Valves/Realms) by including your own mbean-descriptor file(s), and setting the descriptors attribute to point to a ';' seperated list of paths (in the ClassLoader sense) of files to add to the default list. e.g. descriptors=/com/myfirm/mypackage/mbean-descriptor.xml -- Listener className=org.apache.catalina.mbeans.ServerLifecycleListener debug=0/ Listener className=org.apache.catalina.mbeans.GlobalResourcesLifecycleListener debug=0/ !-- Global JNDI resources -- GlobalNamingResources !-- Test entry for demonstration purposes -- Environment name=simpleValue type=java.lang.Integer value=30/ !-- Editable user database that can also be used by UserDatabaseRealm to authenticate users -- Resource name=UserDatabase auth=Container type=org.apache.catalina.UserDatabase description=User database that can be updated and saved /Resource ResourceParams name=UserDatabase parameter namefactory/name valueorg.apache.catalina.users.MemoryUserDatabaseFactory/value /parameter parameter namepathname/name valueconf/tomcat-users.xml/value /parameter /ResourceParams /GlobalNamingResources !-- A Service is a collection of one or more Connectors that share a single Container (and therefore the web applications visible within that Container). Normally, that Container is an Engine, but this is not required. Note: A Service is not itself a Container, so you may not define subcomponents such as Valves or Loggers at this level. -- !-- Define the Tomcat Stand-Alone Service -- Service name=Tomcat-Standalone !-- A Connector represents an endpoint by which requests are received and responses are returned. Each Connector passes requests on to the associated Container (normally an Engine) for processing. By default, a non-SSL HTTP/1.1 Connector is established on port 8080. You can also enable an SSL HTTP/1.1 Connector on port 8443 by following the instructions below and uncommenting the second Connector entry. SSL support requires the following steps (see the SSL Config HOWTO in the Tomcat 4.0 documentation bundle for more detailed instructions): * Download and install JSSE 1.0.2 or later, and put the JAR files into $JAVA_HOME/jre/lib/ext. * Execute: %JAVA_HOME%\bin\keytool -genkey -alias tomcat -keyalg RSA (Windows) $JAVA_HOME/bin/keytool -genkey -alias tomcat -keyalg RSA (Unix) with a password value of changeit for both the certificate and the keystore itself. By default, DNS lookups are enabled when a web application calls request.getRemoteHost(). This can have an adverse impact on performance, so you can disable it by setting the enableLookups attribute to false. When DNS lookups are disabled, request.getRemoteHost() will return the String version of the IP address of the remote client. -- !-- Define a non-SSL Coyote HTTP/1.1 Connector on port 8080 Connector className=org.apache.coyote.tomcat4.CoyoteConnector port=8080 minProcessors=5 maxProcessors=75 enableLookups=true redirectPort=8443 acceptCount=100 debug=0 connectionTimeout=2 useURIValidationHack=false disableUploadTimeout=true / -- !-- Note : To disable connection timeouts, set connectionTimeout value to -1 -- !-- Define a SSL Coyote HTTP/1.1 Connector on port 8443 -- !-- Connector className=org.apache.coyote.tomcat4.CoyoteConnector port=8443 minProcessors=5 maxProcessors=75 enableLookups=true acceptCount=100 debug=0
RE: Session affinity doesn't work
This is my workers2.properties. I attached it to my last mail but the mail server removed it. Sorry for that. == [logger] level=DEBUG [config:] #file=${serverRoot}/conf/workers2.properties #file=c:/Apache2/conf/workers2.properties file=conf/workers2.properties debug=0 debugEnv=0 [shm:] info=Scoreboard. Required for reconfiguration and status with multiprocess servers #file=${serverRoot}/logs/jk2.shm file=logs/jk2.shm size=100 debug=0 disabled=0 [workerEnv:] info=Global server options timing=1 debug=0 # Default Native Logger (apache2 or win32 ) # can be overriden to a file logger, useful # when tracing win32 related issues #logger=logger.file:0 [lb:lb] info=Default load balancer. debug=0 # tomcat1 [channel.socket:localhost:11009] port=11009 host=localhost type=ajp13 lb_factor=100 #tomcatId=tomcat1 : make load balancing not work # tomcat2 [channel.socket:localhost:12009] port=12009 host=localhost type=ajp13 lb_factor=100 #tomcatId=tomcat2 : make load balancing not work # tomcat3 #[channel.socket:psdwdinhnguyen:13009] #port=13009 #host=psdwdinhnguyen #type=ajp13 #lb_factor=100 [uri:/jkstatus/*] info=Display status information and checks the config file for changes. #group=status: [uri:/*.jsp] info=Extension mapping == -Original Message- From: Dinh Nguyen Sent: Monday, October 27, 2003 8:50 AM To: Tomcat Users List Subject: RE: Session affinity doesn't work Hi Klaus, The jvmRoute of the second tomcat instance is tomcat2, I forgot to said that in my first email. About the tomcatId, I modified my settings as you said but now the load balancing no longer works. Only tomcat2 responses to my request. Thank you anyway. Anyone have another idea? Thanks. Dinh. PS: The attachments are my setting files for your reference. server1.xml is server.xml for tomcat1 and server2.xml is server.xml for tomcat2 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Session affinity doesn't work
Hi all, I have downloaded these following packages and installed them on my machine (Win 2K): Apache 2.0.47 Tomcat 2.0.47 Jk2_mod connector 2.0.43. I have 2 instances of tomcat (tomcat1, tomcat2 on the same host) on my machine on a load balancing environment. The load balancing works well with one exception: the session affinity doesn't work as expected. Everytime I refresh my browser, it gives me a different session id. If anyone experimented this problem, please help me. These are my settings and modifications to apache and tomcat. Apache httpd.conf == LoadModule jk2_module modules/mod_jk2.dll == Apache workers2.properties (entire content) == [logger] level=DEBUG [config:] #file=${serverRoot}/conf/workers2.properties #file=c:/Apache2/conf/workers2.properties file=conf/workers2.properties debug=0 debugEnv=0 [shm:] info=Scoreboard. Required for reconfiguration and status with multiprocess servers #file=${serverRoot}/logs/jk2.shm file=logs/jk2.shm size=100 debug=0 disabled=0 [workerEnv:] info=Global server options timing=1 debug=0 # Default Native Logger (apache2 or win32 ) # can be overriden to a file logger, useful # when tracing win32 related issues #logger=logger.file:0 [lb:lb] info=Default load balancer. debug=0 # tomcat1 [channel.socket:localhost:11009] port=11009 host=localhost type=ajp13 lb_factor=100 # tomcat2 [channel.socket:localhost:12009] port=12009 host=localhost type=ajp13 lb_factor=100 [uri:/jkstatus/*] info=Display status information and checks the config file for changes. #group=status: [uri:/*.jsp] info=Extension mapping == Tomcat1 server.xml == 1. Comment out Coyote HTTP/1.1 Connector at port 8080 2. Change Server port=8005 shutdown=SHUTDOWN debug=0 to Server port=11005 shutdown=SHUTDOWN debug=0 3. Change Engine name=Standalone defaultHost=localhost debug=0 to Engine name=Standalone defaultHost=localhost debug=0 jvmRoute=tomcat1 (notice: I DID rename the misspelling from jmvRoute to jvmRoute in the orginal release) 4. Change Coyote/JK2 AJP 1.3 Connector to listen at 11009 5. No change for jk2.properties == Tomcat2 server.xml == The same with Tomcat1, but with different port numbers (12005 for server, 12009 for Coyote/JK2 AJP 1.3 Connector) == At the ROOT directory of each tomcat instance, I create a jsp file with a single command request.getSession().getId() Then I start tomcat1, tomcat2, apache (in order). Everything is OK. No error reported on the screen. The only bad thing is that with every request, this page returns a different session id (they are suffixed with .tomcat1 and .tomcat2), if the session affinity works correctly, they must be the same, right? Is there anything wrong with my configuration? If anyone have solution, please share it to me. I appreciate it. Dinh. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]