Message Queue :
Message queue is a queue of messages(data) sent by the source waiting for consumers to download them. This program has a persistent storage capable of storing the data in case the consumer programs go down. It includes a sequence of work objects that are waiting to be processed. This service has the fastest through-put time i.e., the time to deliver the data to the consumer. The storage of MQ is held for a limited period of time so that it does not effect the efficiency and speed of the MQ program. It’s services are generally used when there is a need of delivering data to the consumers continuously and there are high possibilities of the consumers to go down. It’s architecture involves multiple sources and consumers (refer the image for a high level idea)
Working of MQ service
The data sent in by the source is held with the MQ program until the consumers download the data. The data held with the MQ is limited for a certain period of time. It is the responsibility of the consumers to come and download the data from the MQ program which is called polling. The Program involves terms like visibility timeout ( time for which the program is made unavailable in the MQ for other users while one user is downloading the data) which ensures that the data doesn’t get stuck in consumer loop , dead-letter queue ( forwards data to this MQ which is stuck in the consumer loop and doesn’t allow furtur downloads for the consumers) to ensure the efficiency of data transfer. It’s a complete message oriented middleware platform.
Some of the opensource and lat forms that provide this MQ service are Apache MQ , Kafka , Rabbit MQ , etc.,. It is important to make sure that this MQ program never goes down. So it’s beter to use this program as a managed service by someone else who ensures high availability. Amazon is one such provider that provides this MQ service at maximum redundancy naming this service as SQS (Simple Queue Service).
Amazon SQS :
Amazon Simple Queue Service (SQS) is a fully managed message queuing service that enables you to decouple and scale microservices, distributed systems, and serverless applications. SQS eliminates the complexity and overhead associated with managing and operating message oriented middleware, and empowers developers to focus on differentiating work.
Using SQS, you can send, store, and receive messages between software components at any volume, without losing messages or requiring other services to be available. Get started with SQS in minutes using the AWS console, Command Line Interface or SDK of your choice, and three simple commands. SQS offers two types of message queues. Standard queues offer maximum throughput, best-effort ordering, and at-least-once delivery. SQS FIFO queues are designed to guarantee that messages are processed exactly once, in the exact order that they are sent. SQS benefits it’s customers by providing features like eliminating administrative overhead , reliable deliver messages , keeping sensitive data secure , scaling elastically and cost effectively.
RedBus Case study
With the use cases of this SQS being vast , let’s look into how RedBus is solving its challenges using this SQS service of Amazon.
RedBus is an Indian travel agency that specializes in bus travel throughout India by selling bus tickets throughout the country. Tickets are purchased through the company’s Website or through the Web services of its agents and partners. The company also offers software, on a Software as a Service (SaaS) basis, which gives bus operators the option of handling their own ticketing and managing their own inventories. To date, the company says they have sold over 30 million bus tickets and has more than 1750 bus operators using the software to manage their operations.
The Challenge :
The biggest problem was that the infrastructure could not effectively handle processing fluctuations, which had a negative impact on productivity. Additionally, the procurement of servers or upgrading the server configuration was an extremely time-consuming endeavor. Over time, redBus realized that a better solution was imperative – a solution that offered scalability to handle the company’s processing fluctuations. redBus looked to Amazon Web Services (AWS) for a solution.
After testing the AWS solution on a small application for several months, the travel agency determined that it was very workable and convenient. Although redBus was quite enthusiastic about the on-demand instances and variety of instance types, several other features cemented the company’s decision to migrate completely to AWS. Charan Padmaraju, Chief Technology Officer believes that
“with features like Elastic Load Balancing and multiple availability zones, AWS provides the required infrastructure to build for redundancy and auto-failover. When you incorporate these in your system/application design, you can achieve high reliability and scale.”
The travel agency anticipates expanding the AWS solution to include Amazon Simple Notification Service (Amazon SNS) and Amazon Simple Queue Service (Amazon SQS) for monitoring, alerts, and intercommunication. “Amazon SQS is an especially good solution for enabling messaging between external applications and our applications,” says Padmaraju.
Benefits of AWS
- Reduced costs by up to 40%
- Reduced website latency by 4x
- Able to instantly replicate test environments, which in turn reduces time to market