I have a test plan with the mix of normal HTTP samplers and JSR223 samplers. JSR223 I use to execute requests via protobuf protocol and HTTP samplers for simple GET/POST requests.
During a test via SSL protocol, we have discovered a huge load on the Nginx due big amount of SSL handshakes provided by JSR223 samplers. The problem was that I created a new HTTPClient in every request:
CloseableHttpClient client = HttpClients.createDefault();
I fixed it with creation only one instance of this client on initial stage and reusage of it in every JSR223 sampler:
CloseableHttpClient client = vars.getObject("client");
So, now we have the situation when every thread is using two HTTPClients (one is using by HTTPSampler, one by JSR223). And the question is there any way to get the HTTPClient from the HTTPSampler to use it further in JSR223 to avoid double handshakes and so on.
Looks like HTTPSamplers are transferring savedClient between each other during a test.