Amazon Music Unifies Music Queuing at Scale Using AWS AppSync and AWS Amplify
Amazon Music used AWS AppSync and AWS Amplify to develop a centralized cloud-queuing solution that scales efficiently to support customer growth and facilitates new feature development and innovation.
With millions of music lovers modifying their playlists and queues, switching between mobile and voice devices, and going in and out of network connectivity, music streaming service Amazon Music needs to deliver an engaging, low-latency experience. To create this seamless customer experience while scaling to support peak workloads, Amazon Music decided to build a centralized, cloud-based queuing system with an on-device storage feature that supports offline playback and automatic data synchronization between clients and the central queuing system. The streaming service looked to Amazon Web Services (AWS) for a solution that could closely fit its use case, work effectively alongside its existing AWS infrastructure, and scale to support its users.
Amazon Music built the solution—called Cloud Queue—on AWS AppSync, a fully managed service that makes it simple to develop GraphQL and Pub/Sub APIs by handling the heavy lifting of securely connecting to data sources. Amazon Music also employed AWS Amplify, which lets front-end web and mobile developers quickly and easily build full-stack applications on AWS. To help bidirectional data synchronization and support new experiences, Amazon Music uses the Amplify feature Amplify DataStore—which provides a persistent on-device storage repository for users to write, read, and observe changes to data either online or offline—to manage local and cloud-generated music queues, handle transient network outages, and synchronize data to the central cloud-queuing system. Using Cloud Queue, Amazon Music delivers performance at scale while enhancing its ability to deliver new features and improvements to its users.
Opportunity | Seeking a Flexible, Centralized Queuing Solution
Amazon Music offers streaming access to songs, stations, playlists, and podcasts through several service tiers. Its premium product, Amazon Music Unlimited, provides on-demand access to more than 90 million songs. The service delivers listening experiences to an international customer base across multiple devices and relies on machine learning–powered recommendations and voice capabilities to deliver personalized experiences. Initially, Amazon Music implemented music-queuing features separately for each of its supported devices and built local data models independently of one another. But that meant a user’s play queue was tied to just one device at a time. “We needed a centralized, common representation of a music queue playing on a device,” says Caleb Gross, senior engineer on the Cloud Queue team at Amazon Music. “Without that, we were limited in terms of some of the features that we wanted to build, including the ability to move a queue from one device to the next.” By developing a central, cloud-backed data model, Amazon Music could support moving queues between devices and give its teams the tools to build and launch new experiences in a common way.
The team considered building a solution in-house but ultimately decided that it would be faster and more cost effective to find existing solutions that could provide the required robustness and functionality. It chose AWS AppSync and Amplify DataStore because of their high availability, flexible scaling, strong support, compatibility with supporting AWS services, and native support for the apps that Amazon Music operated, such as iOS and Android.
Using a managed service like AWS AppSync alongside AWS Amplify, we don’t need to spend as much time thinking about operations. We can spend more time doing what we do well, including building new customer experiences.”
Senior Engineer on the Cloud Queue team, Amazon Music
Solution | Delivering Data Synchronization at Scale on AWS
Amazon Music began work on the cloud-queuing project in May 2020, rebuilding its services on the new solution and delivering its first major launch in July 2021. The solution employs many AWS services, including services for networking, serverless computing, data storage, and logging and monitoring. Amazon Music also used AWS services to proactively debug issues and acquire performance insights to reduce latency by hundreds of milliseconds and support a successful solution launch. “At its simplest, it’s a full-feature music-queuing system that’s hosted in the cloud,” says Gross. “A key advantage of using AWS AppSync and AWS Amplify is that we have both cloud-based support and local-queuing logic support, so we can take advantage of local data and logic when it is available while also leveraging the intelligence and flexibility of the cloud.”
In addition to supporting queuing with local data, the solution also syncs locally stored queues back to the cloud, delivering centralized queue storage in a single data model. Amazon Music relies on AWS AppSync to host its external APIs for its data model operations. These data models are stored in the cloud in Amazon DynamoDB, a fully managed, serverless, key-value NoSQL database, and locally in Amplify DataStore. To smoothly incorporate its AWS Amplify assets into its build and deployment processes, Amazon Music also relies on the extensibility features of Amplify, including the command hooks and export features.
Amazon Music is also working to innovate using the subscriptions feature using Amplify. “You can make a change in the cloud and then propagate that change to the local data on devices without requiring the device to poll for updates,” says Gross. Using this feature, Amazon Music can combine the low latency of local-data experiences with the intelligent optimization of cloud-based services. “We can use this functionality to deliver a snappy local-data feel while still making cloud-based improvements to the delivery of content,” says Gross. “This is a fundamental technological issue that we are using AWS AppSync and AWS Amplify to help us solve.”
Using AWS AppSync for Cloud Queue, Amazon Music scales with customer growth and handles peak throughput of more than 70,000 transactions per second. Amazon Music also minimizes its day-to-day administration efficiently because it relies on AWS to manage scaling, availability, and maintenance. “Using a managed service like AWS AppSync alongside AWS Amplify, we don’t need to spend as much time thinking about operations and scaling,” says Gross. “We can spend more time doing what we do well, including building new customer experiences.”
Outcome | Investing in Building New Customer Experiences
Using AWS AppSync and Amplify, Amazon Music has established foundational queuing-platform improvements and is actively building new and improved customer features on top of it. “The ultimate business objective is velocity so that we can delight our customers faster,” says Gross. “Having a centralized, synchronized queue data solution helps us to build common features across our different apps and bring new features to customers more quickly.”
The team at Amazon Music plans to continue improving the user experience by using AWS AppSync and Amplify to support innovative new features, such as DJ Mode, which incorporates artist-related content and DJ-style commentary into music queues. Further, there’s strong support within Amazon Music to continue investing in the Cloud Queue solution. “Cloud Queue has become central to all things going on in Amazon Music,” says Gross. “And many teams are talking with us internally about how they want to use it to onboard new experiences.”
About Amazon Music
Amazon Music is a streaming service offering access to thousands of stations and playlists and millions of podcast episodes, with offline listening and voice capabilities. Its Amazon Music Unlimited service provides on-demand access to more than 90 million songs.