Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

MESSAGING QUEUES

Advantages of Message Oriented Middleware


Asynchronicity/Loose coupling between components: MOM technologies
use asynchronous message passing as opposed to request-response
architectures. In asynchronous systems, message queues provide temporary
storage when the destination program is busy or not connected. In addition,
most asynchronous MOM systems provide persistent storage to back up the
message queue. It also means that should the receiver application fail for any
reason, the senders can continue unaffected, as the messages they send will
simply accumulate in the message queue for later processing when the
receiver restarts.
Routing: Many message-oriented middleware implementations depend on
SYSTEM INTEGRATION a message queue system. Some implementations permit routing logic to be
provided by the messaging layer itself, while others depend on client
May 22th, 2017 applications to provide routing information or allow for a mix of both
paradigms

MESSAGE QUEUE Criteria for evaluating

Disadvantages of Message Oriented Durability: Whether messages can be written to disk, or


Middleware even committed to a DBMS for reliability in case of server
crashes.
The primary disadvantage of many broker based
Point-Point vs Publish-Subscribe: Whether the message
message oriented middleware systems is that queue provider supports point-point or publish-subscribe
they require an extra component in mode of delivery
the architecture, the message transfer agent Push vs Pull Model : Whether the consumers have to pull
(message broker). As with any system, adding the messages or the broker pushes the messages to the
another component can lead to reductions consumers.
in performance and reliability, and can also Message Acknowledgements: Whether messages
make the system as a whole more difficult and acknowledgement modes are supported between
expensive to maintain. consumers, brokers and producers.
Criteria for evaluating Criteria for evaluating

Message Ordering: Whether messages are delivered to


Delivery Policies: Whether a message should be delivered consumers in a FIFO ordering or not.
at least once, or no more than once.
Batching Policies: Should messages be delivered
Purging Policies: Whether Queues or Messages support a immediately, or should the system wait a bit and try to
“time to live”. deliver many messages at once.
Message Size/Format: What message sizes and types are Scalability: What order of throughput, latency and volume
supported. of queues, messages is supported.
Message filtering/routing policies: Whether messages can Availability: Does the queuing system support high
be filtered so that a consumer can see only messages availability in case of failures of servers.
matching some criteria of interest and messages can be
Operational and financial cost
routed to consumers based on defined policies.
Cross platform interoperability

DATABASE QUEUE EVALUATION


Durability: Messages are saved to the database always.
Point-Point vs Publish-Subscribe: Supports only Point-Point model.
Delivery Policies: Messages are guaranteed to be delivered as the
Message producer gets an acknowledgement. Messages are
consumed by only one consumer by using a status field in the table
to co-ordinate between multiple consumers.
Message Acknowledgements: Msg are acknowledged as soon as
they are stored in the persistent store
Purging Policies: Messages can be retained and can be purged
manually or through a database trigger based on some purging
policies.
Message Size/Format: Can store binary/text messages of any size
limited by the underlying disk space and datatype used for the
column. Even though there is no limitation on message size, its not
ideal to have messages of very large size.
EVALUATION

Message filtering/routing Policies: Message filtering Batching Policies: Messages can be processed in batches
has to be implemented in the MessageHandler based on batching policies defined.
component of the consumer service. Does not support Scalability: Not very scalable. Would hit performance
routing of message to multiple services implicitly. Each issues due to lock contention on database read/write
message will have to be sent to every other Service operations and too much disk I/O.
that has to consume the message Availability: Using a dynamic service discovery solution to
Routing message to multiple consumers detect service instances being added or going down,
Message Ordering: Consumers pick up messages from would achieve high availability.
the table based on the timestamp of message. This Operational and Financial Cost: Does not incur any
does not result in strict FIFO due to multiple financial cost except the initial effort to design the
consumers. solution; would incur minimal operational burden.
Cross Platform interoperability:

JMS QUEUES JMS QUEUES

In this model, there is no transformation required as both the Producer and


Consumer clients are using the same protocol to communicate. Although this
scenario seems to solve the cross-platform interoperability problem, there
are some inherent problems.
Both protocols may not support the same message body types.
Applications would be locked into one specific vendor solution (or in some
cases only a few vendor choices) due to the built-in message bridge.
Both protocols may not support same datatypes, custom properties and
header properties between the messaging clients.
These scenarios illustrate that JMS isnt’t the right solution for cross-platform
interoperability.
While vendors such as ActiveMQ, HornetQ, Apollo, SonicMQ etc provide
some level of cross platform interoperability, it is usually through proprietary
protocols, API’s and client libraries. Without some sort of messaging
standard, it is difficult to know what messaging system another company or
system is using and how to interface with it.
AMQP Message Brokers Exchanges, Bindings and Queues

