Tuesday 11 April 2023

java.lang.runtime exception unable to resolve service by in working protec:unable to execute protoc binary

java.lang.runtime exception unable to resolve service by in working protec:unable to execute protoc binary



If your Jmeter script throws this error for gRPC script it could be related to the protocol buffer (protobuf) binary file not being found or not being able to execute it. To resolve this error, follow these steps:

  • Make sure that protobuf is installed on your system and the binary file is available in the PATH environment variable.
  • Check the JMeter log files for more information about the error, such as the exact path to the protoc binary file.
  • Verify that the protoc binary file is executable by running the following command in a terminal: 
  • 'chmod +x path/to/protoc'
  • If the protoc binary file is not available on your system, download it from the official protobuf website and add the binary file to the PATH environment variable.
  • Check JMeter and gRPC versions
  • Restart JMeter and try running your test plan again.

gRPC vs. REST API

  • RESTful APIs and gRPC have significant differences in terms of their underlying technology, data format, and API contract requirements.
  • Unlike RESTful APIs that use HTTP/1.1, gRPC is built on top of the newer and more efficient HTTP/2 protocol. This allows for faster communication and reduced latency, making gRPC ideal for high-performance applications.
  • Another key difference is in the way data is serialized. gRPC uses Protocol Buffers, a binary format that is more compact and efficient compared to the text-based JSON format used by REST. This makes gRPC more suitable for applications with large payloads and high traffic volume.
  • In terms of API contract requirements, gRPC is more strict than REST. The API contract must be clearly defined in the proto file, which serves as the single source of truth for the API. On the other hand, REST's API contract is often looser and more flexible, although it can be defined using OpenAPI.

Overall, both RESTful APIs and gRPC have their strengths and weaknesses, and the choice between the two will depend on the specific needs of the application.

How to create a gRPC script with Jmeter? Jmeter-gRPC protocol load testing

To create a gRPC script with JMeter,

  • Install the gRPC plugin for JMeter. You can find the plugin on the JMeter Plugins website or you can download it using the Plugin Manager in JMeter.
Download the latest version of plug-in from here
  • Create a new Test Plan in JMeter and add a Thread Group.
  • Add a gRPC Sampler to the Thread Group. To do this, right-click on the Thread Group and select "Add > Sampler > gRPC Sampler".
  • Configure the gRPC Sampler. You will need to provide the following information:

  • Server address:  The address of the gRPC server you want to test.
    Service name: The name of the gRPC service you want to test.
    Method name: The name of the method you want to call.
    Request data: The data you want to send to the gRPC server.
    Proto Root Directory: It is the Root Directory path (till protoc only)
    Library Directory: This is the library directory path if any( this is optional)
    Full method: this should be auto populated when you click on the Listing Button
    Optional configuration: Authorization details if any
    Send JSON format with the Request: Your JSON request
  • Add any necessary configuration elements or assertions to the Test Plan.
  • Run the Test Plan and analyze the results.

what is gRPC?

gRPC is an open-source, high-performance, universal Remote Procedure Call (RPC) framework that allows different applications and services to communicate with each other over a network. It was developed by Google and is now maintained by the Cloud Native Computing Foundation (CNCF).



The gRPC framework is a powerful tool for developing APIs that can handle a high volume of traffic while maintaining performance. It is widely adopted by leading companies to support various use cases, ranging from microservices to web, mobile, and IoT applications.

One of the key features of gRPC is its use of Protobuf (Protocol Buffers) as an Interface Definition Language (IDL) to define data structures and function contracts in a structured format using .proto files. This makes it easier to create and manage APIs while ensuring consistency and compatibility across different platforms and languages.

gRPC uses the Protocol Buffers data format for serializing structured data over the network. It supports multiple programming languages, including C++, Java, Python, Ruby, Go, Node.js, C#, and Objective-C.

gRPC provides a simple and efficient way to define remote procedures and their parameters using an Interface Definition Language (IDL). It generates client and server code automatically based on this IDL specification. The generated code handles all the networking details, allowing developers to focus on the business logic of their applications.

One of the key benefits of gRPC is its high performance. It uses HTTP/2 as its transport protocol, which provides features such as multiplexing, flow control, and header compression, resulting in lower latency and reduced bandwidth usage. Additionally, gRPC supports bi-directional streaming and flow control, making it suitable for building real-time applications.