Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Tomcat and the fly likes Apache , Tomcat , Memcached Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Apache , Tomcat , Memcached" Watch "Apache , Tomcat , Memcached" New topic
Author

Apache , Tomcat , Memcached

Roberto Gomez
Greenhorn

Joined: Nov 20, 2013
Posts: 2
Hello.

I have a system with an Apache server, 2 Tomcat nodes and 2 Memcached nodes.

Apache httpd.conf:

LoadModule jk_module modules/mod_jk.so
JkWorkersFile "conf/workers.properties"
JkLogFile "logs/mod_jk.log"
JkLogLevel error
JKMount /demo/* loadbalancer


Apache workers.properties:

worker.list=loadbalancer,status
worker.samples1.port=8011
worker.samples1.host=localhost
worker.samples1.type=ajp13
worker.samples1.lbfactor=1

worker.samples2.port=8012
worker.samples2.host=localhost
worker.samples2.type=ajp13
worker.samples2.lbfactor=1

worker.loadbalancer.type=lb
worker.loadbalancer.balance_workers=samples1,samples2
wcorker.loadbalancer.sticky_session=1


Tomcat nodes context.xml:

<Manager className="de.javakaffee.web.msm.MemcachedBackupSessionManager"
memcachedNodes="n1:127.0.0.1:11211,n2:127.0.0.1:11311"
requestUriIgnorePattern=".*\.(ico|png|gif|jpg|css|js)$"
sessionBackupTimeout="30"
operationTimeout="30"
transcoderFactoryClass="de.javakaffee.web.msm.serializer.javolution.JavolutionTranscoderFactory"
/>


My problem is when I access the test page, apache sends my request to a different Tomcat node at a time, but with the same saved session in Memcached.
I want all requests from the same session are sent to the same Tomcat node.

Thanks!
Karthik Shiraly
Ranch Hand

Joined: Apr 04, 2009
Posts: 489
    
    5

Check if the properties file has it as "wcorker" - it should be "worker".
Roberto Gomez
Greenhorn

Joined: Nov 20, 2013
Posts: 2
Thank you Karthik.

Now I have other question.
I am testing the jk status manager and I don’t change a property of a node without restart the server. For example, I change the lb Factor and the jk status manager shows the change but does not work.
Karthik Shiraly
Ranch Hand

Joined: Apr 04, 2009
Posts: 489
    
    5
Not sure I understood the problem.
What does not work? Do you mean that you changed lbfactors via status manager UI but the requests are not being sent in proportion to the lbfactor? How did you perform this test?
Changes made via status manager UI won't be saved to the properties file; they're lost when apache httpd is shut down.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Apache , Tomcat , Memcached
 
Similar Threads
Apache SSL Module on Ubuntu
JBoss clustering
Apache 2.0.53 + Tomcat 5.5.7 integration on Windows using mod_jk
Configure 2 instances of JBOSS with apache as the frontend using mod_jk
Jboss5.1.x---Apache 2.2.22 Integration-Service Temporarily Unavailable(503 304)