0

How to detect a lost connection between client and server?

asked 2010-01-22 12:40:36 +0800

stremblay gravatar image stremblay
27 1 1

ZK: 3.6.2
Tomcat: 5.5.27
Apache: 2.2.3 with mod_jk 1.2.28

Hi Everyone,

I currently have a ZK application running in a tomcat cluster using apache as a sticky sessions load balancer. The setup works well except for one very anoying thing: I have to hit the browser "reload" button for the failover to work properly.

Here is my understanding of the problem:

When I load/reload a page, the browser connects to the load balancer then is redirected to one of my two servers. From there, as long as I stay on the same page and only play with the components of this page, the client and server are directly connected via the zkau and no page reloading is done.

When I shutdown the tomcat instance where my session is currently running, which shuts down the zkau at the same time, my webapp stops working for as long as I do not click the refresh button. As soon as I refresh, the load balancer sends the client to the failover server and the session is properly handled by this server, all the attributes are there and everything works perfectly.

According to this behavior, I think that I need to be able to detect a lost of connectivity from the client to the server and when it happens, trigger a browser page refresh on the client.

Does anyone have any input on this? Any hint on how I could detect the lost of connectivity? Am I completely out of track?

Thanks a lot,

Sylvain

delete flag offensive retag edit

6 Replies

Sort by ยป oldest newest

answered 2010-01-22 13:13:28 +0800

terrytornado gravatar image terrytornado flag of Germany
9393 3 7 16
http://www.oxitec.de/

updated 2010-01-22 13:16:02 +0800

Hmmmmmmmm, i'm not the expert of this, but i mean this is working a little bit others others.

1. You work with the http protocol. HTTP is a stateless protocol.
Equal if you use a cluster, a load balancer or something else. There's only Request and Response.

2. Clustering is a method for higher scaling an application and with a load balancer mechanism on top this can be
in a known manner. Further clustering can made the application as a whole system more savety if one of the server crashes.

3. The system by clustering (tomcat clustering) is that all tomcat's became notice from the other tomcats. You can
see that in the log by starting such a tomcat worker.
If on of the tomcats crashes. you can see that the other tomcats notices that. I don't know if the tomcats mutually communicate
or that the apache holds a direct connection or do a steady ping on the workers.

So you cannot give back a notice that that the tomcat is away (HTTP). Only the apache can notice that because he knows the workers.
Or you must write self a little program that pings the tomcats.
But i mean that there are codes for that in the net.

best
Stephan

link publish delete flag offensive edit

answered 2010-01-27 06:33:15 +0800

stremblay gravatar image stremblay
27 1 1

Hello Stephan,

Thanks for your input! I was kinda thinking that the connection between the client and zkau was stateful, but as its name states it, zk "A" u :P

I think I'll go on with a little ping program as you suggest, it should do the trick!

thanks,

Sylvain

link publish delete flag offensive edit

answered 2010-01-28 17:03:33 +0800

dhamu gravatar image dhamu
165 1 6

@stremblay

Could you please advise how you solved this. Honestly, I think that this is something that should be built into ZK so that you can keep a session active in the following cases:

1) So that it remains active as long as the client window is open
2) So that it remains active even if the server fails over to a hot backup or a node in a cluster

We have a similar need. It would be great to have a solution and pass it off to the ZKOSS/Potix team to include in a point release of ZK 5.

Thank you,

Dave

link publish delete flag offensive edit

answered 2010-01-28 18:47:21 +0800

PeterKuo gravatar image PeterKuo
481 2

@dhamu
Please post to feature request. It can help us to track and schedule.

link publish delete flag offensive edit

answered 2010-02-03 07:26:29 +0800

stremblay gravatar image stremblay
27 1 1

@dhamu

I didn't had time to work on the resolution of this problem yet, but I hope to be able to do so in the next weeks. I'll try to come back and post my solution when it'll be resolved.

Sylvain

link publish delete flag offensive edit

answered 2010-09-30 13:29:04 +0800

lazzha gravatar image lazzha
30

@Sylvain any luck on this?

@PeterKuo I added a feature request [3078911] hope it gets noticed and developed, if I can help you on the development of this just let me know and point me to the right direction :)

b.t.w. taking terry's idea the ping thing would be something like:

On my zk page I should have a js that pings the server and when the pinger doesn't detects activity it should fire a reload? or any other idea?

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2010-01-22 12:40:36 +0800

Seen: 986 times

Last updated: Sep 30 '10

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More