Backend Development 6 min read

Understanding Why Spring Cloud Uses HTTP for Remote Calls Instead of RPC

This article explains how Spring Cloud leverages HTTP via an embedded Tomcat container for flexible, cross‑platform microservice communication, contrasts it with TCP‑based RPC's serialization requirements, and outlines the advantages, disadvantages, and selection criteria for each approach.

Java Architect Essentials
Java Architect Essentials
Java Architect Essentials
Understanding Why Spring Cloud Uses HTTP for Remote Calls Instead of RPC

Spring Cloud services are built on an embedded Tomcat container that handles HTTP requests, allowing developers to exchange JSON data flexibly across platforms, which suits microservice architectures where a single server may serve H5, app, and mini‑program clients.

In contrast, RPC relies on TCP, requiring a three‑way handshake and binary serialization, making it less adaptable for frequently changing data structures and more suitable for stable, low‑level communication.

The article also explains the basics of socket connections, describing client and server sockets and the three‑step connection process (listen, request, confirm).

A simple Java HTTP server example demonstrates how browsers request URLs and receive HTML responses over HTTP.

Remote Procedure Call (RPC) is defined as a method for inter‑process communication that abstracts the details of remote invocation, allowing code to call functions on another machine as if they were local.

Key differences between RPC and HTTP/RESTful services are highlighted: RPC aims to make remote calls look like local calls and requires API‑level encapsulation, while HTTP offers more flexibility, language‑agnostic communication, and easier implementation.

The article lists advantages (RPC transparency, HTTP flexibility) and disadvantages (RPC’s need for API encapsulation), and provides guidance on choosing between them based on speed, complexity, and flexibility.

Future trends point toward microservice architectures that favor HTTP‑based RESTful services due to their independence and autonomy.

microservicesbackend developmentRPCHTTPRESTfulSpring Cloud
Java Architect Essentials
Written by

Java Architect Essentials

Committed to sharing quality articles and tutorials to help Java programmers progress from junior to mid-level to senior architect. We curate high-quality learning resources, interview questions, videos, and projects from across the internet to help you systematically improve your Java architecture skills. Follow and reply '1024' to get Java programming resources. Learn together, grow together.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.