Podcast
Questions and Answers
What is the main advantage of weak consistency models compared to strong consistency models?
What is the main advantage of weak consistency models compared to strong consistency models?
- They provide strict isolation between transactions.
- They ensure stronger data integrity.
- They improve scalability and availability. (correct)
- They reduce the complexity of transactional systems.
One-copy serializability is an outdated consistency model rarely used in modern transaction-based systems.
One-copy serializability is an outdated consistency model rarely used in modern transaction-based systems.
True (A)
What property ensures that the outcome of concurrent execution of transactions is equivalent to some sequential execution?
What property ensures that the outcome of concurrent execution of transactions is equivalent to some sequential execution?
Isolation property
Strong consistency models strive to give the illusion of a _______ system.
Strong consistency models strive to give the illusion of a _______ system.
Match the following consistency models with their primary focus:
Match the following consistency models with their primary focus:
What may cause uncertainty in message delivery upon recovery of the server?
What may cause uncertainty in message delivery upon recovery of the server?
A client using receive() with a callback will prevent uncertainty in message delivery.
A client using receive() with a callback will prevent uncertainty in message delivery.
What type of storage does the server use to save in-transit messages?
What type of storage does the server use to save in-transit messages?
The client may use receive()
without a __________ and AUTO_ACKNOWLEDGE.
The client may use receive()
without a __________ and AUTO_ACKNOWLEDGE.
Match the following components with their roles in JMS message delivery:
Match the following components with their roles in JMS message delivery:
What happens to messages upon the failure of the consumer?
What happens to messages upon the failure of the consumer?
Using volatile storage will enhance message delivery reliability.
Using volatile storage will enhance message delivery reliability.
What happens to messages sent from different sessions in JMS queues?
What happens to messages sent from different sessions in JMS queues?
In JMS, messages sent to a topic can be received by multiple subscribers.
In JMS, messages sent to a topic can be received by multiple subscribers.
What is a durable subscription in JMS?
What is a durable subscription in JMS?
In JMS, messages with a later delivery time may be delivered after messages with an __________ delivery time.
In JMS, messages with a later delivery time may be delivered after messages with an __________ delivery time.
Match the following terms with their definitions:
Match the following terms with their definitions:
Which of the following is TRUE regarding message delivery modes in JMS?
Which of the following is TRUE regarding message delivery modes in JMS?
A message selector can affect the order in which messages are delivered in JMS.
A message selector can affect the order in which messages are delivered in JMS.
What is the primary pattern supported by JMS topics?
What is the primary pattern supported by JMS topics?
The setDeliveryDelay method specifies the __________ delivery time for messages.
The setDeliveryDelay method specifies the __________ delivery time for messages.
What will be the result of the command u.snapshot()
after the two writes, u.write(1,5)
and u.write(0, 8)
?
What will be the result of the command u.snapshot()
after the two writes, u.write(1,5)
and u.write(0, 8)
?
The operation write(2,7)
will not affect the read operation read(2)
that follows.
The operation write(2,7)
will not affect the read operation read(2)
that follows.
What is the main topic discussed in the content regarding sequential consistency?
What is the main topic discussed in the content regarding sequential consistency?
Array v after the operations v.write(0,7)
and v.write(1,2)
will result in [___, ___].
Array v after the operations v.write(0,7)
and v.write(1,2)
will result in [___, ___].
Match the following operations with their results:
Match the following operations with their results:
Which of the following commands should precede u.snapshot()
to ensure the snapshot reflects the latest writes?
Which of the following commands should precede u.snapshot()
to ensure the snapshot reflects the latest writes?
Sequential consistency ensures that all operations appear in the order they were issued.
Sequential consistency ensures that all operations appear in the order they were issued.
What does the command v.snapshot()
return after the corresponding writes?
What does the command v.snapshot()
return after the corresponding writes?
In the execution of writes, the ___ operation allows capturing the current state of an array.
In the execution of writes, the ___ operation allows capturing the current state of an array.
After executing write(2, 7)
and read(2)
, what effect does the write have on the subsequent read?
After executing write(2, 7)
and read(2)
, what effect does the write have on the subsequent read?
Which of the following statements about message delivery in JMS is true?
Which of the following statements about message delivery in JMS is true?
JMS guarantees that all messages sent to a topic will be delivered after a subscription is made.
JMS guarantees that all messages sent to a topic will be delivered after a subscription is made.
What is the primary purpose of the JMS API?
What is the primary purpose of the JMS API?
JMS is not a ______ nor does it specify one.
JMS is not a ______ nor does it specify one.
Match the following JMS features with their descriptions:
Match the following JMS features with their descriptions:
Which of the following is NOT supported by JMS?
Which of the following is NOT supported by JMS?
Different JMS clients using various providers can create deployment problems.
Different JMS clients using various providers can create deployment problems.
What does JMS not specify regarding message delivery?
What does JMS not specify regarding message delivery?
The order of delivery of messages in subscriptions may not be the same due to ______.
The order of delivery of messages in subscriptions may not be the same due to ______.
Which of the following is an example of a JMS provider?
Which of the following is an example of a JMS provider?
What will happen when two clients attempt to write to replicas at the same time?
What will happen when two clients attempt to write to replicas at the same time?
When two more or less concurrent write operations occur, replicas may become __________.
When two more or less concurrent write operations occur, replicas may become __________.
What happens when two clients attempt to write to a replica at the same time?
What happens when two clients attempt to write to a replica at the same time?
The naive implementation ensures read-your-writes consistency.
The naive implementation ensures read-your-writes consistency.
What is the main purpose of quorum consensus in a distributed system?
What is the main purpose of quorum consensus in a distributed system?
Quorum consensus requires distinguishing between process failures and communication failures.
Quorum consensus requires distinguishing between process failures and communication failures.
What factor does the availability analysis by Gifford rely on?
What factor does the availability analysis by Gifford rely on?
After a partition heals, each client performs a read and receives different values, indicating that the protocol does not ensure ______.
After a partition heals, each client performs a read and receives different values, indicating that the protocol does not ensure ______.
If the maximum number of replicas that may crash is denoted as f, then the minimum number of replicas required will be ______.
If the maximum number of replicas that may crash is denoted as f, then the minimum number of replicas required will be ______.
Match the scenarios with their outcomes:
Match the scenarios with their outcomes:
Match the concepts related to quorum consensus with their descriptions:
Match the concepts related to quorum consensus with their descriptions:
In the naive implementation, what condition leads to one client successfully writing while another fails?
In the naive implementation, what condition leads to one client successfully writing while another fails?
The naive implementation guarantees the same value will be read by all clients after concurrent writes.
The naive implementation guarantees the same value will be read by all clients after concurrent writes.
What conditions are present when both clients write to replicas at nearly the same time?
What conditions are present when both clients write to replicas at nearly the same time?
What does Dynamo use to enhance high-availability at the cost of strong consistency?
What does Dynamo use to enhance high-availability at the cost of strong consistency?
Each operation in Dynamo requires explicit acknowledgement from all replicas.
Each operation in Dynamo requires explicit acknowledgement from all replicas.
What is the main purpose of the coordinator in Dynamo during get() or put() operations?
What is the main purpose of the coordinator in Dynamo during get() or put() operations?
In Dynamo, each key is associated with a set of servers known as the __________.
In Dynamo, each key is associated with a set of servers known as the __________.
Match the following components of Dynamo with their descriptions:
Match the following components of Dynamo with their descriptions:
What is the main requirement for read and write quorums in a quorum consensus system?
What is the main requirement for read and write quorums in a quorum consensus system?
In quorum consensus protocols, each replica has the same voting power.
In quorum consensus protocols, each replica has the same voting power.
What formula represents the relationship needed between read and write quorums?
What formula represents the relationship needed between read and write quorums?
In quorum consensus, a quorum is a set of ______.
In quorum consensus, a quorum is a set of ______.
Which of the following best explains the concept of quorums in fault tolerance?
Which of the following best explains the concept of quorums in fault tolerance?
Quorum consensus protocols do not need to consider the overlap of quorums for reliable operations.
Quorum consensus protocols do not need to consider the overlap of quorums for reliable operations.
What is the potential benefit of using weighted voting in replica management?
What is the potential benefit of using weighted voting in replica management?
What is a potential problem when using locks in transactions?
What is a potential problem when using locks in transactions?
Two-phase commit guarantees that all transactions will be completed even if a coordinator fails.
Two-phase commit guarantees that all transactions will be completed even if a coordinator fails.
What is the trade-off when proxies are used as coordinators in transaction management?
What is the trade-off when proxies are used as coordinators in transaction management?
Quorum systems require appropriate selection of NR and NW to achieve different trade-offs in __________ and availability.
Quorum systems require appropriate selection of NR and NW to achieve different trade-offs in __________ and availability.
Match the following concurrency control methods with their characteristics:
Match the following concurrency control methods with their characteristics:
What may happen to other transactions while one transaction is waiting for the coordinator to recover?
What may happen to other transactions while one transaction is waiting for the coordinator to recover?
Optimistic concurrency control eliminates the need for locking resources.
Optimistic concurrency control eliminates the need for locking resources.
What is the purpose of choosing appropriate NR and NW in quorum systems?
What is the purpose of choosing appropriate NR and NW in quorum systems?
What is a necessary condition for ensuring that different versions of a data object are updated properly in a distributed system?
What is a necessary condition for ensuring that different versions of a data object are updated properly in a distributed system?
Which operation in a queue raises an exception if the queue is empty?
Which operation in a queue raises an exception if the queue is empty?
In the context of quorums, which of the following represents a non-minimal quorum choice for writing to an object with 5 replicas?
In the context of quorums, which of the following represents a non-minimal quorum choice for writing to an object with 5 replicas?
What is the first step in the process of removing an item from the queue using the Deq operation?
What is the first step in the process of removing an item from the queue using the Deq operation?
Which of these correctly defines the basic operations of a queue?
Which of these correctly defines the basic operations of a queue?
What does the entry t1:[Enq(x);Ok()]
indicate in the execution trace?
What does the entry t1:[Enq(x);Ok()]
indicate in the execution trace?
Which statement best describes the scenario where Deq(): R2, R3
is used?
Which statement best describes the scenario where Deq(): R2, R3
is used?
Which of the following conditions is indicated by the absence of entries in a replica?
Which of the following conditions is indicated by the absence of entries in a replica?
In the context of the replicated queue, what does the term 'replica' refer to?
In the context of the replicated queue, what does the term 'replica' refer to?
What is the outcome when t5:[Deq():Ok(y)]
is executed?
What is the outcome when t5:[Deq():Ok(y)]
is executed?
What is the primary purpose of using timestamps in replicated read/write objects?
What is the primary purpose of using timestamps in replicated read/write objects?
Which best describes the operations involved in the Deq implementation of Herlihy's replicated queue?
Which best describes the operations involved in the Deq implementation of Herlihy's replicated queue?
What is the role of a log entry in a replicated event log?
What is the role of a log entry in a replicated event log?
What is a necessary step for recording a Deq event when a queue is not empty?
What is a necessary step for recording a Deq event when a queue is not empty?
Which statement is true regarding the minimal quorum choices for writing to replicated objects?
Which statement is true regarding the minimal quorum choices for writing to replicated objects?
Flashcards
Unsent Message
Unsent Message
A message that hasn't been sent to the recipient. It might be waiting in a queue before transmission.
Message Acknowledgement
Message Acknowledgement
An acknowledgement message indicating that a message has been received successfully by the recipient.
Message Delivery Uncertainty
Message Delivery Uncertainty
A situation where the server crashes before delivering a message to the consumer. This leaves the delivery status uncertain.
Client Receive with Auto-Acknowledge
Client Receive with Auto-Acknowledge
Signup and view all the flashcards
Non-Volatile Storage
Non-Volatile Storage
Signup and view all the flashcards
Message Delivery Uncertainty During Recovery
Message Delivery Uncertainty During Recovery
Signup and view all the flashcards
Server State Metadata
Server State Metadata
Signup and view all the flashcards
JMS Queue Message Order
JMS Queue Message Order
Signup and view all the flashcards
JMS Topics: Publish-Subscribe Pattern
JMS Topics: Publish-Subscribe Pattern
Signup and view all the flashcards
JMS Topics: Long-Lived and Durable
JMS Topics: Long-Lived and Durable
Signup and view all the flashcards
JMS Topic Sending and Receiving
JMS Topic Sending and Receiving
Signup and view all the flashcards
JMS Topic Subscription
JMS Topic Subscription
Signup and view all the flashcards
JMS Topic Subscription and Reliability
JMS Topic Subscription and Reliability
Signup and view all the flashcards
JMS does not offer fault-tolerance/load balancing
JMS does not offer fault-tolerance/load balancing
Signup and view all the flashcards
JMS does not support error notification
JMS does not support error notification
Signup and view all the flashcards
JMS does not provide security
JMS does not provide security
Signup and view all the flashcards
JMS is an API, not a protocol
JMS is an API, not a protocol
Signup and view all the flashcards
JMS promotes client portability across MOMs
JMS promotes client portability across MOMs
Signup and view all the flashcards
JMS does not guarantee interoperability between providers
JMS does not guarantee interoperability between providers
Signup and view all the flashcards
Message delivery order on a topic (same delivery mode)
Message delivery order on a topic (same delivery mode)
Signup and view all the flashcards
Delivery time impacting message order
Delivery time impacting message order
Signup and view all the flashcards
Message priority affecting order
Message priority affecting order
Signup and view all the flashcards
Different subscriptions may have different order
Different subscriptions may have different order
Signup and view all the flashcards
One-copy Serializability
One-copy Serializability
Signup and view all the flashcards
Sequential Consistency
Sequential Consistency
Signup and view all the flashcards
Weak Consistency
Weak Consistency
Signup and view all the flashcards
Isolation Property
Isolation Property
Signup and view all the flashcards
Weak Consistency Models
Weak Consistency Models
Signup and view all the flashcards
Snapshot
Snapshot
Signup and view all the flashcards
Sequential Consistency – Ordering of operations
Sequential Consistency – Ordering of operations
Signup and view all the flashcards
Composability – Sequential Consistency
Composability – Sequential Consistency
Signup and view all the flashcards
Snapshot – Client Operation
Snapshot – Client Operation
Signup and view all the flashcards
Write Operation
Write Operation
Signup and view all the flashcards
Operation Ordering – Distributed System
Operation Ordering – Distributed System
Signup and view all the flashcards
Read Operation
Read Operation
Signup and view all the flashcards
read() Function
read() Function
Signup and view all the flashcards
write() Function
write() Function
Signup and view all the flashcards
Quorum
Quorum
Signup and view all the flashcards
Quorum Consensus
Quorum Consensus
Signup and view all the flashcards
Overlap of Quorums
Overlap of Quorums
Signup and view all the flashcards
Quorum Size
Quorum Size
Signup and view all the flashcards
Weighted Voting
Weighted Voting
Signup and view all the flashcards
Read/Write Quorum Overlap
Read/Write Quorum Overlap
Signup and view all the flashcards
Quorum Formula
Quorum Formula
Signup and view all the flashcards
Quorum Consensus Implementation
Quorum Consensus Implementation
Signup and view all the flashcards
Inconsistent Replicas
Inconsistent Replicas
Signup and view all the flashcards
Read-Your-Writes Consistency
Read-Your-Writes Consistency
Signup and view all the flashcards
Write Quorum
Write Quorum
Signup and view all the flashcards
One-Copy Serializability (1CS)
One-Copy Serializability (1CS)
Signup and view all the flashcards
Concurrent Writes
Concurrent Writes
Signup and view all the flashcards
Network Partition
Network Partition
Signup and view all the flashcards
Replicas with 0 Votes
Replicas with 0 Votes
Signup and view all the flashcards
Fault Tolerance
Fault Tolerance
Signup and view all the flashcards
Concurrent Writes Issue
Concurrent Writes Issue
Signup and view all the flashcards
Consistent Read
Consistent Read
Signup and view all the flashcards
Read Value
Read Value
Signup and view all the flashcards
Inconsistent Read
Inconsistent Read
Signup and view all the flashcards
What is Dynamo?
What is Dynamo?
Signup and view all the flashcards
What is a preference list in Dynamo?
What is a preference list in Dynamo?
Signup and view all the flashcards
What is the coordinator server in Dynamo?
What is the coordinator server in Dynamo?
Signup and view all the flashcards
What are read/write quorums in Dynamo?
What are read/write quorums in Dynamo?
Signup and view all the flashcards
What is the quorum formula in Dynamo?
What is the quorum formula in Dynamo?
Signup and view all the flashcards
Transaction-based Quorum Consensus Replication: Write Consistency
Transaction-based Quorum Consensus Replication: Write Consistency
Signup and view all the flashcards
Transaction-based Quorum Consensus Replication: Solving Failures and Concurrency
Transaction-based Quorum Consensus Replication: Solving Failures and Concurrency
Signup and view all the flashcards
Transaction-based Quorum Consensus Replication: Challenges
Transaction-based Quorum Consensus Replication: Challenges
Signup and view all the flashcards
Transaction-based Quorum Consensus Replication: Deadlock
Transaction-based Quorum Consensus Replication: Deadlock
Signup and view all the flashcards
Transaction-based Quorum Consensus Replication: Two-Phase Commit
Transaction-based Quorum Consensus Replication: Two-Phase Commit
Signup and view all the flashcards
Quorum Consensus Replication: Quorum
Quorum Consensus Replication: Quorum
Signup and view all the flashcards
Playing with Quorums: Balancing Read/Write Quorums for Performance and Consistency
Playing with Quorums: Balancing Read/Write Quorums for Performance and Consistency
Signup and view all the flashcards
Playing with Quorums: Trade-offs in Performance and Availability
Playing with Quorums: Trade-offs in Performance and Availability
Signup and view all the flashcards
Blank Entry
Blank Entry
Signup and view all the flashcards
Transaction-based Write Consistency
Transaction-based Write Consistency
Signup and view all the flashcards
Quorum Overlap
Quorum Overlap
Signup and view all the flashcards
Linearizability?
Linearizability?
Signup and view all the flashcards
Replicated Event Logs
Replicated Event Logs
Signup and view all the flashcards
Log Entry
Log Entry
Signup and view all the flashcards
Quorum Intersection Graph
Quorum Intersection Graph
Signup and view all the flashcards
Study Notes
Message Oriented Middleware (MOM)
- Message-oriented middleware (MOM) is a type of communication middleware that facilitates asynchronous communication between processes.
- A distributed system consists of a collection of processes that are spatially separated and communicate through message exchanges.
- An atomic bit string is a message. Its format and significance are explained by a communications protocol.
- The transport of a message from its source to destination is performed by a computer network
- Internet protocols:
- Application Transport: Specific communication services between 2 or more processes
- Network Interface: Communication between 2 computers not directly connected or directly connected.
- Properties of the Internet Transport Protocols:
- UDP: Message, Connectionless, Non-reliable, No order, No flow control, Variable number of recipients
- TCP: Stream, Connection-based, Reliable, Ordered, Flow control, 1 recipient
Distributed System
- A distributed system encompasses a collection of geographically dispersed processes that communicate by exchanging messages. A crucial aspect of distributed systems is the message transmission delay, which must be considered in comparison to the timeframe between events within a single process.
Internet Protocols
- Communication channels provided to an application depend on the transport protocol (e.g., UDP or TCP).
- The design of distributed applications depends on the characteristics offered by the chosen transport protocol.
TCP Reliability
- TCP reliability (message loss):
- Network hardware misconfigurations or failures
- Unplugged cables
- Damaged cables (e.g., by road works, shark bites)
- TCP guarantees that the application will be notified if the local endpoint is unable to communicate with the remote end.
- Error codes (e.g., ENOTCONN) are returned.
- The application is responsible for handling data loss.
- Web browsers typically report the problem to the user and try to reconnect again.
- TCP itself doesn't retransmit lost data in other connections.
TCP Reliability (message duplication)
- Retransmission of potentially already delivered messages isn't always necessary.
- TCP is not equipped to filter data duplication originating from applications.
- Duplicated data segments could pose problems for non-idempotent operations (e.g. credit/debit transactions or purchase orders).
Remote Procedure Call (RPC)
- A mechanism for invoking procedures on a different machine.
- Local procedure call: A procedure call that takes place within a single machine.
- Remote procedure call: A procedure that takes place on a different machine.
Remote Procedure Call (RPC) System Architecture
- Client-side process and server-side process. The communication is handled by the RPC's core, which is usually implemented atop of a transport protocol like TCP/IP. It enables a client process to interact with a server.
Client Stub
-
- Assembles message: parameter marshalling.
-
- Sends message via write or sendto to server
-
- Blocks waiting for a response via read or recvfrom.
- Not in synchronous RPC
Server Stub
-
- Receives message with request
-
- Parses message to determine arguments
-
- Calls function
-
- Assembles message with return value function
-
- Sends message via write or sendto
-
- Blocks for a new request
RPC Advantages
- Distributed applications are simplified. RPC has limitations
Asynchronous Communication
- Communication where sender and receiver don't need to be active simultaneously.
- Used to avoid delays caused by sender/receiver synchronization.
- Suitable for loosely coupled systems.
Message-Oriented Middleware (MOM)
- Asynchronous message-based communication
- Message storage is handled by middleware.
- The service resembles a postal service with varying guarantees, such as order and reliability.
- MOM provides similarities to message fora/news groups.
MOM: Basic Patterns
- Point-to-point
- Publish-subscribe:
- Publishers put messages into a topic.
- Subscribers read messages from a topic; one message can be received by many subscribers.
- Unlike queues, messages are delivered to more than one process (subscriber).
Messaging Service Implementation
- Asynchronous communication is facilitated by a messaging service.
- There can be communication servers.
- Synchronization needed at the communication level to ensure it operates correctly.
Messaging Service Applications
- Enterprise application integration (EAI)
- Workflow applications
- Microservices
- Message-based communication between people (e.g., email, SMS)
- Real-time messaging
Java Message Service (JMS)
- API for MOM, primarily designed for J2EE (now Jakarta EE)
- Enables Java applications to access MOMs in a portable manner.
- The functionalities offered by well-known MOM providers (e.g., IBM MQSeries, TIBCO) are encapsulated and presented.
- Provides integration options with Java Transaction Service
- Re-placed by Jakarta Messaging, but JMS is still in use in some documentation.
- Includes the API for queues and topics.
JMS Architecture and Model
- Two types of destinations used in JMS:
- Queues: single-destination communication
- Topics: multi-destination communication
- Two important components:
- JMS Provider (MOM service implementation)
- JMS Client (application sends/receives messages)
JMS Messages
- Headers: essential fields for identification and routing.
- Properties: optional details (metadata).
- Body: the actual data exchanged.
JMS Queues
- The Queue model:
- Several senders can store messages in a queue.
- Several receivers collect messages from a queue.
- A message is only delivered to one receiver.
- This improves scalability.
- Queues have a long lifespan and are administered, not created by clients.
JMS Queues: Communication Semantics
- Blocking vs non-blocking
- Sends() and receive() operations;
- Blocking: blocks until the message is sent.
- Non-blocking (via timeout): specify timeout
- Asynchronous (via callback): response via callbacks
- Reliability depends on delivery mode, and other factors (e.g., non-volatile storage).
- Persistent (once-and-only-once semantics).
- Non-persistent (at-most-once semantics)
JMS Queues: Persistent Delivery Implementation
- Difficulty with maintaining consistency and delivery across failures.
- Challenges of message loss or duplication during sender-server-receiver transmissions.
- The Importance of consumer acknowledgment, for correct delivery semantics in a failure-prone environment.
- There are different modes:
- AUTO_ACKNOWLEDGE, DUPS_OK_ACKNOWLEDGE
- CLIENT_ACKNOWLEDGE.
JMS Queues: Persistent Delivery Implementation (Issue)
- Problems when the server recovers (message loss or acknowledgment loss).
JMS Queues: Persistent Delivery Implementation (Solution)
- Resending messages with uncertainty using the JMSRedelivered header and the JMSXDeliveryCount property.
JMS Queues: Once-and-only-once Guarantees
- JMS's once-and-only-once delivery isn't "exactly once"; instead, duplicates may be delivered.
- Apache Kafka, on the other hand, is claimed to support exact-once delivery due to its use of logs, durable storage, and offsets for messages positioning.
JMS Queues: Session-based Transactions
- Ensures atomicity of send() /receive() operations.
- Guarantees that either all operations within a transaction complete or none of them.
- Commit(): confirms successful transaction
- Rollback(): undoes unsuccessful transaction
JMS Queues: Distributed Transactions
- Guarantees the atomicity of all transactions across the system, even when dealing with concurrent operations and process failures
- Needs to use Java Transaction API
- Ensures consistency even if a server crash or a network fault occurs
JMS Queues: Message Order
- Message order is guaranteed mostly within the same session's requests.
- Message sorting based on priority, delivery time and message selectors may override this.
JMS Topics
- Delivers messages to zero or more subscribers.
- Publishers send messages to a topic.
- Subscribers receive messages from a topic.
JMS Topics: Sending and Receiving Messages
- The API structure for topics is similar to the queue structure.
- The send() and receive() functions allow for handling of various message types similar to the queue structure
- Message selectors conditions can be used to filter messages received by subscribers.
JMS Topic Subscription
- Unshared: Only one active consumer
- Shared: More than one active consumer, all consumers receive all messages from a topic
- Duplicate-free delivery to each consumer
- Durable vs. Non-durable Subscribers
- Durable : the subscription persists even if subscribers are unavailable
- Non-durable: subscription exists only while there's a subscriber connected to the topic
JMS Topic Subscription and Reliability
The reliability of messaging depends on the message's delivery mode and subscriber's durability
JMS Topic Message Consumption Order
- The ordering of message delivery in topics is similar to the one for queues.
- Delivery order might differ from topic to topic (e.g., with different delivery modes or other factors)
- Time-dependent message delivery ordering, and is outside the client's control
JMS...
- An API for message-oriented middleware (MOM).
- Allows Java applications to access MOM in a portative manner.
- Includes functionalities for enterprise applications.
JMS Architecture
- JMS supports two types of destinations: queues (single-destination) and topics (multi-destination)
JMS Messages
- JMS messages consist of three parts: header, properties, body
JMS Queues
- A queue is a long-lived messaging destination managed by an administrator.
JMS Queues: Communication Semantics
JMS queues have blocking, non-blocking, and asynchronous send/receive semantics.
JMS Topics
- Topics support a publish-subscribe model.
MOM: Basic Patterns
- Point-to-point
- Publish/subscribe
JMS Messages
- Header
- Properties
- Body
Internet Protocols
- Application Transport
- Network Interface
Message Queuing Protocols
- AMQP: Advanced Message Queuing Protocol, an open standard protocol approved by OASIS.
- MQTT: A transport protocol for industrial applications, also an OASIS transport protocol.
- OpenWire: A public protocol for Apache ActiveMQ, which provides a JMS API.
- ActiveMQ supports AMQP, MQTT and other protocols.
Architecture
- Larger scale systems use message relays. E.g. , if applications/services run on different data centers
Message Brokers
- MOM is often used in the integration of applications.
- Different applications might have distinct syntax for messages, thus requiring a broker to translate between them.
Further Reading
- van Steen and Tanenbaum, Distributed Systems, 3rd Edition
Replication and Consistency Models
- Replicating data across many nodes offers:
- Enhanced performance (local reads)
- Increased reliability (avoiding data loss if a single replica is lost)
- Improved scalability (distributed load balancing across the nodes)
- Data availability (if not all replicas fail)
- Challenges include data consistency and concurrency if there are multiple updates made on the replicated data
Replication
- Updates to multiple replicas require careful coordination to maintain consistency.
- Protocols for synchronization needed to maintain consistency
Strong Consistency Models
- Sequential consistency is consistent if every execution of operations by the system can be equivalent to some serial execution of operations.
- Serializability: A collection of operations is serializable if the outcomes of the concurrent execution of these operations are similar to the outcome of some sequential execution sequence of these operations
- Linearizability: A system's operations are linearizable if the outcome of concurrent operations is equivalent to some serial execution of these operations.
Sequential Consistency Model
- An execution is sequentially consistent if it is equivalent to some serial execution of all the operations in that execution.
- Operations are executed in a certain order by each thread
- Used by multi-threaded systems.
- Not composable, as shown by examples with two arrays
Linearizability
- An execution of operations is linearizable if it's equivalent to some ordering where each operation has a start and end time on the timeline.
- Necessary that communication delays be predictable
- Critical for applications relying on a total order.
One-copy Serializability
- Essential for transaction-based systems. It focuses on transactions ensuring the outcome of concurrent transactions is equivalent to the order of some sequential execution of these operations.
Weak Consistency Models
- Improves scalability and availability, often at the expense of strict consistency.
Further Reading
- Fekete and Ramamritham (2010): Consistency Models for Replicated Data
- van Steen and Tanenbaum (Distributed Systems, 3rd Ed.): data-centric and client-centric consistency models.
Replication for Fault Tolerance
- Quorum Consensus protocols guarantee that a majority of replicas must agree
Quorum Consensus Protocols
- A quorum is a subset of replicas.
- Operations (e.g., reading, writing) require a quorum of replicas to complete successfully.
- Quorums help to enforce consistency, while allowing a certain degree of fault tolerance.
Read-Write Quorums
- Read Quorums and Write quorums are needed in order to maintain system consistency in a fault-tolerant environment.
- Must overlap such that common replicas exist in the sets involved
- Different quorum sizes give different trade-offs between consistency and availability
Quorum Consensus Implementation
- Read operation requires querying a quorum of replicas to find the current version and read the object value from an up-to-date replica.
- Write operation requires sending the new value to a write quorum; all replicas update the value.
Naïve Implementation with Faults
- Failures in partitions might cause the operations to be performed only on a subset of replicas, resulting in inconsistent data
Ensuring Consistency with Transactions
- Transactions, like the two-phase commit, are used to resolve data inconsistencies in multi-process environments
Playing with Quorums (1/2)
- The possibility of trade-offs between performance and availability depending upon the number of replicas in a quorum
- Assigning weights to replicas allows for different quorum sizes for read and write operations
Playing with Quorums (2/2)
- Weighted voting systems allow for variable weights assigned to the replicas in quorums; this can be used to tune availability and performance tradeoffs
Dynamo Quorums
- Dynamo, an Amazon-developed key-value storage system; provides high availability by enabling the use of quorums across a large number of servers.
- Data is replicated across many nodes
- Dynamo uses a preference list to determine which nodes are responsible for different data items
- Each operation has a "coordinator" node from the preference list that manages the actions; the rest of the replicas may be involved
- Data consistency is less strict than in Gifford's quorum approach– it uses "sloppy" or "consistent" quorums based on need
Dynamo's "Sloppy" Quorums and Hinted Handoff
- Allows the system to continue functioning despite replica failures
- Creates a backup copy of data in backup replicas, which is used when the primary replicas are unavailable
- When primary replicas recover the backup replicas automatically transfer their data
XA-based Quorum Consensus Implementation
- Each object's access is performed in the context of a transaction.
- The Read and Write operations need to know the current state and which replicas are up-to-date.
- Data modification is done only for a quorum.
- This guarantees atomic operations.
Transaction-based Quorum Consensus Replication
- Transactions offer improvements in consistency and support for more complex operations. However, possible deadlocks need to be considered
Quorum-Consensus and Replicated Abstract Data Types
- Herlihy generalizes quorum consensus concepts to ADTs (abstract data types), including data structures like queues. This technique employs initial and final quorum definitions to govern read and write operations; one suitable example is the queue.
Herlihy's Replicated Queue (example, execution, tracings)
- This technique makes sure that the operations (including read and write operations) within a transaction are executed concurrently and atomically.
- The outcome of the transaction must be equivalent to the order of some sequential execution of these operations
Herlihy's Replication Method
- Use of timestamps instead of version numbers.
- Reduction of quorum constraints.
- Reduction in message size when handling updates.
- Using message logs instead of state versions
Replicated Read/Write Objects with Time Stamps
- Using timestamps for read/write consistency rather than maintaining version numbers.
- Ensures a total order consistent with an omniscient observer.
- Client only needs to write to a final quorum for the entire state changes, and not just specific bits or locations.
Replicated Event Logs vs Replicated State
- Using event logs for replication instead of maintaining full states.
- Event logs are sequences of timestamped events.
Herlihy's Replicated Queue: Constraints
- Initial and final quorum must overlap.
- These constraints ensure that the queue maintains consistent state across replicas.
Herlihy's Replicated Queue: Optimizations
- Using a horizon time stamp for queue execution.
- Reducing the amount of data transmitted while processing dequeue requests
Issues with Replicated ADTs
- Timestamp generation for consistency across clients.
- Handling state changes when initial quorums are empty.
(Herlihy's) Replicated ADTs vs. CvRDTs
- Differences:
- CRDTs don't ensure strong consistency but strong eventual consistency.
- Replicated ADTs require a quorum to perform an operation.
Quorum Consensus: Final Thoughts
- Quorum-based systems are frequently restricted to "simple" data storage systems.
- Herlihy's generalization extends these approaches to other abstract data types as well.
- Techniques like majority voting are critical.
Further Reading
- Research papers by Leslie Lamport, Maurice Herlihy, et al., on distributed consensus, reliable broadcast, and state machine replication.
Blockchain
- A distributed, immutable ledger system recording transactions across a network of computers.
Bitcoin Blockchain
- Stores a complete history of all transactions.
Bitcoin Proof-of-Work
- A consensus protocol in Bitcoin. Nodes solve a computational puzzle (cryptographic hash) to add new blocks to the chain.
Bitcoin Forks
- Fork occurs when a disagreement arises about the next block in the chain.
Bitcoin Scalability and Energy Consumption
- Challenges in handling transactions per second, block sizes and storage.
Proof-of-Stake
- An alternative to Proof-of-Work
- Uses a lottery to select the next block proposer based on "coinage".
Permissioned Blockchains
- Restrict access to the blockchain network.
Further Reading
- Papers and resources on Bitcoin, including Nakamoto's original Bitcoin whitepaper.
Other Resources
- General Information regarding blockchain technology
- Resources on the CAP theorem
- Resources on various distributed consensus algorithms, like Paxos, and other distributed agreement protocols.
Studying That Suits You
Use AI to generate personalized quizzes and flashcards to suit your learning preferences.
Related Documents
Description
This quiz explores the differences between weak and strong consistency models, focusing on their advantages and implications in transaction-based systems. It also covers message delivery mechanisms and the roles of components in JMS message delivery. Test your knowledge on these essential concepts in distributed systems!