Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
486 views
in Technique[技术] by (71.8m points)

java - Does JMeter pool HTTP connections?

I know when using the built-in Java HTTP client in a JMeter HTTP Request sampler connections may or may not be pooled, depending on the JVM implementation and configuration.

However, does JMeter pool connections when using HttpClient3.1 or HttpClient4?

There are some hints in the JMeter documentation that it may, but nothing in the documentation definitively states it.

If it does, is there a way to control the connection pool? For example, can you set the size of the pool?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

JMeter does some pooling of HTTP connections when using HttpClient3.1 or HttpClient4.

In both cases, connections are pooled per-thread. Connections are NOT shared across threads.

When using HttpClient3.1, JMeter uses an instance of SimpleHttpConnectionManager on each thread.

When using HttpClient4, JMeter uses an instance of a subclass of PoolingClientConnectionManager on each thread, and it uses PoolingClientConnectonManager's default settings (2 connections per route, and 20 maximum connections).

JMeter does not provide a mechanism for controlling the parameters of the connection pools.

I had to go to JMeter's source code to find this answer. See the following links for reference (the 2.13 tagged code):

Note: this answer is accurate for JMeter 2.13. The answer may be different for other versions of JMeter.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...