Understanding Middleware and Multicast
Understanding Middleware and Multicast
Gafat Institute of
Technology
Department of
Computer
Group Assignment
Prepared by:
1
TABLE CONTENT
[Link]………………………….…………………………………….………3
[Link] ………………………………………………………………..……..…..4
[Link]…………………………………………………………………………………7
[Link] To A Server…………………………………………………………………..…..9
[Link] Systems………….………………………………………………..20
[Link] Browser………………………………………………………………23
[Link]……………………………………………………………..……….24
2
Acknowledgment
We express our sincere gratitude to Debre Tabor University and the Department of
Computer Science for their guidance and support in our exploration of distributed
systems.
We also thank our peers for their collaborative efforts and insightful discussions that
enriched our understanding of the subject matter.
3
Abstract
Distributed systems play a crucial role in modern computing, enabling the efficient
and reliable coordination of resources and tasks across multiple nodes. This document
explores fundamental concepts related to distributed systems, including middleware,
multicast communication, asynchronous and synchronous remote procedure calls, and
connectionless communication. The aim is to provide clarity on these topics through
detailed analysis and practical examples, focusing on how these mechanisms enhance
scalability, efficiency, and fault tolerance in distributed environments. Additionally,
practical challenges such as location resolution, clock synchronization, and
coordinator failures are discussed, along with solutions to address them, emphasizing
the need for robust designs in dependable systems.
4
1, Briefly explain, what is middle ware? Why we need it?
5
1.1Why Do We Need Middle ware?
1,Simplifies Communication:- Middle ware provides a standard communication mechanism,
allowing distributed systems or applications on different platforms to communicate
seamlessly without having to manage low-level networking or protocol details.
3,Scalability:- Middle ware supports the scalability of applications by offering features like
load balancing, message routing, and fault tolerance, which are essential when handling
growing numbers of users or distributed nodes.
4,Reliability and Fault Tolerance:- Middle ware often includes mechanisms for ensuring
reliability in communication, such as retrying failed messages or managing transactional
consistency, so distributed systems can continue operating smoothly even in the face of errors
or crashes.
5,Security:- Middle ware can provide security features like authentication, encryption, and
access control, helping to protect data and ensure that only authorized users or systems can
access sensitive resources.
7,Abstraction and Simplification:- Middle ware abstracts low-level networking and system
details, enabling developers to focus on application logic rather than dealing with complex
communication protocols or infrastructure challenges.
6
2,What is multicast? Why we need it in distributed system?
What is Multicast?
Multicast is a method of communication in networking where data is sent from a source to
multiple recipients (or "listeners") in a network.
Unlike unicast, where data is sent from a single source to a single recipient, multicast allows
the source to send a single copy of the data to multiple recipients at once.
Figure 2: multicasting
Minimized Bandwidth Usage: Without multicast, if you wanted to send the same
data to multiple recipients (e.g., thousands of clients), you would need to send a
separate copy of the data to each client (unicast). This results in high bandwidth usage
and network congestion. With multicast, a single message is sent to the multicast
group, and the network infrastructure efficiently replicates and forwards it to all the
group members.
Reduced Redundancy: It reduces the redundancy of sending the same data over and
over again to each receiver, improving network efficiency.
2. Scalability
7
transmission to multiple clients simultaneously, making the system more scalable and
reducing the load on the source system.
Less Overhead for the Source: Multicast reduces the load on the source because it
doesn't need to manage individual connections for each recipient, which is especially
important in systems where large numbers of clients need to be served concurrently.
3. Réal-Time Communication
Live Streaming & Multimedia: Multicast is ideal for applications requiring real-
time communication, such as live streaming, conferencing, or broadcasting. For
example, in a video conferencing system or live sports broadcast, multicast allows the
source (e.g., the video server) to send a stream to multiple viewers in real-time
without overloading the network.
Low Latency: The ability to transmit data to multiple receivers simultaneously with
low latency is crucial for many real-time distributed applications like gaming, VoIP,
and multimedia broadcasting.
4. Group Communication
5. Cost Efficiency
Less Load on Network Infrastructure: Multicast reduces the load on routers and
network infrastructure since it avoids sending duplicate copies of data across the
same network segments. This can save resources for both the sender and the network.
Cost-Effective for Broadcasting: Multicast is often cheaper in terms of both
bandwidth and computation for scenarios where information needs to be broadcast to
many recipients (e.g., system updates or media distribution).
8
3, assume a client calls an asynchronous RPC to a server, and
subsequently waits until the server returns a result using another
asynchronous RPC. Is this approach the same as letting the client
execute a normal RPC? What if we replace the asynchronous RPCs
with asynchronous R PCs?
To better understand the difference, let’s break it down into two parts: the first scenario where
the client calls asynchronous R PCs, and the second scenario where the client executes normal
R PCs.
When the client calls an asynchronous RPC, it sends the request to the server and does not
block or wait for the response immediately. Instead, it proceeds with other operations (such as
executing other R PCs, handling other tasks, or waiting for responses). However, in your
scenario, after calling an asynchronous RPC to the server, the client waits for the server's
result via another asynchronous RPC.
Although the client is using asynchronous R PCs for both calls, the fact that it waits for the
result in the second asynchronous call introduces a blocking behaviour, making the client wait
for the result of the server's operation. The key point here is that even though the R PCs are
asynchronous, the client essentially becomes blocked waiting for the result of the second
RPC. So, in this case, the client still ends up waiting (blocking) for the response in the end.
In a normal RPC, the client sends a request to the server and waits (blocks) for the server to
return the response. This blocking behaviour happens within the normal synchronous flow,
meaning the client is paused until the result is returned from the server.
Comparison:
Asynchronous R PCs in Scenario 1: While the client uses asynchronous R PCs, it waits
for the result of the server’s response after the second asynchronous call, which
introduces blocking behaviour. It behaves similarly to a synchronous RPC in terms of
waiting for the result.
Normal (Synchronous) R PCs in Scenario 2: The client calls a synchronous RPC and
waits for the result. It’s a simple blocking call, and there’s no expectation for the client to
proceed with other tasks while waiting.
In conclusion, if the client waits for the result of an asynchronous RPC in a similar way to
how it would block in a synchronous RPC, then the overall behaviour between the two
approaches is essentially the same. The client waits for the response in both cases, making the
distinction between asynchronous and synchronous R PCs somewhat irrelevant in this
specific situation.
9
4,Describe how connection-less communication between a client and
a server proceeds when using sockets.
In connection-less communication, the client and server communicate without establishing a
persistent connection, and each message (or data gram) is sent independently. This is typically
implemented using UDP (User Data-gram Protocol), which is a connection-less transport
protocol. The key idea is that messages can be sent and received without the need for a formal
handshake or maintaining a continuous connection between the client and the server.
The client uses a socket to send data to the server. The socket is configured to use
UDP, which does not require establishing a connection.
The client prepares the data and packages it into a data-gram (a self-contained,
independent packet of information).
The server also uses a socket, which is configured for receiving UDP messages.
The server’s socket is set to listen for incoming data-grams using the recvfrom()
system call (or a similar function). This socket does not need to be explicitly
connected to a remote address, as it simply receives incoming data-grams.
The server does not maintain an active connection with the client. Instead, it waits for
each incoming data-gram, processes it, and then may send a response back to the
client if necessary.
If the server needs to reply to the client, it packages the response in a new data-gram
and sends it back to the client using the send to() call.
The server must know the client's address and port, which were typically included in
the data-gram received from the client.
The client receives the response in the form of a data-gram, which might contain a
message from the server or other data.
Once the client receives the message, it processes it and may send further messages
(or terminate the communication).
5. Stateless Nature:-
Both the client and the server do not retain state about each other. There’s no
established session or connection that persists across multiple messages.
Each message is independent, and there’s no concept of "establishing" or "closing"
the connection in the traditional sense (as with TCP).
This connection-less model is often used in applications that prioritize speed over reliability
(such as real-time video/audio streaming, DNS queries, and simple message broadcasts),
where the occasional loss of packets is acceptable.
10
5,Give an example of where an address of an entity E needs
to be further resolved into another address to actually access
E
1. The browser sends a query to a DNS server to resolve the domain name into
an IP address.
2. The DNS server replies with the IP address (e.g., [Link]) corresponding to
[Link].
The IP address is used to establish a connection to the server over the internet.
In this example:
Entity E is the web server hosting the website (represented by its domain name,
[Link]).
The domain name needs to be resolved into an IP address (such as [Link]) before
the actual network communication (accessing the web server) can happen.
This illustrates how a higher-level address (a domain name) must be resolved into a lower-
level address (an IP address) to enable access to the actual entity (the web server).
11
6,. In a hierarchical location service with a depth of k, how
many location records need to be updated at most when a
mobile entity changes its location?
In a hierarchical location service, the mobile entity’s location is typically stored at different
levels in the hierarchy, with each level representing a different scope of coverage (e.g.,
country, region, city, building, etc..). When a mobile entity changes its location, the location
records must be updated to reflect the new position at different levels of the hierarchy.
When a mobile entity moves, the location information must be updated at several levels in the
hierarchy, starting from the lowest level (where the entity's precise location is stored) up to
the highest level (which represents a more general location scope).
At each level in the hierarchy, the system needs to update the location of the entity. This
means that if the mobile entity moves to a new location, it will trigger updates at every
level above it, starting from the lowest level and moving upwards.
At level 0 (the root of the hierarchy), the mobile entity’s location will be stored or
referenced in some record. At each intermediate level, a reference to the entity's location
is updated, and at the lowest level (the most granular level), the exact location of the
entity will be recorded.
Thus, if the hierarchy has a depth of k, the entity's location will be updated at k levels (one
update per level).
Conclusion:-The maximum number of location records that need to be updated when a mobile
entity changes its location in a hierarchical location service with a depth of k is k.
12
7,Explain how DNS can be used to implement a home-based
approach to locating mobile hosts.
In a home-based approach to locating mobile hosts, a mobile device (host) registers its
location with a home server that serves as its home agent.
The idea is that the mobile host always appears to be at the same location (its "home
address"), regardless of where it physically moves within the network.
When the mobile host changes its physical location, this change needs to be communicated so
that other devices can still reach it.
Key Concepts:
Mobile Host (MH): The device whose location is being tracked as it moves between
different networks.
Home Agent (HA): A server (or DNS service) that knows the "home" address of the
mobile host, where the mobile host's information is kept.
Home Network: The network that contains the mobile host's "home" address or entry
point in the system.
Current Location (Care-of Address): The real-time IP address of the mobile host,
which changes as it moves to different networks.
DNS (Domain Name System): A system for mapping domain names (such as
[Link]) to IP addresses, and vice versa.
The mobile host initially has a static, permanent identifier (e.g., mobile-
[Link]) assigned by the home network. This is the mobile host's home
address.
When the mobile host moves to a new network, it obtains a new care-of address (COA),
which is the IP address in the current network.
The mobile host communicates with its home agent (via a DNS server) to update its
location information.
The mobile host updates its DNS record to associate its home address (mobile-
[Link]) with the new care-of address (the IP address in the current network).
This is done by sending a DNS update or query to the home DNS server.
When another device (e.g., a user or service trying to reach the mobile host) wants to
communicate with the mobile host, it performs a DNS lookup for mobile-
[Link].
The DNS system will resolve this domain name to the current care-of address (the IP
address where the mobile host is currently located), which was updated previously.
13
4,Forwarding Messages:-
Once the DNS resolution returns the correct care-of address, the message is sent to the
mobile host's current location.
If necessary, the home agent or the DNS server could forward the message to the correct
network (if the host’s IP address is not directly reachable).
5,Consistent Identification:
Despite the mobile host moving, it always uses the same home address (mobile-
[Link]). The home agent keeps track of the current care-of address and
ensures that the DNS system reflects this update.
This approach allows the mobile host to appear stationary to external parties, even
though its actual physical location may change frequently.
Conclusion:- By using DNS in a home-based approach to locating mobile hosts, the mobile
host can maintain a consistent, permanent identifier (home address) while seamlessly
updating its location (care-of address) as it moves between networks. DNS ensures that
messages are routed to the correct location without requiring external users or devices to track
or adjust to the host’s changing physical address. This provides the mobile host with mobility
while retaining a stable identity for communication.
14
8 ,Name at least three sources of delay that can be
introduced between WWV broadcasting the time and the
processors in a distributed system setting their internal
clocks
There are several sources of delay that can be introduced between WWV broadcasting the
time and processors in a distributed system setting their internal clocks. Here are at least
three:
1,Propagation Delay:- The time it takes for the WWV signal (radio waves) to travel from the
WWV transmitter to the receiver. This delay depends on the distance between the receiver
and the WWV broadcast source, and is typically on the order of milliseconds.
2,Signal Processing and Reception Delay:- The time taken by the receiver hardware to
process the incoming WWV signal, extract the time data, and convert it into a usable format.
This processing can introduce delays, depending on the receiver's hardware and software
capabilities.
3,Network Latency:- If the time signal is being relayed over a network (e.g., via a networked
time protocol like NTP), there will be additional delays due to the time it takes for the signal
to travel across the network to the distributed system’s processors. This can be influenced by
factors like network congestion, routing, and the physical distance between systems.
These delays can combine and lead to discrepancies between the actual time broadcast by
15
9 , Consider the behaviour of two machines in a distributed system.
Both have clocks that are supposed to tick 1000 times per
millisecond. One of them actually does, but the other ticks only 990
times per millisecond. If UTC updates come in once a minute, what is
the maximum clock skew that will occur?
To understand the maximum clock skew between the two machines, let’s break it down:
Machine 1 ticks 1000 times per millisecond, which is the expected behaviour.
Machine 2 ticks 990 times per millisecond, which means it is running 1% slower
than Machine 1.
If UTC updates come in once a minute, each update occurs every 60,000 milliseconds (1
minute).
Step 1: Calculate the number of ticks per minute for each machine
Machine 1
Since Machine 1 ticks 1000 times per millisecond, in one minute (60,000 milliseconds), the
number of ticks is:-
Machine 2
Since Machine 2 ticks 990 times per millisecond, in one minute (60,000 milliseconds), the
number of ticks is:-
The difference in ticks between Machine 1 and Machine 2 in one minute is:-
Each tick represents one microsecond (1 ms / 1000), so the time difference corresponding to
600,000 ticks is:-
Conclusion:The maximum clock skew between the two machines after one minute is 600
milliseconds
16
10,. Suppose that the coordinator crashes. Does this always
bring the system down? If not, under what circumstances
does this happen? Is there any way to avoid the problem and
make the system able to tolerate coordinator crashes?
In a distributed system, the crash of a coordinator does not necessarily bring the entire system
down. The impact of a coordinator crash depends on how the system is designed and the
specific role of the coordinator. Let's break this down:
No, it does not always bring the system down. The system can continue to function if
it is designed to handle coordinator failures gracefully.
If the coordinator is responsible for tasks like leader election, coordination of
resources, or managing requests, its failure might impact ongoing operations.
However, if the system has mechanisms in place for fail-over or recovery, it may
continue working.
2. Under what circumstances does the crash bring the system down?
Single Point of Failure: The coordinator is the sole entity responsible for critical
decisions, and there are no fall-back mechanisms. In this case, the failure of the
coordinator can stop the system from making progress.
No Redundancy: If there is no replica or backup coordinator that can take over the role,
the system might halt until the coordinator is restored.
3. Can the problem be avoided and make the system tolerate coordinator crashes?
Yes, the system can be designed to tolerate coordinator crashes. Here are a few strategies to
achieve that:
17
11, Explain in your own words what the main reason is for
actually considering weak consistency models.
the group member try to reflect their own idea but with regard this all the group
member agreed on :- the main reason for considering weak consistency models is to
make the system faster and able to handle more users. When you try to keep everything
perfectly consistent all the time, it can slow down the system a lot because every part of
it has to check and update the data all the time. This takes a lot of time and resources.
With weak consistency, the system doesn’t worry about being perfectly up-to-date at
every moment. This means it can be quicker and still keep working well even when
there’s a lot of traffic or when some parts of the system aren’t connected. The data might
not always be the same everywhere right away, but it usually gets there eventually.
So, weak consistency is useful when it's more important to have better performance and
keep the system running smoothly even if data isn’t always completely consistent at the
same time.
Replication in DNS happens through a system of distributed servers that store copies of the
DNS records.
1,Primary and Secondary DNS Servers:- A domain’s DNS information (like A records,
MX records, etc..) is usually stored in a primary DNS server. This primary server is
responsible for holding the authoritative record for that domain. secondary DNS servers
(which are replicas of the primary server) are also set up to store the same information. These
secondary servers regularly query the primary server to synchronize their data and ensure that
they have the latest version of the records.
2,TTL (Time to Live):- DNS records have a TTL value, which tells DNS resolvers how long
they can cache the record before they need to query the authoritative servers again. This
ensures that DNS records can be replicated across various servers around the world without
needing immediate updates every time a change is made.
3,Hierarchical Structure:- DNS operates in a hierarchical structure, with root servers at the
top, followed by top-level domain (TLD) servers, and then authoritative servers for individual
domains. Replication occurs at various levels in this hierarchy, allowing for a distributed and
scalable way to serve DNS requests.
18
12.1 Why DNS replication works so well:
Redundancy:- By having multiple DNS servers spread across different locations
(primary and secondary servers), the system is fault-tolerant. If one server goes down,
another can take over, ensuring continuous service.
Scalability:- DNS replication allows the system to handle millions of requests by
distributing the load across different servers around the world. This makes it much
more scalable.
Fault tolerance:- If one DNS server is slow or down, DNS resolvers will attempt to
query other servers in the network, ensuring that DNS queries still get answered even
during server failures or network issues.
Caching:- The TTL mechanism reduces the number of queries that need to be made
to authoritative servers, improving performance and reducing the load on the primary
DNS servers.
When discussing consistency models in distributed systems, a contract between the software
(application) and the data store (database) is essential because it defines the expectations and
guarantees of how data is handled, especially in terms of consistency, availability, and
partition tolerance (the CAP theorem).
1,Clear Expectations: The contract establishes clear rules about how data will be read,
written, and synchronized. For example, will the system use strong consistency (where all
nodes have the same data at the same time) or eventual consistency (where data will
eventually be consistent, but not immediately)? This clarity helps developers design
applications that can work reliably under the given model.
2,Consistency Guarantees: The contract helps define the level of consistency that the system
provides. In distributed systems, different consistency models (like linearisability, causal
consistency, or eventual consistency) affect how data is accessed and updated. The contract
ensures that the system and the software agree on which consistency model to implement, so
that developers know what behaviour to expect when interacting with the data store.
3,Error Handling and Recovery: The contract also specifies what happens in case of
failures, such as network partitions or crashes. For example, with eventual consistency, the
system might tolerate temporary inconsistencies but ensure eventual convergence. The
contract defines how the system should handle these situations, giving developers a
predictable way to manage errors and system failures.
In summary, a contract between the software and the data store is needed to set expectations
about data consistency, availability, and fault tolerance. It helps manage the complexity of
19
distributed systems and ensures that both the application and the data store operate in
harmony according to predefined rules and guarantees.
A dependable system must ensure that only authorized users can access its resources and data.
If an attacker gains unauthorized access, they can compromise the system's integrity, leading
to failures, data corruption, or denial of service. For instance, a financial transaction system
needs to ensure that only legitimate users can make transactions. Without security measures
like authentication and authorization, the system becomes vulnerable to malicious actors.
Dependable systems must preserve the integrity of the data they process and store. Security
mechanisms, such as encryption, access control, and data validation, protect data from being
altered or corrupted by malicious users or software. If a system is not secure, attackers can
tamper with data, causing errors that could undermine the system’s functionality or lead to
incorrect decisions.
Security also plays a critical role in ensuring availability, which is a core component of
dependability. A system that is not secure is susceptible to denial-of-service (Dos) attacks,
where an attacker floods the system with requests to exhaust resources and make the system
unavailable. If security measures are not in place to prevent or mitigate such attacks, the
system could fail to provide services when needed.
Malicious users or attackers may exploit vulnerabilities in a system, either through direct
attacks or by causing the system to behave in unintended ways. A dependable system must
have strong security measures in place to detect and defend against these threats, ensuring that
even in the presence of malicious behaviour, the system remains functional and trustworthy.
Security adds to the system’s resilience against attacks that could otherwise cause it to fail.
For example, ensuring confidentiality through encryption ensures that sensitive information is
protected even if the system is compromised. Integrity checks, audit logs, and other security
features ensure that if an attack does occur, it can be detected, and the system can recover
quickly without catastrophic consequences.
20
6. Trustworthiness:-
The trust that users, organizations, and customers place in a system is directly tied to its
security. If users believe that their data, privacy, and transactions are at risk, they will not
trust the system. A dependable system, therefore, needs to have strong security measures in
place to maintain that trust and ensure its continued operation and reputation.
14, What makes the fail-stop model in the case of crash failures so difficult to
implement?
The fail-stop model in the case of crash failures assumes that when a component (e.g., a
server or process) crashes, it halts its operation and stops entirely, providing a clear indication
of failure. While this model simplifies fault detection, implementing it in practice is difficult
due to several challenges:
3. Failure Propagation
21
Cascading Failures: In a distributed system, one component’s crash might cause others
to fail, either directly (e.g., through resource exhaustion) or indirectly (e.g., through
missed communications or cascading errors). The fail-stop model assumes that failure is
isolated to the crashed component, but in reality, a failure in one part of the system can
cause a ripple effect, making it harder to handle crash recovery.
Lack of Isolation: Properly isolating failure to the crashed component and ensuring that
other components continue to function normally is difficult. In practice, ensuring that the
failure of one component doesn't affect others can require significant redundancy, fault
tolerance, and careful architectural design.
22
15, Consider a Web browser that returns an outdated cached page
instead of a more recent one that had been updated at the server. Is
this a failure, and if so, what kind of failure? Can the model of triple
modular redundancy described in the text handle Byzantine failures?
1. Is this a failure?
Yes, this situation can be considered a failure, though it depends on the context and the
expectations for the system. In the case of a web browser returning an outdated cached page
instead of a more recent one that has been updated on the server, this could be classified as a
consistency failure. The browser is supposed to provide the most up-to-date content, but
instead, it returns outdated information from its cache, which violates the expectation of
freshness and correctness of the data.
However, this failure could also be seen as a performance issue (e.g., because the browser
didn't properly check if the cached version was up-to-date) or a timeliness failure (where the
browser failed to get the latest data in time, but it isn't necessarily corrupted data).
2. Can the model of triple modular redundancy (TMR) handle Byzantine failures?
Triple Modular Redundancy (TMR) is a fault-tolerant technique that involves creating three
replicas of a system and using a majority voting mechanism to determine the correct output.
The basic idea is that if one component fails, the other two can still provide the correct result.
However, TMR has limitations in handling certain types of failures.
Byzantine Failures:-
A Byzantine failure occurs when a system component (such as a server, node, or process)
exhibits arbitrary or malicious behaviour, potentially providing incorrect, inconsistent, or
conflicting information to other parts of the system. These failures are more complex than
simple crashes, as the component may still be "alive" and operational but behave
unpredictably or maliciously.
TMR and Byzantine failures: TMR can tolerate crash failures, where one component
stops functioning altogether. However, Byzantine failures are more problematic for TMR
because TMR assumes that the faulty components will still behave in a predictable way
(just producing incorrect results or outputs), not arbitrary or malicious behaviour. If all
three components in a TMR system are compromised (for example, if they all serve
incorrect or conflicting data), TMR may not be able to distinguish between valid and
invalid outputs, as the majority voting mechanism might still return an incorrect result.
Handling Byzantine failures: To handle Byzantine failures, a more advanced technique
is needed, such as the Byzantine Fault Tolerance (BFT) algorithm. BFT systems can
tolerate malicious or arbitrary failures by using complex protocols that ensure that a
correct result can still be achieved, even if some components are behaving in a Byzantine
manner. BFT typically requires more than three replicas (often more than five) and
complex algorithms to reach a consensus despite the presence of faulty components.
23
References
[Link], G., Dollimore, J., Kindberg, T., & Blair, G. (2011). Distributed
Systems: Concepts and Design (5th ed.). Addison-Wesley.
…. THANK YOU …
24