在jmeter发送http请求时,Implementation下拉框中有几个选项,如下:
那到底有什么区别呢?发送http请求改用哪种方法呢。百度后查之,没答案。我们还是看官方文档吧。官方文档解释如下:
- HTTP Request - this has an implementation drop-down box, which selects the HTTP protocol implementation to be used:
- Java - uses the HTTP implementation provided by the JVM. This has some limitations in comparison with the HttpClient implementations - see below.
- HTTPClient3.1 - uses Apache Commons HttpClient 3.1. This is no longer being developed, and support for this may be dropped in a future JMeter release.
- HTTPClient4 - uses Apache HttpComponents HttpClient 4.x.
- Blank Value - does not set implementation on HTTP Samplers, so relies on HTTP Request Defaults if present or on jmeter.httpsampler property defined in jmeter.properties
The Java HTTP implementation has some limitations:
- There is no control over how connections are re-used. When a connection is released by JMeter, it may or may not be re-used by the same thread.
- The API is best suited to single-threaded usage - various settings are defined via system properties, and therefore apply to all connections.
- There is a bug in the handling of HTTPS via a Proxy (the CONNECT is not handled correctly). See Java bugs 6226610 and 6208335.
- It does not support virtual hosts.
- It does not support the following methods: COPY, LOCK, MKCOL, MOVE, PATCH, PROPFIND, PROPPATCH, UNLOCK, REPORT, MKCALENDAR.
- It does not support client based certificate testing with Keystore Config.
来吧。照顾下英文不太好的同学,大致解释下:
有四个选项,不同的区别如下:
Java:使用的http是使用的JAVA JVM提供的方法,有相关的限制,限制见后面解释
HTTPClient3.1:使用Apache HttpClient 3.1部件,已不再开发了,在jmeter以后的版本中可能会不使用
HttpClient4.1:使用Apache HttpClient 4.1部件
空白:使用HTTP默认请求中的配置或jmeter.properties中jmeter.httpsample中的配置
Java请求的限制:
连接如何重用在请求中没有控制;当jmeter释放了一个请求后,在同样的进程中可能不会再使用了
只使用于单进程模式
HTTPS代理请求有两个bug没存在
不支持虚拟主机
不支持相关的方法
不支持存储证书的请求.
参考:http://jmeter.apache.org/usermanual/component_reference.html