jmeter-grpc-request icon indicating copy to clipboard operation
jmeter-grpc-request copied to clipboard

Request to set Latency for requests initiated from external jars

Open Ram1014-git opened this issue 1 year ago • 0 comments

Hello Team, I have a use case to do a performance test for a java-grpc application as below.

The java-GRPC application, has provision to set the properties like URL’s, channels, port etc. Also, we are using two jars for this test. We have packaged the application in a jar file and a second jar file which is a consolidated jar including all the grpc related dependencies (Excluding “jmeter-grpc-request”. This is excluded because it has conflicts if used along with the consolidated jar which contains jars: grpc-protobuf, grpc-stub, grpc-api, grpc-netty-shaded, grpc-client-spring-boot-starter, grpc-context, grpc-core, grpc-protobuf-lite, and few other dependencies.) Both these main jars are added to the jmeter lib, and I am able to set these java properties file using groovy from Taurus yaml file.

Sample code snippet provided below: scenario1: protocol: http requests: - url: file:///tmp/emtpyfile.txt #--> as url is a mandatory value, providing a dummy file value as instructed in the support forum. The actual grpc url is set as properties in java jar and invoked by java method call below. jsr223: - execute: before script-file: init.gy #--> this will set the required properties in the application jar file. - loop: 100 do: - url: file:///tmp/emtpyfile.txt jsr223: - execute: after script-text: | def addTwoNumber = vars.getObject("ADD_TWO_NUMBER"); #--> this object is initialised and set in the groovy file, and added to var.putObject for accessing it here. def testResult = addTwoNumber(20,30); #--> This method uses properties (like grpc url, channel, port etc) set above using the init.gy. Performance test result is captured in the kpi.jtl file.

All works fine except the Latency. I am getting the TPS in the report, but Latency is “0”. Seems it is because we are calling emtpyfile.txt locally. Got to know from the support forum that it is because the JMeter gRPC Request  plugin you're using doesn't call SampleResult.setLatency() function anywhere. ”. Yes, as mentioned above, due to conflicts and unknown errors, I am not using jmeter-grpc-request jar. Additionally, as far as jMeter is concerned, its just an http call, hence this jar might not be needed. All grpc related stuffs are handled inside the external jar’s. The reason why we are not using the typical grpc method is because, it doesnt have the provision to set additional properties.

Kindly let me know of any temporary/ permanent fix available for the issue.

Also, it will be good to know, if we can have any option to pass the properties as objects between the scenario’s, so that init.gy can be invoked from a different scenario. (Issue in this example case: If the object value for Channel count set in the groovy is 100, and the number of Thread is 10, a total of 1000 Channels will be created by the system, which is not required.) So, if we can initialise the object from Scenario 1 and able to access it in a scenario 2 which will work in multi thread environment, the same object created can be re-used across the loop calls in Scenario 2.

Request to share you thoughts, ideas, workarounds, here in comments/ email. Thanks a lot in advance.

Ram1014-git avatar Feb 08 '24 13:02 Ram1014-git