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
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
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
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.
![]() | Empowering the world to design We're hiring, apply here! Check out the latest news and learnings from our team on the Canva Newsroom. |
Hi Team,
Thanks for taking a look. I ran a practical benchmark comparing gRPC (Java) and Java RMI in my environment and I’m seeing an unexpectedly large gap in synchronous call throughput. I’d appreciate your thoughts — whether I’ve missed something in the setup, or if there’s anything I should change in the client/server configuration or test approach.
What I ran (attachments)
I’ve attached two test projects (each contains a README with build/run instructions):
Both are simple sync-call examples intended to reproduce real-world synchronous RPC behavior.
Environment
What I expected
gRPC is generally positioned to provide high-throughput RPCs; I expected synchronous gRPC stubs to be able to achieve much higher calls/sec when server and client run locally.
What I observed
This large difference surprised me — the RMI result is an order of magnitude higher than the gRPC synchronous result on the same machine and roughly the same test semantics.
I expected gRPC to perform much better based on official benchmarks. You can refer to the gRPC benchmark results here:
🔗 https://grafana-dot-grpc-testing.appspot.com/?orgId=1
I’ve shared the gRPC and RMI project folders through the links below. Please review them and let me know your observations.
grpc.helloworld.example.7z: https://drive.google.com/file/d/1adgUszOWfKd-dIEh_rc9q0ApSQb_jUjI/view?usp=drive_link
JavaRmi.7z : https://drive.google.com/file/d/1bf5AR1ZcZcCI_T4NY15h-i3EU6xJnaQL/view?usp=drive_link
I have already verified the setup and followed the official gRPC Java example. Could you please check if there’s anything wrong in my setup or suggest how I can improve the synchronous call performance?
Best regards,
Mansoor
Hi Shubham,
As per your suggestion, I updated the implementation to use ClientCalls.asyncUnaryCall and also tested the execution for 10 seconds instead of 1 second.
Below are the results:
Server
Client Issue – OutOfMemoryError
When running the async performance client, I am consistently getting the following error:
java.lang.OutOfMemoryError: Java heap space
What I Observed
Detailed Findings
Thanks,
Mansoor