What is Amazon SQS?
Amazon Simple Queue Service (Amazon SQS) offers a secure, durable, and available hosted queue that lets you integrate and decouple distributed software systems and components. Amazon SQS offers common constructs such as dead-letter queues and cost allocation tags. It provides a generic web services API that you can access using any programming language that the AWS SDK supports.
Benefits of using Amazon SQS
- Security — You control who can send messages to and receive messages from an Amazon SQS queue.
- Server-side encryption (SSE) lets you transmit sensitive data by protecting the contents of messages in queues using keys managed in AWS Key Management Service (AWS KMS).
- Durability — For the safety of your messages, Amazon SQS stores them on multiple servers. Standard queues support atleast-once message delivery, and FIFO queues support exactly-once message processing.
- Availability — Amazon SQS uses redundant infrastructure to provide highly-concurrent access to messages and high availability for producing and consuming messages.
- Scalability — Amazon SQS can process each buffered request independently, scaling transparently to handle any load increases or spikes without any provisioning instructions.
- Reliability — Amazon SQS locks your messages during processing, so that multiple producers can send and multiple consumers can receive messages at the same time.
- Customization — Your queues don’t have to be exactly alike — for example, you can set a default delay on a queue. You can store the contents of messages larger than 256 KB using Amazon Simple Storage Service(Amazon S3) or Amazon DynamoDB, with Amazon SQS holding a pointer to the Amazon S3 object, or you can split a large message into smaller messages.
What is SQS used for?
The most common ways to use SQS, and of course other messaging systems, in cloud applications are:
Decoupling microservices. In a microservice architecture, messages represent one of the easiest ways to set up communication between different parts of the system. If your microservices run in AWS, and especially if those are Serverless services, SQS is a great choice for that aspect of the communication.
Sending tasks between different parts of your system. You don’t have to be running a microservices-oriented application to take advantage of SQS. You can also use it in any kind of application that needs to communicate tasks to other systems.
Distributing workloads from a central node to worker nodes. You can frequently find messaging systems in the flows of distributed large workloads like map-reduce operations. For these kinds of operations, it’s essential to be able to maintain a queue of all the tasks that need to be processed, efficiently distribute the tasks between the machines or functions doing the work, and guarantee that every part of the work is only done once.
Scheduling batch jobs. SQS is a great option for scheduling batch jobs for two reasons. First, it maintains a durable queue of all the scheduled jobs, which means you don’t need to keep track of the job status — you can rely on SQS to pass the jobs through and to handle any retries, should an execution fail and your batch system returns the message to the queue. Second, it integrates with AWS Lambda; if you’re using AWS Lambda to process the batch jobs, SQS automatically launches your Lambda functions once the data is available for them to process.
There are two types of Queue:
- Standard Queue
- SQS offers a standard queue as the default queue type.
- It allows you to have an unlimited number of transactions per second.
- It guarantees that a message is delivered at least once. However, sometime, more than one copy of a message might be delivered out of order.
- It provides best-effort ordering which ensures that messages are generally delivered in the same order as they are sent but it does not provide a guarantee.
- FIFO Queue
- The FIFO Queue complements the standard Queue.
- It guarantees ordering, i.e., the order in which they are sent is also received in the same order.
- The most important features of a queue are FIFO Queue and exactly-once processing, i.e., a message is delivered once and remains available until consumer processes and deletes it.
- FIFO Queue does not allow duplicates to be introduced into the Queue.
- It also supports message groups that allow multiple ordered message groups within a single Queue.
- FIFO Queues are limited to 300 transactions per second but have all the capabilities of standard queues.
Industry Use case of Amazon SQS: Peacock Achieves a Fast and Flawless Launch Using AWS Solutions
Peacock is an over-the-top streaming service offering both video on demand and live broadcasting. The service, a joint venture of NBCUniversal and Sky, launched in July 2020 and gained 15 million users in 2 months.
The streaming service Peacock launched on July 15, 2020, by global media and technology company Comcast Corporation (Comcast) — arrived in an era of heightened consumer demand for video streaming services. In this new era, Comcast has continued to build incredible technology and entertainment services that connect millions of people to the moments and experiences that matter most. As of December 2020, Peacock had already amassed over 26 million sign-ups.
Comcast companies NBCUniversal and Sky partnered and dedicated resources to build this competitive streaming venture and moved from idea to implementation within 12 months. Conceptualized as an over-the-top streaming service that would offer video on demand with both paid and free subscription levels, Peacock would also need the capability to support live broadcasting of events around the globe. One of NBCUniversal’s expected big-ticket live broadcasts, the 2020 Summer Olympics, determined the timeline that Peacock’s technology team would be following to launch the service. That timeline gave the team just 1 year to build an entirely new system with high availability and resiliency. Knowing it had one chance to make a great first impression on viewers, Peacock needed its launch day to be perfect.
In only 1 year, Peacock created a simple, derisked, scalable, and highly available system on Amazon Web Services (AWS). And despite unforeseen obstacles like the COVID-19 pandemic and the postponement of the 2020 Olympic Games, Peacock achieved a flawless launch right on time. “In the face of aggressive timelines for launch, development, and customer readiness, we coupled our resources and expertise with those of our onboarding partners and AWS to meet those goals,” says Eric Black, head of US operations and video for Peacock.
Planning a Cloud-Based Streaming Service with a Perfect Launch
In January 2019, NBCUniversal and Sky announced they would partner for the first time to launch a joint streaming service. Peacock’s technology team envisioned a fully cloud-based system with no on-premises infrastructure. The service needed to be highly reliable at an unknown but potentially massive scale. “There are a lot of systems behind our users’ journey to their content,” says Black. “With Peacock, the infrastructure would need to be able to manage the load of a service that delivers a multidimensional experience — one that goes beyond login, search, browse, and display to provide live, on-demand, short-form, and channel-based streaming at scale.” In addition, Peacock needed to support the demands of live video streaming, which can result in aggressive spikes in viewership.
Peacock’s workflow design had to be simple and streamlined to accommodate the tight timeline. The full workflow had to stand up to an extensive testing regime, and the Peacock team needed a team available to help analyze potential problems and correct course before the launch. These needs were key in Peacock’s choice of AWS for its cloud services. “We chose AWS for its subject-matter expertise and level of support and engagement,” says Black. “It’s not just an infrastructure or technology play; the resources and expertise AWS delivers help us make our project successful.”
Architecting and Testing a Simple, Scalable Video Streaming Service
Peacock dove into building its system using a suite of AWS services. The bedrock of the architecture was Amazon Elastic Compute Cloud (Amazon EC2), which provides secure, resizable compute capacity in the cloud. With a service-level agreement of 99.99 percent availability for each Amazon EC2 region, it could provide the high availability the Peacock system needed.
While working on the network design, the Peacock team used AWS Transit Gateway to simplify and connect its virtual private clouds and on-premises networks through a central hub that acts as a cloud router in which each new connection only needs to be made once. The Peacock development team built the rest of its simple yet fully scalable system using several AWS services, including AWS AppSync, a fully managed service that helps companies develop applications faster through scalable GraphQL APIs. Peacock also used AWS Elemental MediaStore a media storage service that provides the performance, consistency, and low latency required to deliver live streaming video content — to create video-on-demand content for broadcast and multiscreen delivery at scale.
As the technology team built the Peacock system, AWS solutions architects helped put the system through rigorous testing. “We went through a number of AWS Well-Architected Reviews where we brought in AWS experts to review our configurations so that we would be prepared from operational, reliability, and performance perspectives,” says Stephen Hildebrand, vice president of performance and reliability at Peacock.
While the system’s design was simple, the team had to work hard to integrate products from multiple vendors and input from stakeholders around the world. When the COVID-19 pandemic hit in spring 2020, AWS was a key player in helping the project stay on track. “At the beginning of 2020, the entire makeup of how we were going to launch literally changed overnight,” says Keith Davidson, director of global over-the-top platforms at Sky. “But because we’d chosen the cloud and used AWS, we were able to pivot to remote work very quickly and still achieve our launch date.”
Despite the challenges of the pandemic, Peacock’s soft launch in April 2020 went off without a hitch. Its full launch in July was similarly flawless, making an overwhelmingly positive first impression on users. “It’s strategically important for us to keep reliability and security at the forefront of our service architecture,” says Patrick Miceli, executive vice president and chief technology officer at Peacock. “As a result of our multiregion, distributed approach and the help of AWS, we were able to achieve Peacock’s technology goals rapidly and at scale.”
Peacock’s cloud infrastructure on AWS has the flexibility to continue adapting for an even better user experience, as Davidson points out. “The ability to flex, adapt, and modify the infrastructure and service underneath is essential to us,” he says. “We are deploying literally every single day, and that will continue on for the life of the product.” In addition, Colin Innes, head of group reliability engineering at Sky, says the ease of building and testing infrastructure through AWS services makes fast and flawless implementation possible. “Our ability to automate and build things in the cloud — we couldn’t have achieved that velocity with what we were doing on premises,” he says. “It’s been a game changer for us.”
A Cloud Provider That Delivers
For Peacock’s technology team, the project launch was successful in part because of the help of AWS support. “We look at key resources like AWS as an extension of our team rather than a vendor with a contract. We have to be a team,” says Davidson. As for the effectiveness of AWS solutions, Black says Peacock’s success speaks for itself. “The proof is in the performance. We have a commitment to AWS because the system continues to deliver, and we and our users are pleased with the results.”
Amazon SQS provides several advantages over building your own software for managing message queues or using commercial or open-source message queuing systems that require significant up-front time for development and configuration.
These alternatives require ongoing hardware maintenance and system administration resources. The complexity of configuring and managing these systems is compounded by the need for redundant storage of messages that ensures messages are not lost if hardware fails.
In contrast, Amazon SQS requires no administrative overhead and little configuration. Amazon SQS works on a massive scale, processing billions of messages per day. You can scale the amount of traffic you send to Amazon SQS up or down without any configuration. Amazon SQS also provides extremely high message durability, giving you and your stakeholders added confidence.
I Hope You Like It…
Thank You For Reading…
If you like it please clap it.😁🤗