jmeter icon indicating copy to clipboard operation
jmeter copied to clipboard

gRPC with jmeter is not working in alpine/jmeter:5.6.3 image

Open PraveenDhasarathan opened this issue 1 year ago • 0 comments

Expected behavior

Jmeter should be able to run the gRPC request sampler inside the image

Actual behavior

Getting a below error: 2025-01-08 10:33:25,530 ERROR v.z.b.GRPCSampler: java.lang.RuntimeException: Unable to resolve service by invoking protoc: Unable to execute protoc binary at vn.zalopay.benchmark.core.ClientCaller.init(ClientCaller.java:88) at vn.zalopay.benchmark.core.ClientCaller.(ClientCaller.java:53) at vn.zalopay.benchmark.GRPCSampler.initGrpcClient(GRPCSampler.java:81) at vn.zalopay.benchmark.GRPCSampler.initGrpcInCurrentThread(GRPCSampler.java:203) at vn.zalopay.benchmark.GRPCSampler.initGrpcRequestSampler(GRPCSampler.java:133) at vn.zalopay.benchmark.GRPCSampler.sample(GRPCSampler.java:90) at org.apache.jmeter.threads.JMeterThread.doSampling(JMeterThread.java:651) at org.apache.jmeter.threads.JMeterThread.executeSamplePackage(JMeterThread.java:570) at org.apache.jmeter.threads.JMeterThread.processSampler(JMeterThread.java:501) at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:268) at java.lang.Thread.run(Thread.java:750)

Steps to reproduce the problem

Create a Docker file: FROM alpine/jmeter:5.6.3 // Copied the below library from my local jmeter 5.6.3 COPY ./lib/jmeter-grpc-request.jar /opt/apache-jmeter-5.6.3/lib/ext/jmeter-grpc-request.jar COPY ./lib/jmeter-plugins-manager-1.10.jar /opt/apache-jmeter-5.6.3/lib/ext/jmeter-plugins-manager-1.10.jar RUN apk add protobuf COPY ./scripts/GRPC_Request.jmx /opt/apache-jmeter-5.6.3/scripts/GRPC_Request.jmx

Docker build command: docker build . -t load-testing:manager-load-testing_v1 --no-cache

Create a proto file: syntax = "proto3";

package com.grpc.spring; option java_package = "com.grpc.spring.service"; option java_outer_classname = "Solutions"; option java_generic_services = true; option java_multiple_files = true;

service SolutionService { rpc getSolution (SolutionRequest) returns (SolutionResponse) {}; }

message SolutionRequest { string name = 1; } message SolutionResponse { string message = 1; }

I created a Jmeter GRPC request sampler using the UI and copied the Jmeter script to an image and used the below command to run the Docker image: docker run -it --entrypoint bash --rm --user root load-testing:manager-load-testing_v1

jmeter -n -t scripts/GRPC_Request.jmx -l result.jtl -JThreads=1 -JRamup=1 -JLoopCount=1 -JprotoFilePath=/opt/apache-jmeter-5.6.3/scripts/test_data -Jhost=host.docker.internal -Jport=9092 -e -o ./dashboard_directory

Note: Same script works in my local JMeter GUI. which has protoc version as local: libprotoc 28.3 but in the Image: libprotoc 24.4

JMeter Version

5.6.3

Java Version

openjdk version "1.8.0_432"

OS Version

Alpine Linux v3.21

PraveenDhasarathan avatar Jan 09 '25 07:01 PraveenDhasarathan