Performance Concern: High Latency and Low Throughput in gRPC Java Setup

147 views
Skip to first unread message

Mansoor Shaik

unread,
Oct 16, 2025, 9:10:21 AMOct 16
to grpc.io

Hello gRPC Team,


I hope you are doing well.

I am currently working on evaluating gRPC Java performance as part of a sample setup, and I wanted to share an issue I’m facing that seems performance-related.

 

I have implemented a minimal gRPC server and client setup using Java + Maven, following the official example provided on the gRPC Java documentation site( https://grpc.io/docs/languages/java/quickstart/The build and execution both complete successfully — however, the observed performance is much lower than expected.

 

When I run the server and client locally on the same machine, I notice that in one second, the client can only perform around 200–500 gRPC synchronous calls using synchronous stubs. I expected much higher throughput, given that gRPC is designed to provide significant performance benefits compared to RMI-based APIs.

 

As a comparison, when I tested a Java RMI-based setup under similar conditions, benchmark results it achieved 7,684 calls per second

 

I’ve ensured that the implementation strictly follows the example code, including .proto generation and Maven dependency configuration.

Below are the technical details and the steps I’ve already verified:

 

 Environment Details

  • Language: Java
  • Build Tool: Maven
  • Framework: gRPC Java (sample from official documentation)
  • Java Version: 24
  • Operating System: Windows 11
  • Hardware: 8 GB RAM, Intel i5 Processor

Kannan Jayaprakasam

unread,
Oct 22, 2025, 2:16:13 AMOct 22
to grpc.io
Are you reusing the ManagedChannel for making all the RPC's or recreating it for each RPC? Reusing the channel is the way to go since the connections don't need to be reestablished.

Mansoor Shaik

unread,
Oct 22, 2025, 10:13:55 AMOct 22
to grpc.io

Dear gRPC Team,

I hope you are doing well.

I am testing gRPC Java performance using the official HelloWorld example (Maven-based) from the gRPC GitHub repository:

🔗 https://grpc.io/docs/languages/java/quickstart/

The project runs correctly, and I made a small modification in the client code to measure how many RPC calls can be executed within 1 second — just to check the performance benchmark.

 

Setup Details

  • Language: Java
  • Java Version: 24
  • Build Tool: Maven
  • IDE: Spring Tool Suite (STS)
  • Operating System: Windows 11
  • Memory Allocation: 64 MB each (client and server)
  • Connection: localhost

 

Modification

I modified the client to run a simple loop that repeatedly calls sayHello() for 1 second and counts the total number of RPCs executed.

Below is the modified section of the code in the client:

 

long startTime = System.currentTimeMillis();
int callCount = 0;

while (System.currentTimeMillis() - startTime < 1000) {
    blockingStub.sayHello(request);
    callCount++;
}

long maxMem = Runtime.getRuntime().maxMemory() / (1024 * 1024);
System.out.println("In 1 second, gRPC method called " + callCount +
                   " times, allocated memory = " + maxMem + " MB");

Everything else in the project (server and client) is the same as the official gRPC example.

 

Result

  • gRPC Java: 200–500 calls/second


I have attached performance client file, please review it.. HelloWorldPerformaceClient

Mohammad Emran

unread,
Oct 23, 2025, 12:33:42 AMOct 23
to Mansoor Shaik, grpc.io
Hi,
What is the benchmark result by ghz benchmark tool? 


On 22 Oct, 2025, at 8:13 PM, Mansoor Shaik <shaikman...@gmail.com> wrote:


--
You received this message because you are subscribed to the Google Groups "grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email to grpc-io+u...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/grpc-io/c8c7daf8-d3fd-45c1-9ae2-6bc79baa973fn%40googlegroups.com.

Adam Lazur

unread,
Oct 24, 2025, 11:59:49 AMOct 24
to grpc.io
The JVM needs time to warm up. 1 second is hilariously short for a performance test. In some not-so-serous benchmarking I warm up the JVM for 120s, then run a few minutes of load to let things normalize.

You could probably use multiple connections from client to server, unless you're looking for a blocking single connection test?

There are probably other things to tweak or tune, but posting code snippets isn't a great way to allow someone to help. I'd recommend posting a full example to github.

.laz

Empowering the world to design
We're hiring, apply hereCheck out the latest news and learnings from our team on the Canva Newsroom.
  https://www.linkedin.com/company/canva https://instagram.com/canva

Shubham Raj

unread,
10:43 AM (5 hours ago) 10:43 AM
to grpc.io
You are making the sync call. Is is possible for you to try ClientCalls.asyncUnaryCall and share the result. I anticipate the result will be much better.

 Also instead of 1sec, can we do for 10 second and then divide the result by 10. I would be happy to discuss with you further on these details.

Thanks,
Shubham Raj

Reply all
Reply to author
Forward
0 new messages