A short summary of Comm. in Dist. Systems Part C
RMI Semantics and Failures
Q1: How does RMI behave when no failures occur?
When everything works correctly, Remote Method Invocation (RMI)
behaves exactly like a local method call. The client invokes a
remote method transparently and receives the result as if the
object were local.
Q2: What types of failures are considered in RMI?
The RMI omission failure model considers:
- Lost request messages
- Lost reply messages
- Server crashes
- Client crashes
Messages are either delivered correctly or lost, and processes
either execute correctly or crash.
Q3: How are lost request messages handled in RMI?
The client starts a timer when sending a request. If the timer
expires before a reply or acknowledgment is received, the client
resends the request.
Q4: Why are duplicate requests a problem?
If a request is not actually lost but delayed, the server may
receive it more than once. This can cause the server to execute
the same operation multiple times, leading to incorrect behavior.
Q5: How does the server handle duplicate requests?
Each request is assigned a unique identifier.
- If a duplicate arrives before the reply is sent, the server resends the reply.
- If it arrives after the reply was sent, the server uses history to resend the stored reply.
Q6: What is an idempotent operation?
An idempotent operation can be executed multiple times without
changing the final system state.
Examples:
- setName("Alice")
- deleteFile("A.txt")
- HTTP PUT
Q7: What is a non-idempotent operation and why is it dangerous?
Non-idempotent operations change system state every time they are
executed.
Examples:
- withdrawMoney(100)
- createUser("Ali")
- HTTP POST
Executing them multiple times may lead to incorrect results.
Q8: How can exactly-once semantics be achieved for message loss?
Exactly-once semantics can be achieved by:
- Resending requests until a reply is received
- Filtering duplicate requests
- Maintaining a history (log) of executed requests and replies
Q9: Why can exactly-once semantics not be guaranteed with server crashes?
If a server crashes after executing an operation but before
sending the reply, and loses memory on restart, it cannot know
whether the operation was already executed.
Direct vs Indirect Communication
Q10: What is direct communication?
In direct communication, the sender knows the identity and address
of the receiver and sends messages directly.
Examples include HTTP client-server communication and TCP sockets.
Q11: What is indirect communication?
Indirect communication uses an intermediary. The sender does not
need to know the identity of the receiver.
It provides space and time decoupling.
Group Communication
Q12: What is group communication?
Group communication allows a sender to send a message to a group
of receivers in a single operation, rather than sending separate
messages.
Q13: Why is group communication useful?
It is useful for:
- Fault tolerance through replication
- Service discovery
- Managing replicated data
- Interest groups and mailing lists
Publish–Subscribe Systems
Q14: What is a publish–subscribe system?
Publishers generate events, and subscribers receive only the
events they are interested in through a notification service.
Publishers and subscribers are decoupled.
Q15: What is the role of the notification service?
The notification service stores subscriptions, receives events
from publishers, and dispatches notifications to interested
subscribers.
Web Services
Q16: Why are RPCs not suitable for web-scale systems?
RPCs use arbitrary ports, are often platform-dependent, were
designed for LANs, and do not handle scalability, latency, or
statelessness well.
Q17: What are the core principles of web services?
Web services are platform-independent, use standard protocols
(HTTP), text-based data formats (XML/JSON), tolerate high latency,
and support large numbers of clients.
Q18: Compare SOAP-based web services and RESTful web services?
- SOAP: XML-based, uses WSDL, strict standards, heavier messages
- REST: Uses HTTP verbs, JSON, lightweight, stateless, easier to scale
Q19: What is the difference between SOA and Microservices?
- SOA: Coarse-grained services, shared database, SOAP-based communication
- Microservices: Fine-grained services, independent databases, REST-based APIs, independent deployment