I think the one you talked about is not what I want.
The keepalive setting in Weblogic --> protocol --> http is for the server to keep the server-client connection alive for certain time after a request is finished, so the following request from the same client can use the connection without creating a new one.
Our company firewall/proxy server have a timeout limit, it will kill any idle connection of more than 5 minutes. Unfortunately some of my Weblogic request take a long time to process, so the client-server connection will be dropped before the server can present the page. What I want is to configure Weblogic so that it can send out keep-alive packet while processing the long request, so the connection won't be killed by proxy.
Welcome to the JavaRanch, Fly. You must have missed our naming policy on your way in. In short, names must be a first name and last name, separated by a space and not obviously fake. You can change your name here.
SO_KEEPALIVE, that is what I am talking about. Too bad if Weblogic doesn't support this. The socket_keepalive in Tomcat will trigger the operating system to send keep-alive packet, interval depend on SO_KEEPALIVE setting, generally 120mn, that still is too long.
Does anybody know how to permanently change the SO_KEEPALIVE value in the operating system (windows)?
I changed the KeepAliveTime on the server side, so the server can now send keep-alive packets at a shorter interval.
But I think more still need to be done. It says on another website: "A specific application can request that keep-alive packets be sent", so I guess the TCP/IP connection will not automatically be kept alive unless the application request it. I guess that's what socket_keepalive setting in TOMCAT is all about.
so I guess the TCP/IP connection will not automatically be kept alive unless the application request it
That's true. Keep-alive is not specific to java but to Http 1.1 specification. The specification points out that this is driven by client and not by server. As you think this is not something specific to Tomcat but to Java. Second you still have problem with your firewall settings. No matter what value you configure as KEEPALIVE setting firewall will close the inactive sockets based on it's rule.
Let's take a step back to see what else can be done
1) Can the firewall timeout setting be changed? It might be rejected by Admin group
2) Can the procedured to be optimized to finish in 5 minutes? It may be a challange and time consuming task.
3) I assume this is a web application becuase both Tomcat and WebLogic are in the context. Can the page be changed to async? I am sure this can be done By using Ajax or just a simple hidden IFrame , the page can be changed to an async page. Then there is no requirement to keep the connection for 5 minutes. Anohter reason to change the page to async is that the user will lost patient when they are waiting for the result.
1)create my own response class which has a build in buffer to hold the output. 2)create a new thread to execute the heave task. Pass in my own response object . It will bring back the response 3) kick off the new thread to execute the heave task 4) the main execution thread is doing the sending back to keep the connection alive and sleeping , check if the heavy task has been done 5) When the heave task has been done , get the content from the response object and send it back to client
Lin, I think I figured out why socket_keepalive doesn't work. It is used to keep connection between tomcat/IIS or tomcat/Apache open if they reside on different machines. It is not used to keep the browser/IIS or browser/Apache connection. That's my understanding.
Unfortunately I don't know how to configure IIS or Apache to do the same thing.
There should be no difference between these 2 cases. When we talk about the TCP layer to a server , there is no difference for the connection either it is from a proxy or it is from the client directly. It is only a connection.
Only in your code you may need to know the exact client address.
The reason Apache/Tomcat can support SO_KEEPALIVE is the tomcat should set the SO_KEEPALIVE when the connection was built.
Lin [ August 23, 2006: Message edited by: Lin Feng ]
rubbery bacon. rubbery tiny ad:
a bit of art, as a gift, that will fit in a stocking