CampusLearn
← CSC 413 Distributed Systems

Distributed Architectures and Remote Communication

Notes

Introduction to Distributed Systems and Architectures A distributed system consists of autonomous computing entities that communicate over a network and coordinate their actions by exchanging messages to appear as a single coherent facility. The primary motivations for distributing systems include resource sharing, scalability, fault tolerance, and concurrency. In architectural design, distributed systems range from traditional client-server paradigms to peer-to-peer frameworks and modern distributed microservices. Middleware and Remote Communication Middleware serves as a translation layer sitting above the operating system and network protocols, shielding developers from the heterogeneous nature of distributed hardware and operating systems. Key communication mechanisms in middleware include Remote Procedure Calls (RPC) and Remote Method Invocations (RMI). In RPC, a client invokes a stub that marshals parameters into a network-safe payload, transmits it via transport protocols, and awaits the unmarshaled return value from the server skeleton. Challenges such as network latency, network failure, packet loss, and semantic idempotency must be addressed. Key Architectural Models Layered architecture separates concerns into presentation, application, and persistence tiers. Service-Oriented Architecture (SOA) and microservices break down logic into decoupled, discoverable units interacting via language-agnostic interfaces. In message-oriented middleware, asynchronous message queues provide decoupling in both time and space, enabling high throughput. Practical example Consider the integration between the Safaricom Daraja M-Pesa platform and an e-commerce retailer in Nairobi. When a customer initiates a Lipa Na M-Pesa Online checkout, the retailer server executes a Remote Procedure Call to the Daraja gateway. The client stub packages the merchant shortcode, amount, and customer phone number into an encrypted JSON payload. Because cellular network connections across Kenyan telcos experience sporadic latency or intermittent packet loss, the call cannot rely on simple synchronous blocking RPC without strict timeout policies. The Daraja middleware uses an asynchronous callback pattern. Safaricom acknowledges the initial RPC with a transaction request ID, processes the STK push on the customer mobile device, and later issues an HTTP POST callback to the merchant endpoint. Idempotency keys prevent duplicate payments if the merchant server re-transmits the request during a network timeout along the Nairobi-Mombasa backbone fiber cable.

Quiz

1. Why are idempotency keys critical when communicating with payment gateways like Safaricom Daraja?

2. Which architectural model provides complete decoupling of communicating entities across both time and space?

3. What is the primary role of a client stub in a Remote Procedure Call (RPC) implementation?

Sign in to submit and securely grade your quiz.