← Back to Blog
Systems Architecture

Go vs Java and gRPC vs REST: A Comprehensive Empirical Study

By Luiz Soares
2024-12-1212 min read
📰

An in-depth overview of my empirical research comparing Go and Java programming languages with gRPC and REST communication architectures for API performance optimization.

APIs (Application Programming Interfaces) play a crucial role in modern software development, facilitating integration and communication between different software systems and platforms. They enable greater modularity, scalability, and code reuse across the industry. In the usual practice adopted by software factories, HTTPS protocol is used to facilitate communication and data transfer on the Internet, while the REST architectural style organizes and accesses web services in a standardized manner.

This empirical study was born from a fundamental question: how do our choices of programming language and communication architecture truly impact API performance? While Java and REST have been the industry standard for years, the rise of Go and gRPC—both championed by Google—promised significant improvements in efficiency and latency.

The study employed rigorous statistical procedures to quantify the improvements offered by different technology combinations. Starting from the premise that Java is a well-established language in the market, just as REST is almost always adopted as the standard communication architectural style, we investigated which combination provides the best efficiency.

We built four distinct implementations of the same application: Go+gRPC, Go+REST, Java+gRPC, and Java+REST. Each implementation exposed a single endpoint that receives a set of numbers and returns three elements at random positions. This deliberately simplified methodology was adopted to isolate and precisely quantify the impact of both the programming language and communication architectural style on overall system performance.

Two payload sizes were tested throughout the experiment. The 'StdSize' payload comprised an array of 200 integers with random values between 0 and 1000, totaling approximately 0.76 KB—representative of the average size of HTTP requests commonly observed in web applications. The 'LargeSize' payload was designed to be exactly 1024 times larger, reaching approximately 781 KB, to test performance under extreme load conditions.

The experimental environment was carefully configured to minimize experimental error: an Intel Core i7 9th generation with 16 GB RAM, running Ubuntu Server with minimal installation, ensuring no other applications interfered with the tests. For Java, we used Tomcat 10.1.8 for REST implementation and gRPC Netty 1.56.1 for gRPC. Go already has built-in HTTP serving functionality in the net/http package, which was used for both implementations.

The key findings were remarkable: gRPC dominates on standard payloads, REST dominates on large payloads, and most surprisingly—the communication architectural style weighs far more heavily than the programming language choice, accounting for approximately 94% of performance variation.

#Go#Java#gRPC#REST#APIs#Research
LS

About Luiz Soares

Full-Stack TechLead specializing in AI products, RAG systems, and LLM integrations. Passionate about building scalable solutions and sharing knowledge with the tech community.

Get in touch →