DISTRIBUTED SYSTEM
CHAPTER 10 : CASE STUDY
LAB WORK SOLUTION- DISTRIBUTED SYSTEM
DISTRIBUTED SYSTEM -BCA -ALL SLIDES
MCQ- DISTRIBUTED SYSTEM

REMOTE PROCEDURE CALL

Remote Procedure Call (RPC) is a powerful technique in distributed systems that allows a program to cause a procedure to execute on another address space (commonly on another physical machine) as if it were a local procedure call, without the programmer explicitly coding the details for this remote interaction.

Components of RPC

  1. Client-Server:
    • Client: The entity that invokes the remote procedure.
    • Server: The entity that implements the remote procedure.
  2. Stubs:
    • Client Stub: Acts as a proxy for the client, responsible for marshalling the procedure parameters and sending them over the network to the server.
    • Server Stub: Receives the request, unmarshals the parameters, and invokes the actual procedure on the server.
  3. Marshalling and Unmarshalling:
    • Marshalling: The process of converting the procedure parameters into a format that can be transmitted over the network.
    • Unmarshalling: The process of converting the received data back into the original parameters.

Working of RPC

  1. Client Call: The client program calls the client stub as if it were a local procedure.
  2. Marshalling: The client stub marshals the procedure parameters into a message.
  3. Send Request: The client stub sends the marshalled message to the server over the network.
  4. Receive Request: The server stub receives the message and unmarshals the parameters.
  5. Execute Procedure: The server stub calls the actual procedure with the received parameters.
  6. Return Response: The server stub marshals the result and sends it back to the client.
  7. Receive Response: The client stub receives the response, unmarshals it, and returns it to the client application.

Advantages of RPC

  1. Simplicity: Abstracts the complexity of network communication, making remote interactions look like local procedure calls.
  2. Transparency: Provides location transparency, where the client does not need to know the physical location of the server.
  3. Modularity: Encourages modularity and separation of concerns by clearly defining client and server responsibilities.

Challenges and Design Issues

  1. Latency and Performance: Network communication introduces latency compared to local calls. Efficient data marshalling and minimizing the number of remote calls can help mitigate this.
  2. Error Handling: Remote calls are prone to various errors like network failures, server crashes, and timeouts. Robust error handling and retry mechanisms are essential.
  3. Security: Ensuring secure communication over potentially insecure networks involves implementing authentication, authorization, and encryption.
  4. Scalability: Handling a large number of concurrent clients requires load balancing, efficient resource management, and possibly replication of services.

Modern Implementations and Variants

  1. gRPC: A high-performance, open-source RPC framework developed by Google. It uses HTTP/2 for transport, Protocol Buffers (protobuf) for interface definition, and supports multiple languages.
  2. Apache Thrift: A framework for scalable cross-language services development, which includes a software stack and a code generation engine to build services that work efficiently and seamlessly between various programming languages.
  3. JSON-RPC and XML-RPC: Protocols using JSON and XML respectively for encoding messages, making them language-agnostic and suitable for web-based services.