GF3.0 - Enabling HTTP keep-alive?
In GF 2.0, there's a handy-dandy tab on the HTTP Listener configs for enabling and configuring HTTP keep-alives. In GF 3.0, there is not.
I've been combing various sites and blogs and docs and have been unable to find any information on enabling HTTP keep-alives. Some data I've found seems to suggest that raising the Max Connections and Timeout values for the listener to values greater than 1 implicitly enables keep-alives, but if I test the server with AB it shows zero keep-alive requests.
Any help that anyone could provide would be greatly appreciated.
[glassfish@appserver ~]$ asadmin get -m \*keep-alive.\*count
Enter admin user name> admin
Enter admin password for user "admin">
Command get executed successfully.
[glassfish@appserver ~]$ asadmin get "server\*keep-alive.\*"
Enter admin user name> admin
Enter admin password for user "admin">
com.sun.enterprise.admin.cli.CommandException: remote failure: Dotted name path server\*keep-alive.\* not found.
Command get failed.
Similar Messages
-
Http keep-alive with SOAP webservices
Just had an interesting experience with a web service setup behind UAG...under low load conditions all SOAP responses were coming across with no issue...once a high load was introduced by the client app the behavior changed where an initial request was
processed and subsequent requests were rejected by UAG with a Bad Parameter : Length message...but high load (relatively) on a web browser ran without issue...the client app had to wait ~100 seconds before the next request would process correctly...browser
works - app has problems...turns out it was the keep-alive "default" settings on both the client app server, as well as my web service in IIS...so -apparently UAG thought the 2nd (and subsequent < 100 seconds) were a parameter of the first request...and
was way too long and got rejected...I unchecked the keep-alive enabled box on the http response header (set common headers) and all is fine now! Apparently the browsers were closing the connection with each page load and the service responded appropriately
- so it looked like all was well. Using SOAP UI revealed the error...but it also had it's connection set to keep-alive...once that was disabled in SOAP UI all requests ran correctly...that's when I poked around and found that response header setting.ejp wrote:
and also an incorrect implementation of the timeout period. This code will still wait forever if no data arrives.You're right... actually I didn't mean to put that while loop there! What I meant was simply
if (!reader.ready())
wait(keepAliveTimeout);
if (!reader.ready())
break mainLoop;
// If we get here there is a new request to read...and I agree that it's ugly, that's why I'm asking you guys for help!
setSoTimeout() is of course a way to go... didn't think of that although I have kind of already added it to my code but with a different timeout. Thanks!
Last question then is:
does reader.readLine() block like reader.read(), or do I have to use the latter?
I would test for myself I could, but at the moment I can't... -
Need help with HTTP keep-alive
Hi folks!
I have this very simple web server and I would like to add keep-alive support. I've been trying to get my head around it for a while and could need some help (I found this question in the archive, but those replies didn't help)...
This is my starting point (stripped down to the basics):
/* A listener thread that accept incoming requests by creating new request handlers */
public class HTTPListener implements Runnable
private ServerSocket serverSocket;
public HTTPListener(int port)
// Try to create a server socket on specified port
try
serverSocket = new ServerSocket(port, 0);
catch (IOException ex)
System.err.println("Oops!");
public void run()
while (!Thread.interrupted())
try
// Listen on server socket until a request arrives
Socket s = serverSocket.accept();
// Create handler to service request
RequestHandler h = new RequestHandler(s);
new Thread(h).start();
// Server socket closed when listening
catch (SocketException ex)
Thread.currentThread().interrupt();
// Failed to close socket or failure during server socket accept
catch (IOException ex)
System.err.println("Failed to accept request");
try
serverSocket.close();
catch (IOException ex)
System.err.println("Hmpf...");
/* Handler that prints out requests and always answers with status 200 */
public class RequestHandler implements Runnable
private Socket socket;
public RequestHandler(Socket s)
socket = s;
public void run()
System.out.println(">>> New request handler");
try
BufferedReader reader = new BufferedReader(new InputStreamReader(socket.getInputStream()));
String str;
while ((str = reader.readLine()) != null)
System.out.println(str);
sendDummyReplyWithKeepAlive();
reader.close();
socket.close();
catch (IOException ex)
System.err.println("Crap, got an exception!");
}When I run the server (which in reality has a little more to it) I never get more than one request printed for each ">>> New request handler", which is not surprising!
Now, with keep-alive support I expect to get consecutive requests from the same client printed by the same handler instance. What I have to do (as I've understood from my readings) is to modify the while loop in the request handler that reads from the socket so that it spins until the connection is closed by the client (or a keep-alive timeout occurs) and blocks while there is nothing to read.
Perhaps I'm being stupid now, but how do I actually do this?ejp wrote:
and also an incorrect implementation of the timeout period. This code will still wait forever if no data arrives.You're right... actually I didn't mean to put that while loop there! What I meant was simply
if (!reader.ready())
wait(keepAliveTimeout);
if (!reader.ready())
break mainLoop;
// If we get here there is a new request to read...and I agree that it's ugly, that's why I'm asking you guys for help!
setSoTimeout() is of course a way to go... didn't think of that although I have kind of already added it to my code but with a different timeout. Thanks!
Last question then is:
does reader.readLine() block like reader.read(), or do I have to use the latter?
I would test for myself I could, but at the moment I can't... -
Can someone briefly explain what these are? I've searched online and found that they can hold connections open and possibly allow users to make several simultaneous requests, but nothing definitive.
The issue is a web-site that seems to stall after a moderate amount of use (100 - 200 concurrent users). The setup is Windows Server running IIS making requests to Tomcat. Eventually the site starts giving white screens -- no error messages in the browser and none in the tomcat logs. Looking in the IIS logs I find the vague 503 error, which I'm starting to think could be originating in Tomcat.
I'm not doing any extra Tomcat settings (as far as maxThreads, minThreads, maxKeepAlives...) so I'm looking for ideas and if they could possibly be the culprit of my problem. I'd like to configure them but only if I can get a solid idea of what I should use.
Also, in searching the Tomcat docs I've found that by default maxThreads is set to 200 and I'm curious would that translate to 1 thread per user accessing the site or could one user possibly be using several threads at once? Would the keepalives setting impact this?
thanks guys!!only bumping this once.
-
<blockquote>Locking duplicate thread.<br>
Please continue here: [[/questions/954029]]</blockquote>
keep alive missing from about:config settings can it be added back? tell me how and i willNo, you can't add this missing pref back.<br />
Support to disable keep-alive has been removed and keep-alive is always enabled.
See "A Preference to disable HTTP Keep-Alive has been removed":
*https://developer.mozilla.org/en-US/docs/Site_Compatibility_for_Firefox_17
*Bug 770331 – Remove HTTP Keep-Alive disable pref -
Keep alive in HttpURLConnection
I'm trying to keep my connection open in HttpURLConnection.
This is the code in the client's side, the server is Weblogic 8.1, with support in http keep alive.
Even thogt I'm setting request property - connection:Keep-Alive for the HttpURLConnection and setting http.keepAlive=true, I steel receive Connection :close in the header.
Here is my code:
URL url = new URL("http://bla");
HttpURLConnection httpUC = (HttpURLConnection)url.openConnection();
httpUC.setDoOutput(true);
httpUC.setRequestMethod("POST");
// set the keep alive in the HttpURLConnection
httpUC.setRequestProperty("Connection","Keep-Alive");
//set the keep aive in the system properties
System.getProperties.put("http.keepAlive", true);
// just check the response from the server:
System.out.println(httpUC.getResponseCode);
// print all of the headers
for(int i=0; ;i++){
String header = httpUC.getHeaderField(i);
String key = httpUC.getHeaderFieldKey(i);
if(key==null || header==null)
break;
System.out.println(key + ":" + header);----------------------------------------------
And this is the result I receive
200
Date:...
Server:..
Connection:Close
...OK,
I moved forward a little.
I hava HTTP 1.1 at the server side.
more than that - when I print the server's headers I receive:
Connection: Keep-Alive
But -
If what I'm doing is read from the server in for loop - everithing is OK.
if I'm trying to read and write in for loop (code below) - I receive the following exception:
Protocol Exception: can't write output after reading input
So, can I only read reaptedly, not write?
This is the code I'm using:
for(int i=0; i<2; i++){
///////// these lines caught the ProtocolException in the second run in the loop
ObjectOutputSream oos = new ObjectOutputStream(httpUrlConnection.getOutputStream);
System.out.println(i);
oos.write("bla".getBytes());
oos.close;
System.out.println(httpUrlConnection.getContent());
this is the output:
0
......InputStream@b.......
java.net.ProtocolException:
cannot write output after reading input -
Keep alive script for HTTPS service with GET method
Hello,
I tried to implement a keep alive to services that support HTPS connections. Ive created a script that opens a tcp connection on port 443 and tries to do a GET of a test web page. This web page only displays OK.
In a resumed form I used the following script commands:
Socket connect host 192.168.136.134 port 443 tcp
Socket send ${SOCKET} GET /teste.template\n\n
Socket waitfor ${SOCKET} 200 2000
Socket disconnect ${SOCKET} graceful
I was unable to receive the expected 200 response and received a message saying string not found, I used the socket inspect command to inspect the sockets internal data buffer and the result was nothing, it seemed empty.
I tried the same operation using a linux machine that has IP connectivity with the Webservers and I was successful.
In the same CSS I have services configured to respond to HTTP sessions. I tried the following script and everything went well
Socket connect host 192.168.136.151 port 80 tcp
Socket send ${SOCKET} HEAD /index.html\n\n
Socket waitfor ${SOCKET} 200 2000
Socket disconnect ${SOCKET} graceful
When I issued the socket inspect command I could in fact see the sockets internal data buffer content.
The CSS is running WebNS 5.0 build 66
Can someone give me a help?
Thanks,
Ricardo LourençoHello,
There is no direct no direct link between TCP and SSL.
So, in spite of having success with the TCP port 443 connection the CSS will not be able to negotiate de security parameters necessary to establish the SSL session.
This was the reason for not having success through the use of the socket commands, as i refered in my original message.
Thanks for your collaboration,
Ricardo Lourenço -
I have a class that when run as a "main" transmits a HTTP/1.1 post successfully
to an external server. This external server requires keep-alive connections.
However when instantiated inside a weblogic servlet container, the post fails
because the HTTP protocol is set to HTTP/1.0. I have tried this with V5.1 SP11
and then with V6.1 SP2 with the same result. The code works under Tomcat.
I can find no way to force HTTP/1.1 in the URLConnection. Any suggestions?
Great. I have a question to BEA folks, if they ever read this newsgroup:
what is the reason for installing WLS protocol handlers, and, if there is
one, why the implementation is still buggy? I saw many, many instances when
code making outgoing connections failed to work in WLS, and the solution is
always the same - use handler which comes with the JVM.
Bob Bowman <[email protected]> wrote:
> <[email protected]> wrote:
>>If it works as a standalone application and fails inside WebLogic, most
>>likely this
>>is caused by WebLogic http handler implementation. You can try to modify
>>your code
>>like this:
>>
>>URL url = new URL(null, "http://some_url", new sun.net.www.protocol.http.Handler());
>>HttpURLConnection conn = (HttpURLConnection)url.openConnection();
>>
>>(you will need to modify weblogic.policy to allow your code to specify
>>protocol
>>handler).
>>
>>Bob Bowman <[email protected]> wrote:
>>
>>> I have a class that when run as a "main" transmits a HTTP/1.1 post
>>successfully
>>> to an external server. This external server requires keep-alive connections.
>>> However when instantiated inside a weblogic servlet container, the
>>post fails
>>> because the HTTP protocol is set to HTTP/1.0. I have tried this with
>>V5.1 SP11
>>> and then with V6.1 SP2 with the same result. The code works under
>>Tomcat.
>>
>>> I can find no way to force HTTP/1.1 in the URLConnection. Any suggestions?
>>
>>--
>>Dimitri
> Worked like a champ! Thanks.
Dimitri
-
How do I change the http connection type from close to keep-alive
I am using a browser that appears as though it needs a connection type of keep-alive. When a page is requested the server sends back a connection type of close. It appears images are not requested from the server when this connection type is requested.
Some older web server provides inaccurate content-length information.If the content length value is less than the amount of data,the web server treats the difference as a new request, this creates problem with iplanet Web Server.
If you are using browser with HTTP1.1 enabled, choose the option to enable it manually and try once again by posting the request.
Hope it helps. -
HTTP persistent connection (keep Alive) problem
Hi,
I'm trying to deploy a RPC web service and I would like to use the HTTP 1.1 keep alive feature (which should be the default).
I generated the server side and client side code using jdev 903. The AS is OC4j 903.
The problem is that the server is sending a âConnection: close:â header in the SOAP response, despite the client sending a âConnection: keep-aliveâ header in the request. This is obviously causing the client to close the connection and open another for the next message.
The documentation implies that the server will always try to use persistent connections, even so, in the file:
<OC4J_HOME>/j2ee/home/config/http-web-site.xml
there is a config option âuse-keep-alivesâ. Setting this to true has no effect.
Iâm guessing there must be another option somewhere to turn on connection persistence.
Can anyone please help ?Does anyone know whether Oracle Supports persistent connections ?
I tested this on JBOSS and I seems to get better performance.
cheers. -
Hi!
I'm trying to register a SIP Trunk to a SIP server. The trunk registration is done, but not keep alive. The trunk register with SIP server when an outgoing call starts, but when this call ends, the SIP trunk closes the connection with SIP server. Then, the
outgoing calls work OK, but the incoming calls doesn't work because the SIP Trunk is unregistered while no active outgoing calls.
Then, can i keep alive the SIP Trunk registration with SIP Server?
Thanks!!!You need to talk to the SIP provider and get them enable OPTIONS on the SIP Trunk and enable OPTIONS on the PSTN Gateway. Check the registration interval of the SIP trunk on the Gateway and try increasing it to a higher value.
http://thamaraw.com -
How to keep alive a session in Web Services?
I have to do my project, that will be including some following features:
1. Login to Application through Web Services method. For example:
http://mydomain.com/web-services/Login?WSDL
2. After logging in, use mySms method to send message to Cellphone through Web Services! For example:
http://mydomain.com/web-services/mySms?WSDL
My questions are:
1. How can I keep alive the session after logging in the application in Web Services? In Web, I can use "Session".
2. If someone has not logged in the Application, he/she could not use mySms method for sending Sms. How can I do that?
3. I know, when I invoke a Web Services, one JavaBean has been called, and this bean is persistence with his own states. It means, if I set value to parameters of this bean, these values are persistence for invoked methods by other persons.
For example:
mySms bean has a private field "jid" inited with NULL value.
Person A invoked mySms.
Then, A set jid of mySms to value "A".
Person B invoked mySms. B got jid value. He receive the result value is "A".
The question is, how can I set mySms bean so that mySms bean is not persistence?
Thanks many!Hi,
I can right away answer your FIRST Question.
Since WebServices are PURELY Based on SOAP which is in tern based on HTTP, they rely on a Stateless protocol.
I am sure you know that the HTTP is the STATELESS Protocol and so you can not maintain Session and so EACH Http REQUEST is considered as a SEPERATE REQUEST.
Now, still you want to maintain the Session in WebServices,
The simple answer is PASSING PARAMETERS.
Just Maintain your Session on Client (If you are using JSPs or Servlets to CAll WEBSERVICES then maintain Session through your HTTPSession) and each time you Invoke WebService PASS ON REQUIRED Parameters.
This Approach is Exactly like your URL REWriting OR your Parameters Passing through QUERY STRINGS.
I hope you got what I am saying!
Take care,
Himanshu/ -
Weblogic proxy plugin closes keep-alive connections to clients randomly
In short we have following arhitecture:
clients ---> wl proxy plugin 1 ----> weblogic 1
clients ---> wl proxy plugin 2 ----> weblogic 2
Beacuse of the application/installation specific requirements, we are not using failover, one wl proxy always forwards requests to one weblogic (simple configuration).
Application is TR-069 protocol based (SOAP over HTTP) so it very much relays on persistence TCP connections (Connection: keep-alive). This TCP persistence has to work correctly in order that TR-069 messages are exchanged in required order, otherwise we have a error on application layer.
Here and there we've noticed applications errors which suggest that we have some problems in TCP connection between the client and the weblogic server. After sniffing, we've noticed that weblogic proxy plugin (Apache) randomly, or because of some other reason we do not know, decides to close TCP connection to client, even app on weblogic did not request so ???
As a result, client opens new connection to the server with new TR-069 session and it gets bounced beacuse it allready has one open on weblogic server.
We've sniffed, traced everything we could, we were searching for patterns in time, etc... but we can not find the reason why proxy plugin decides to close the connection to the client (not to the weblogic server).
Trace (replaced sensitive information):
Thu Apr 29 15:05:50 2010 <958012725463463784> URL::parseHeaders: CompleteStatusLine set to [HTTP/1.1 200 OK]
Thu Apr 29 15:05:50 2010 <958012725463463784> URL::parseHeaders: StatusLine set to [200 OK]
Thu Apr 29 15:05:50 2010 <958012725463463784> parsed all headers OK
Thu Apr 29 15:05:50 2010 <958012725463463784> sendResponse() : r->status = '200'
Thu Apr 29 15:05:50 2010 <958012725463463784> canRecycle: conn=1 status=200 isKA=1 clen=545 isCTE=0
Thu Apr 29 15:05:50 2010 <958012725463463784> closeConn: pooling for '$IP$/$PORT$'
Thu Apr 29 15:05:50 2010 <958012725463463784> request [$URL$] processed successfully..................
!!!! Now it closes the TCP connection and inserts "Connection: close" HTTP header !!!
WL proxy plugin conf params are:
WebLogicCluster $IP$:$PORT$
DynamicServerList OFF
KeepAliveTimeout 90
MaxKeepAliveRequests 0
KeepAliveSecs 55
Apache worker configuration is:
<IfModule mpm_worker_module>
PidFile var/run/httpd-worker.pid
LockFile var/run/accept-worker.lock
StartServers 2
MinSpareThreads 25
MaxSpareThreads 75
ThreadLimit 200
ThreadsPerChild 200
MaxClients 2000
MaxRequestsPerChild 0
AcceptMutex pthread
</IfModule>
Why weblogic proxy plugin ignores Keep-alive directive and decides to close connection to the client by itself?
Any help?If a WebLogic Server instance listed in either the WebLogicCluster parameter or a dynamic cluster list returned from WebLogic Server fails, the failed server is marked as "bad" and the plug-in attempts to connect to the next server in the list.
MaxSkipTime sets the amount of time after which the plug-in will retry the server marked as "bad." The plug-in attempts to connect to a new server in the list each time a unique request is received (that is, a request without a cookie).
Note: The MaxSkips parameter has been deprecated as the MaxSkipTime parameter.
See also here: http://download-llnw.oracle.com/docs/cd/E13222_01/wls/docs81/plugins/plugin_params.html
You said the problem arises under significant load. Maybe, it is wise to tune the number file descriptor's on your operating system. HTTP connections are nothing more than TCP sockets on the operating system. All modern operating systems treat sockets as a specialized form of file access and use data structures called file descriptors to track open sockets and files for an operating system process. To control resource usage for processes on the machine, the operating system restricts the number of open file descriptors per process. You should be aware that all TCP connections that have been gracefully closed by an application will go into what is known as the TIME_WAIT state before being discarded by the operating system.
On most unix systems you can use netstat -a | grep TIME_WAIT | wc -l to detemine the number of socket in time_wait state. You have to check with your system adminstrator how to tune the tcp_time_wait_interval. On solaris you can use: /usr/sbin/ndd -set /dev/tcp tcp_time_wait_interval 60000 -
Changing Default "Keep Alive" & " Max Processing Time" values in SMICM
Dear Experts
As you aware the default values in SMICM --> Go to --> Services The default values "Keep Alive" & " Max Processing Time" of services like HTTP & HTTPS is 30 sec & 60 seconds respectively.
Every times when we restart application server - we are increasing the time values manually. once we restart they will be reset to original 30 & 60 sec respectively.
I want to make customozed values permanently which should not be lost even after restart of application server.
Please Help
Regards
PRIf you have not set the PROCTIMEOUT parameter, TIMEOUT (or icm/keepalive_timeout) defines both the processing timeout and the keepalive timeout. Also, as of release 6.40, the keepalive timeout is limited to a maximum of 30 seconds.
In a system where the default timeout settings of 30 seconds for the keepalive timeout and the processing timeout are not sufficient because of long-running applications, we recommend that you set the TIMEOUT and PROCTIMEOUT parameters for the relevant services so that you can configure them independently of each other. In addition, we recommend that you do not set the TIMEOUT value higher than necessary, for example, to the usual default value of 30 seconds.
We recommend, for example, the following settings:
icm/server_port_0 = PROT=HTTP,PORT=1080,TIMEOUT=30,PROCTIMEOUT=600
to allow a maximum processing time of 10 minutes.
Thanks,
Tanuj -
Question about Keep Alive feature in Forte 3.
Does anyone use Keep Alive feature under Forte 3.0F.2 environment.
I got trouble and encounters the following problem in the service objects
daily:
INFORMATION: An abnormal disconnect from partition
(CFFE2500-85B0-11D1-B37F-E2F7F3F1AA77:0xec254) was received. Since there
are
no method invocations outstanding to this partition, no notification could
be
given of this disconnect (by indicating a method invocation failed).
Therefore, the information associated with this disconnect is being
reported
to the log.
Class: qqsp_DistAccessException
Error #: [601, 119]
INFORMATION: The connection to the partner was terminated by the
Communication Manager for the reasons below.
Class: qqsp_DistAccessException
Detected at: qqdo_PartitionMgr::StopLocation at 1
Error Time: Fri Nov 26 17:45:39
SYSTEM ERROR: Failed to establish connection: OS Error 61: Connection
refused
Class: qqsp_DistAccessException
Detected at: qqcm_HoseFSM::SetError at 5
Error Time: Fri Nov 26 17:45:39
SYSTEM ERROR: hose 15 STATE_CONNECTING (EXT_RECEIVED) from
qqcm_HoseFSM::IssueConnect (after EstablishConnection)
Class: qqsp_ErrorDescriptor
Detected at: qqcm_HoseFSM::SetError at 1
Error Time: Fri Nov 26 17:45:39
It seems that Keep Alive sometimes disconnects the connection between the
service objects and the environmental manager.
So that any further connection request from the client encounters the
abnormal exception.
Forte seems not to recommend to use this feature in the Forte Relase note
3.0J1.
She states that "Sites that chooses to test KeepAlives should report all
problems to Technical Support ( and let
Technical Support know that you have enabled this capability)"
Should I disable Keep Alive feature under Forte 3.0F2 environment?
Rgds
TomHey Marco,
I can`t find a view that is named like "APEX_APPLICATION_PAGE_IR%". Is it not available on the evaluation instance.
I don`t want to use the build-in CSV download, becaus I want to export thousands of data sets. I got this already to work with APEX 3.0 and I get the sql from the application views. The procedure which creates the file runs a few hours and after that it is inserted into a table from which the user can download the file. In the procedure there happens a few other things, which are very import, so I have to create my custom solution.
And for that I thought it would be very very very cool if I can get the sql behind the interactive report with the filters ant those things.
Don`t you think that would be possible? I guess the APEX create a SQL although, or am I wrong?
Thank you,
Tim
Maybe you are looking for
-
How do I sign out of my apple i.d. Using my iPad then sign back n using my other apple I.d? I can't find the option anywhere on my iPad to do this. Anyone know how?
-
Ipod touch is not showing up as a device in itunes, how can I sync it?
Hi just wondering how to sync my ipod touch using itunes - when the ipod will not show up as a device. I am having trouble with the ipod as it is displaying the incorrect date, will not access my email etc. However when I go to sync it (thinking thi
-
How do I move users' home folders to another disk other than boot disk
I would like to move all of my various users' home folders to a different disk. How is this done? Do I need to then have the disk mount before any users log in? If so, how do I mount it?
-
Capital One Logic...
I currently have 2 Capital One accounts. One has a 2k limit and one has a 4.5K limit, both are QS1 cards. I've tried over and over to get CLI's on the cards, but was unsuccessful. I attempted to apply for a new card today (with hopes of card conso
-
Am I overthinking this simple strategy?
Hi all, I've been doing a lot of reading on these forums and finally had the guts to make my first post! I am having a bit of trouble understanding a strategy I keep seeing when it comes to rebuilding your credit. I promise I'm not a dunce, I just ca