AMQP (Advanced Message Queuing Protocol) is a The AMQP Model at a high level works like this:
standard binary wire level protocol that enables messages are published to exchanges, which are
conforming client applications to communicate with often compared to post offices or mailboxes.
conforming messaging middleware brokers. AMQP Exchanges then distribute message copies
allows cross platform services/systems between to queues using rules called bindings. Then AMQP
different enterprises or within the enterprise to brokers either deliver messages to consumers
easily exchange messages between each other subscribed to queues, or consumers fetch/pull
regardless of the message broker vendor and messages from queues on demand. Various brokers
platform. that have implemented the AMQP protocol like
RabbitMQ, StormMQ, Apache Qpid, Apache
ActiveMQ

Features of a RESTful Services AMQP PUSH

Every system uses resources. These resources


can be pictures, video files, Web pages, business
information, or anything that can be
represented in a computer-based system. The
purpose of a service is to provide a window to
its clients so that they can access these
resources. Service architects and developers
want this service to be easy to implement,
maintainable, extensible, and scalable.
AMQP PULL AMQP EVALUATION

In the pull model, each consumer fetches messages using amqp basic.get method Durability: Durability can be configured at exchange/queue/message level. Messages will
(requests to basic.get are synchronized by the broker be persisted until they are acknowledged (either auto or explicit acknowledgement).
Point-Point vs Publish-Subscribe: Supports Point-Point model as well as publish-
subscribe through different exchange types (direct, fanout, topic etc).
The broker maintains information about the state of the queue and messages in Delivery Policies: Supports different message delivery policies
Erlang’s distributed database Mnesia 1. At-most once Delivery: When using auto-acknowledgement messages are delivered
at most once as a message is deleted as soon as it is delivered to the consumer
2. At-least once Delivery: When using explicit acknowledgement messages may be
delivered more than once if the broker does not receive an acknowledgement from the
Consumer can send message to the same exchange to notify producer of status if consumer either due to network failure or consumer/broker crash. In such scenarios,
required. In case of an External Service, the external service can notify the producer messages will re re-queued resulting in delivery again with a delivered flag set to true.
through a callback url. Consumers can also reject or nack messages which will result in re-queuing of messages for re-
delivery.
Message Acknowledgements: Supports message acknowledgements between broker-
>producer as well as consumer->broker.

AMQP EVALUATION AMQP EVALUATION

Batching Policies: This applies for both the push/pull model. Messages can be
Purging Policies: Messages are removed from the queue once they are acknowledged.
pushed/fetched in batches by setting a Qos prefetch count either on the channel level or
Messages are stored in memory (also on disk for persistent messages) and retaining for long
consumer level. This value should be optimized based on the average round trip time (time
periods of time would exhaust memory resulting in performance issues. Rejected messages
taken for broker to send a message and receive ack) and the processing time of the message
and negative acknowledged messages can be requeued or forwarded to dead letter exchange
on the consumer so that the consumer can consume messages at the maximum possible rate.
which will route to appropriate queue for handling such messages.
Scalability: Highly Scalable in terms of throughput(million messages/sec in some cases;
Message Size/Format: Supports binary messages and message size is limited by the
varies with message size) and latency is in the order of tens or hundreds of millisecs. The
amount of memory/disk space on the broker. When a queue gets too large exhausting
number of queues that can be supported would also be in the order of millions in a clustered
memory, messages published to the queue will be written to disk. Even though there is no
deployment limited only by the number of concurrent socket connections that the broker can
limitation on message size, its not ideal to have messages of very large size.
support.
Message filtering/routing Policies: Supports a variety of filtering/routing techniques
Availability: Supports high availability by replicating entities(Exchanges and Bindings) to all
through the different types of exchanges (direct, fanout, topic, headers etc). No other broker
brokers in the cluster to recover from unexpected failures. Queues have to be mirrored to a
solutions offer such a wide range of routing capabilities. AMQP supports more complex
subset of brokers for making them highly available. Chooses Availability over Consistency in
bindings depending on the requirement of applications.
the event of a network partition (AP model)
Message Ordering: Messages are delivered in FIFO order but message consumption may
Operational and Financial Cost: Involves operational and financial cost to manage
not be in FIFO order due to multiple consumers; unless each queue is associated with an
servers and monitor deployments and health of the system.
exclusive consumer.
APACHE KAFKA KAFKA

Kafka is a distributed, partitioned, replicated commit log service. Scalability: Highly Scalable in terms of throughput(million writes/sec, order of
hundreds of MB/sec depending on message size) and latency is in the order of tens or
It provides the functionality of a messaging system, with a hundreds of millisecs. The number of topics that can be supported will be in the order
unique design. In comparison to most messaging systems Kafka of a few thousands. This is limited due to the fact that the configuration information
has better throughput, built-in partitioning, replication, and of brokers, topic-partitions, consumer offsets, partition-owners is stored in zookeeper
znodes and zookeeper being a in-memory non-sharded data store, we will eventually
fault-tolerance which makes it a good solution for large scale exhaust the memory.
message processing applications Availability: Supports high availability by replicating partitions to other brokers in the
cluster based on a replication factor, rebalancing the partitions to other brokers in
case of broker crashes and by maintain ISR’s for each partition. Chooses Availability
over Consistency in the event of a network partition (AP model) in the latest stable
release; with future releases supporting a configuration for choosing consistency over
availability or availability over consistency.

You might also like