简体   繁体   English

如何配置JMeter始终使用新的SSL会话ID?

[英]How to configure JMeter to always use a new SSL session id?

I am trying to benchmark SSL handshakes per second using a variety of tools, JMeter included. 我正在尝试使用包括JMeter在内的各种工具对SSL握手进行每秒基准测试。 I have successfully created a test plan that meets my needs except I now want to test how the SSL handshakes per second compare with and without SSL session reuse. 我已经成功创建了一个满足我的需求的测试计划,除了我现在想测试在有和没有SSL会话重用的情况下每秒SSL握手的比较。 As I understand, by default Java has an unlimited size SSL session cache and entries expire after 24 hours. 据我了解,默认情况下Java具有无限大小的SSL会话缓存,并且条目会在24小时后过期。

I've tried using the JMeter properties "https.use.cached.ssl.context" and "https.sessioncontext.shared", but even when these properties are false it doesn't meet my needs. 我尝试使用JMeter属性“ https.use.cached.ssl.context”和“ https.sessioncontext.shared”,但是即使这些属性为false,也不能满足我的需求。 When both are false, the first HTTPS request in the thread uses a new session id, but each HTTPS request after that in the thread reuses a session id. 当两者均为false时,线程中的第一个HTTPS请求使用一个新的会话ID,但是线程中之后的每个HTTPS请求都重用一个会话ID。 Even if I set the undocumented Java property "javax.net.ssl.sessionCacheSize" to 1 to only allow one SSL session ID to be cached, if I have 10 threads making a total of 5 HTTP requests each, I see 10 new SSL session negotiated, and 40 SSL sessions reused (verified with ssldump and STunnel logs). 即使我将未公开说明的Java属性“ javax.net.ssl.sessionCacheSize”设置为1,以仅允许缓存一个SSL会话ID,但是如果我有10个线程,每个线程总共发出5个HTTP请求,我会看到10个新的SSL会话协商,并重新使用40个SSL会话(已通过ssldump和STunnel日志进行验证)。

Is it possible through JMeter or Java to have every HTTPS request use a new SSL session id? 是否可以通过JMeter或Java让每个HTTPS请求使用新的SSL会话ID?

This works: 这有效:

  • https.use.cached.ssl.context=false is set in user.properties 在user.properties中设置了https.use.cached.ssl.context = false
  • AND use either HTTPClient 3.1 or 4 implementations for HTTP Request 使用任一了HTTPClient 3.1或4实现为HTTP请求

EDIT (after Kaelen comment): Setting the https.use.cached.ssl.context property to false (with HTTPClient 3.1/4) does work, the only tricky part is that the SSL session context only gets reset at the end of an iteration of the Thread Group . 编辑(在Kaelen注释之后):将https.use.cached.ssl.context属性设置为false(使用HTTPClient 3.1 / 4)确实有效,唯一棘手的部分是SSL会话上下文仅在迭代结束时重置线程组的 In the test plan the thread group did not iterate, there was an infinite loop inside the group that ran until a # of requests occurred. 在测试计划中,线程组未进行迭代,该组内部一直运行着无限循环,直到发生#个请求为止。 Because the thread group never iterated, the SSL context wasn't reset. 由于线程组从不进行迭代,因此未重置SSL上下文。

In this case remove the Loop inside Thread Group and configure number of iterations in Thread Group. 在这种情况下,请删除“线程组内部的循环”并在“线程组”中配置迭代次数。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM