Wtf is RPC?

Wtf is RPC?

Remote procedure call.

Introduction

I've heard the word RPC, Remote Procedure Call, several times now.

I never knew what it was, so decided to dive into it.

To understand a concept, I like to take a step back and focus on the problem first.

This makes it easier to comprehend the concept.

Remote Procedure Call

The problem

Imagine a company has several departments, each with its own set of applications and data.

For instance, the sales department has a sales application, the HR department has a human resources management system, and so on. To work effectively together, these applications need to share information and functionality.

Challenges the company faces:

  1. Communication: Different applications need to communicate with each other efficiently.

  2. Scalability: As the company grows, the number of applications and the need for interaction between them also grows.

  3. Maintaining Data Consistency: Ensuring that data shared across various applications remains consistent.

  4. Complexity in Integration: Each application might be built using different technologies, making integration complex.

The solution

RPC solves these challenges by enabling different applications to communicate with each other as if they were local calls within the same system.

From the user's perspective, when invoking RPCs, it's as if they're invoking local functions.

  1. Solving the communication problem: With RPC, an application in one department can easily call a procedure in an application of another department. It's like one application saying to another, "Hey, please execute this function and give me the result" as if the function was part of its own codebase.

  2. Scalability: RPC provides a standard way of communication, making it easier to add new services without major changes to existing ones.

  3. Ensuring Data Consistency: When one application updates information, it can immediately inform other applications through an RPC call.

  4. Reducing Complexity in Integration: RPC abstracts the complexity of network communication. Developers don't have to write complex code to handle network protocols, data serialization, etc. They can just call remote procedures as if they were local.

Conclusion

RPCs are good when you need multiple different kinds of systems to work with each other.