Does the Java HTTP connection pool have an eviction time? Can it be installed?

The HTTP HTTP connection pool for persistent connections is described in http://download.oracle.com/javase/6/docs/technotes/guides/net/http-keepalive.html . However, there is no indication that connections are always unloaded from the cache if they are not reused, and if so, what is the length of the timeout.

The only link to this I found the following comments http://www.java.net/forum/topic/performance/general-performance-discussion/reusing-socket-connections-httpurlconnection-0 :

"supported live sockets are timeout. If the server sends a timeout in the HTTP header, then this timeout value is used. Otherwise, the timeout is only 5 seconds, after which the socket will not be reused [...] Unfortunately, you cannot set a timeout, it is hardware in the bowels of the implementation.

If true, this explains some of the odd behavior that we see, and I wrote a small test case that seems to confirm this. (Using Java 1.6.20 for Windows.)

Does anyone know of any documentation on this? In addition, a comment for several years. Is the timeout still hard-coded or can it be set?

+3
source share
1 answer

. ( , API) . AFAICT , , - keep-alive .

Java 7 , . java 6, , . , keepalive, :

java -Dhttp.keepalive=false ...

:

java -Dhttp.maxConnections=1 ...

System.setProperty(), .

, , , , -?

+1
source

Source: https://habr.com/ru/post/1792590/


All Articles