London-based ASOS is an online fashion retailer on a mission to be the world’s number-one fashion destination for twentysomethings. To support its digital offering, ASOS uses Microsoft Azure Cosmos DB, a scalable, managed database that makes possible such innovations as real-time product recommendations and instant order updates for 15.4 million customers.
In 2016, global online fashion retailer ASOS made the decision to migrate to a microservices architecture powered by Microsoft Azure. The benefits were clear: greater ability to scale, faster innovation velocity, and an ability to quickly incorporate new customer engagement models.
As part of this transition, the company decided to use Microsoft Azure Cosmos DB to provide a more personalised shopping experience and speed order updates during the busiest shopping days of the year.
Because ASOS offers such a broad selection – its more than 15 million customers discover new products that they’ll love. The company uses Azure Cosmos DB across numerous microservices, including as a low-latency data store for tasks such as storing and retrieving precalculated user profiles and product machine learning models to generate real-time recommendations. It also uses Microsoft Azure SQL Database to store relational customer data.
“We chose Azure Cosmos DB because of its global distribution and ability to handle heavy seasonal bursts like Black Friday,” says Bob Strudwick, Chief Technology Officer at ASOS. “We can distribute our data models to be near the microservices they’re serving – wherever that is in the world.”
Using Azure Cosmos DB, ASOS can analyse reams of product data and produce a product relevant recommendation in milliseconds. “With Azure Cosmos DB, we can provide a delightful discovery and shopping experience for our customers while freeing our software designers and engineers to focus on creating competitive advantage, rather than looking after server infrastructure.”
The ASOS recommendations platform (Figure 1) is scheduled to be in production by late 2017. It is based on the popular lambda architecture and is split into an offline recommendations engine and an online recommendations service. The platform supports the offline training and scoring of a range of machine learning models. These are used for real-time calculation of product relevancy and the likelihood of a customer viewing, saving, adding to a cart, and ultimately buying a product.
The offline recommendations engine is used to batch-process user telemetry to build multiple machine learning models to be hosted by the online recommendations service. User interaction telemetry is stored in Azure Data Lake Store for long-term storage. Competing versions of the user and product vector models are generated, using the Apache Spark MLlib machine learning library in Azure HDInsight using Python LightFM and TensorFlow. These are then bulk-loaded by Azure Data Factory into Azure Cosmos DB.
The online recommendations service is where the magic happens. Product recommendations must be generated in real time as users browse product listings, with low end-to-end latency to ensure quick page-load times. The online recommendations service must be able to elastically scale throughput and maintain high availability to handle peak holiday shopping seasons.
This workload is a natural fit for cloud-born technologies such as Azure Cosmos DB and Azure Service Fabric. The computation and personalisation decision engine is hosted on Service Fabric, with the precomputed user profile and product vector data stored in Azure Cosmos DB to ensure low-latency, millisecond random access reads.
ASOS also uses Azure Cosmos DB to process hundreds of millions of orders on Black Friday and Cyber Monday. In 2016, Azure served 167 million ASOS customer requests in the 24 hours of Black Friday, handling 3,500 requests and 33 orders a second with an average response time of 48 milliseconds.
The company uses the Azure Cosmos DB change feed functionality to turbocharge order workflows every day, but it’s especially valuable during crushing shopping days. Azure Cosmos DB brokers communication between event-driven microservices that handle various stages of the order workflow as a persistent event store, so customers can easily track their orders. The change feed gives downstream microservices the ability to reliably and incrementally read order event updates made to the Azure Cosmos DB database.
In addition, ASOS used Azure Cosmos DB to build an easy-to-use online returns process. Customers can request a return online, download the return label, and get refunded with just a few easy steps. By using Azure Cosmos DB in various geographical regions, ASOS can handle return requests with very low network latency and provide a smooth experience for shoppers.
The company will soon run its order-update and return processes as serverless Azure Functions, which will further increase developer productivity by removing the need to provision, maintain, and manage servers.