Amazon SQS: A CASE STUDY

Anupam Kumar Thakur
4 min readMar 1, 2021

Amazon SQS (Simple Queue Service) is a distributed message queuing service. Amazon has launched it in 2004. It is called distributed because it manages the message queue service for other services. Eg. microservices, distributed systems, and serverless applications, etc. In the definition, there is a term message queue, it is something like a database (not exactly) that stores the message send by the sender to the receiver in the queue format (producer and send will be a good example). It stores the message for at most 14 days and the days can be customized as per the need. It helps to maintain the records between the main program to the associated microservices. If somehow, any of the microservices go down the message will be safe in the message queue and when the microservice will restart the message can be taken from the message ques easily. The conclusion is message queue works as a middle-ware between the sender and the receiver.

SQS is a managed service provided by AWS that works in four steps:

1. Polling: The process to check the message queue by the receiver side program that if the message queue has any message for the receiver or not.

2. Download: If the message queue will have any message the receiver program will download it.

3. Use: After downloading the message the receiver will use the message for further work.

4. Delete: The message from the message queue must be deleted, otherwise each time the receiver program will poll the message, the previous message will be polled again.

Amazon SQS architecture

Few more important things to know about the SQS

1. The size of the message should be between 1 Kb to 256 Kb. The size constraint has been put here to increase the throughput.

2. In-transit data: The data in motion is called transit data. Since the data travels from the sender to the message queue and from the message queue to the receiver, so we call it in-transit data. By default, it is the nature of SQS to encrypt the in-transit data.

3. SQS is also called serverless service because we are not configuring any instance, storage, RAM. We just create and use it.

Advantages of Amazon SQS

  1. SQS replaced the need for support infrastructure and to install any toter message queuing services. SQS scales up the message queues dynamically and automatically. It helps the user to build and grow the application in a quick and efficient way.
  2. Amazon SQS provides security to the data when it is sent from the producer to the message queue or from the message queue to the server. On the in-transit data, SQS by default encrypts the data before transmitting.
  3. SQS increases the reliability of the message by not modifying the message.
  4. SQS does scaling the requirements based on demand. So it makes this service cost-effective and scalable. We also no need to worry about the storage.

Case study of AWS SQS over BMW 7 Series cars

BMW (Bayerische Motoren Werke AG) Group is one of the leading manufacturers of premium cars and mobility services in the world. BMW built its new car-as-a-sensor (CARASSO) service in only six months with the help of AWS services and SQS was one of them. Connected cars deliver data to the cloud. The digital map is dynamically verified and enhanced. Key to enable automated driving and associated functions. The sensors in the car were sensing the map and sending it to the cloud and the map was keep updating. So, this concept is an example of a learning map. It used few more services to update the model and SQS was one of among them. By 2018 CARASSO is expected to process data collected by a fleet of 100,000 vehicles traveling more than eight billion kilometers.

Challenges faced by BMW

BMW was facing the challenge of load requirements. To load the data during the transmission. As we have seen this series of BMW was learning the map so the problem was managing the data transmission from one node to another. The factors of these challenges were consistency, speed, efficiency, scalable system, and the need for a managed service.

How BMW overcome these challenges?

The data was collected through the sensors installed in this series of BMW cars. Then this collected data is sent to the cloud. On the cloud, it used different AWS services including Amazon SQS. Here SQS managed the transmission of the collected data quickly, accurately, and efficiently. Then the same data provided to the consumers dynamically. It helped all the connected customers to get the map with fewer errors, good guidance, improved road geometry. Since SQS is a managed service and scalable too so the problem of storage and management reduced. Sometimes it may be that the connection stuck in a loop, in that case, DLQ (Dead Letter Queue) helps by storing the further data into another queue. Finally, by running on AWS SQS, CARASSO can adapt to rapidly changing load requirements that can scale up and down by two orders of magnitude within 24 hours.

CARASSO architecture (Red border shows SQS)

Hope you will enjoy it. Thank you!!!

References

  1. ARTH AWS program
  2. https://aws.amazon.com/sqs/
  3. https://www.youtube.com/watch?v=UpxYJY1m_tU&ab_channel=AmazonWebServices

--

--

Anupam Kumar Thakur

AWS | DOCKER | ANSIBLE | KUBERNETES | JENKINS | MACHINE LEARNING | DEEP LEARNING | REDHAT