Does JMeter pool HTTP connections?

后端 未结 2 1678
北恋
北恋 2021-01-04 19:51

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 c

2条回答
  •  再見小時候
    2021-01-04 20:10

    Update for JMeter 3: in your HTTPSampler configuration you can use the entries

     true
     10
    

    to specify connection pool size according to this Code-Snippet (from http://svn.apache.org/viewvc/jmeter/tags/v3_0/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java?view=markup line 785ff)

          if(this.testElement.isConcurrentDwn()) {
                try {
                    int maxConcurrentDownloads = Integer.parseInt(this.testElement.getConcurrentPool());
                        connManager.setDefaultMaxPerRoute(Math.max(maxConcurrentDownloads, connManager.getDefaultMaxPerRoute()));                
                    } catch (NumberFormatException nfe) {
                       // no need to log -> will be done by the sampler
                    }
                }
           }
    

    The configuration via JMeter UI is a bit quirky:

    switch the HTTP Sampler Configuration View to "Advanced", tick "Retrieve all embedded resources", then "Parallel Downloads" and enter a number. You may untick "Retrieve all embedded resources" after that if you don't want JMeter to parse your responses for images

提交回复
热议问题