When I finished secondary school and started my university studies, I learned C and C++ in first place.
In the second year of my bachelor’s degree, I wanted to build a website for online registration for a hackathon competition I organized with the non-governmental organization YSDA(Young Social Development ). At that time, I had a fundamental knowledge of HTML5, CSS3, JavaScript, PHP, and MVC architecture.
With all that knowledge, I didn’t want to build that website from scratch because we have taken three months during the COVID-19 lockdown to build a school project using PHP, HTML, etc. The things were too slow and repetitive.
I decided to embrace the world of Framework and choose the PHP Framework Symfony to build the website. I followed an excellent YouTube tutorial made by Lior Chamla. In that tutorial, I discovered what REST(Representational State Transfer) was and what it was built for.
It was so pleasant for me to discover REST and the Richardson maturity model for REST, which states a REST API’s maturity level.
After discovering that, REST was for me one of the best technology ever invented. As a newbie developer, I was so naive so I tend to choose REST for any application idea I had in my mind. That’s another story.
In Master 1, we have a course entitled “Middleware for Internet Applications”. We cover a wide range of topics including the evolution of the internet, the rise of web services, XML, RPC, XML-RPC, semantics web, MQTT, Kafka, etc.
During one of our courses talking about RPC(Remote Procedure Call), I asked the lecturer whether with the advent and proliferation of web services and REST, why people can continue to use such an old technology like RPC. Why does the latest version of projects like WordPress still continue to support XML-RPC access to the system instead of just producing REST endpoints? I was so naive and totally wrong about RPC. Before continuing the story, let’s talk a little bit about RPC itself.
What is exactly RPC(Remote Procedure Call)?
RPC(Remote Procedure Call) is in simple terms a protocol that allows one computer program to execute code on a remote computer over a network. His purpose is to enable two different processes running on different machines to communicate with each other.
Here is how RPC works in four steps:
- A client sends a request to a remote server over the network.
- The server receives the request, extracts the relevant information, and executes the requested procedure.
- The server sends a response back to the client with the result of the procedure execution.
- The client receives the response and can continue executing its own code.
To enable this communication, RPC frameworks typically use a protocol to serialize and deserialize data, allowing data to be transmitted over the network in a standardized way. Some popular RPC protocols include JSON-RPC, XML-RPC, and gRPC.
RPC can be used in multiple cases where two or more processes need to communicate with each other over a network. We have for example:
- Remote data access: RPC can be used to enable remote data access in a distributed system. For example, an application can remotely call stored procedures in PostgreSQL using RPC.
- Microservices architecture: RPC can be used in a microservices architecture to enable communication between services. For example, a payment processing service uses RPC to communicate with a customer account management service to verify payment information.
- Mobile applications: RPC can be used to enable communication between mobile applications and remote servers. For example, a Mobile app using JSON-RPC to connect to Odoo Server to fetch customer information.
- Cloud computing: RPC can be used in cloud computing environments to enable communication between virtual machines and cloud services. For example, a cloud-based application might use RPC to communicate with a cloud-based storage service like S3 to retrieve data.
- etc
The rest of the story
In November 2022, I was introduced to Odoo development. I learned that time that Odoo is built using three tiers architecture.
- The presentation tier is Odoo web clients: This tier is responsible for presenting the user interface to the user and helping the user to interact with the entire ERP system to perform operations like billing, etc.
- The application tier is Odoo Server: This tier is responsible for implementing the business logic of the system.
- The data tier is a Postgres database: This tier is responsible for storing and managing all the data used by the system including product information, customer data, invoices, and more.
The thing that shocked me in the first place was discovering that they used RPC(XMP-RPC, JSON-RPC) to ensure communication between the Odoo Web client and Odoo Server. It was unbelievable to me. I asked myself, Why does a modern solution backed by a company of more than 3500 employees and used by roughly seven million users around the world choose to use RPC instead of REST API? I immediately search on the internet to know why but didn’t find an acceptable answer.
In February 2023 while navigating on YouTube, I watched a video where one Spotify engineer explained why they move from their own RPC protocol “Hermes“ to gRPC and why they did that. it was during KubeCon + CloudNativeCon 2020 events in Amsterdam. After that, I start my interest in system design and microservice architecture.
Everything became clear at that time, RPC was not an old technology. All big companies like Google, Netflix, Spotify, Slack, Microsoft, etc. used RPC, especially gRPC backed now by Cloud Native Computing Foundation to make their system works and support billions of users around the world. I was naive to suppose RPC was an old technology and was dead by the way without deeper knowledge and research about it.
Lessons I learned
I am a junior developer and I shouldn’t suppose anything based on my small experience. Everything is system design and every technology has a place in computer science for a specific use case. Maybe certain multi-billion companies in the world still use COBOL as a requirement for their system. I should always document myself well on every technology I encounter and learn its advantages, and drawbacks, and in which case to use them.
Wrapping up
I hope you appreciated this story about my naivety in front of RPC technology. If you like the type of content I am sharing, consider subscribing to my newsletter to don’t miss any content I pop out. Thanks for reading.
I am a Master’s student in computer science passionate about DevOps, Cloud Computing, AI, and BI. I am also a web developer, especially with Django and Laravel Frameworks. I love to share things that work for me with others to save them time searching through the internet to solve the same problem.