AMQ vs SQS vs SNS vs Google Pub-Sub

Messaging Queues

Asynchronous communication is enabled via message queue software, which allows machines to communicate remotely, which acts as a backbone of any distributed system. A single application cannot be responsible for the entire operation in advanced systems. Rather, numerous apps are linked together to complete their respective sets of tasks and meet the system's overall requirement. Each system need to communicate among themselves and this is where the need for queues arises!

Currently, market has to offer a bunch of options when it comes to Queue. You have Apache Kafka, Apache Active MQ,  AWS SQS, AWS SNS, Google Pub/Sub, Rabbit MQ etc.

Let's make a comparison which can help us choosing the right tool for our project.


I already did a series on Kafka vs RabbitMQ which can be found below:

Kafka vs RabbitMQ
Are RabbitMQ and Kafka same ?

ActiveMQ

Apache ActiveMQ is a prominent Java-based open source messaging server. It acts as a bridge between numerous apps that are hosted on different servers or developed in different languages. It supports numerous messaging protocols, including AMQP and MQTT, and implements JMS (Java Message Service).

Features -

  1. Multiple connection protocols are supported
  2. Along with vertical scaling, built-in functionality for horizontal scaling, called Network of Brokers, is also supported.
  3. Schedule delayed deliveries
  4. Offers an API for custom authentication plug-ins

When to use?

ActiveMQ is preferably used where small amounts of data is involved. Messages can be transmitted as part of a queue or as a topic with ActiveMQ. One or more consumers are connected to the queue through point to point messaging, and the broker utilizes a round robin strategy to direct messages to specific consumers. Brokers send communications to all consumers who have subscribed to the topic via subscription-based messaging.

For enterprises, which don’t have use for big data processing, ActiveMQ is a good option.


AWS SNS

Amazon SNS, or Amazon Simple Notification Service, is a push notification service offered by Amazon.  It is is a fully managed messaging service for both application-to-application (A2A) and application-to-person (A2P) communication.

Features-

  1. Provides High Throughput
  2. Fully managed and uses AWS cloud to automatically scale the workload.
  3. Through Amazon Cloudwatch, it allows you to view the system metrics and resolve issues quickly.
  4. The A2P functionality enables you to send messages to users at scale via SMS, mobile push, and email.
  5. Push based system

When to use ?

It’s a low-cost infrastructure, primarily used by companies to send pub/sub messages to their customers. This web service makes it easier for publishers to create and push notifications from the cloud. It’s ideal for developers who are looking for a message notification system that integrates with minimal effort, requires minimum maintenance and works on pay-as-you-go pricing. Unless your application requires a conventional queuing system, Amazon SNS offers a cheaper solution to push subscribed messages to customers.


AWS SQS

Amazon SQS is a fully managed distributed message queuing service offered by Amazon. It’s a cost-effective and simple technique to manage communication between components of software systems running in the cloud(even on prem if required). SQS eliminates the complexity and overhead associated with managing and operating message-oriented middleware, and empowers developers to focus on differentiating work.

Features

  1. The SQS queues automatically scale to the size of the workload.
  2. No additional infrastructure is needed for using Amazon SQS.
  3. Unprocessed messages can be maintained in a “dead letter” queue.
  4. Gets benefitted with the large scale of AWS Infrastructure
  5. FIFO queues guarantee exactly-once delivery
  6. Standard queues guarantee atleast-once delivery

When to use?

Amazon SQS is of prime value to a serverless architecture where you want different services to function independently. It offers a lightweight and fast approach to establish communication between these decoupled services.

It’s a good option in applications where multiple independent systems need to be integrated without the overhead of maintaining own queue infrastructure. If your systems uses serverless stack with Lambdas then this is definitely a good option.

The FIFO queues are good for an ordered delivery of message but comes at a price of limited throughput. So, we need to choose wisely!


Google Pub/Sub

Google Cloud Pub/Sub is an asynchronous messaging service that allows you to send and receive messages between different apps. It provides dependable message storage and low-latency real-time message delivery, making it a popular choice among developers that need to send out event notifications, stream data from many devices, or build asynchronous workflows.

Features

  1. It offers low latency and high throughput.
  2. Both push and pull message deliveries are supported.
  3. It’s highly scalable, with support for 10,000 messages per second for all customers by default.
  4. The first 10 gigabytes of data are free.
  5. It has a lite version which costs even less.
  6. It has no exactly-once delivery

When to use?

Google Pub/Sub offers reliable messaging and data streaming across applications hosted anywhere on the internet, including Google Cloud Platform. Many advanced features are included to make communication easier to manage. Auto-scaling, dead-letter delivery and filtering makes your applications simpler. Many developers prefer it for the flexible pricing. Google Pub/Sub charges you on the volume transmitted after you have used your free 10 gigabytes.

Those who already have their applications running on Google Cloud Platform should go for Google Pub/Sub.


Hope this article helps. Cheers 🍻

Tirthankar Kundu

Tirthankar Kundu