Video Transcript


A Pandemic Tale: How a Simple Algorithm Brought a Business Back from Lockdown

Sometimes, innovation is born in the midst of a crisis. Unexpected challenges and a sense of urgency force companies to look for new ways of keeping the business going, even as the odds stack up against them. This was the case for one of our biggest customers Matalan, a major fashion and homeware retailer in the U.K. The company operates 230 brick and mortar stores across the country, and 30 international franchise stores within Europe and the Middle East. It also maintains a thriving online channel that runs on the SHIFT platform.

When the global coronavirus pandemic hit, the U.K. government mandated that retailers like Matalan close their physical stores to help prevent the spread. It was a moment of crisis for both the company and its 13,000 employees. Matalan was forced to furlough 90% of its workforce, and no one knew when the business might be able to return to normal operations.

An e-commerce surge brings new challenges

On the digital side of the business, Matalan's e-commerce site was still operational, of course, and growing as rapidly as other online retailers during this time. As people found themselves stuck at home, they were spending far more money online than ever before as they stocked up on basic items or had more time to discover new products.

This put tremendous pressure on the company's distribution centers, which struggled with the surge in volume. Weeks of online orders had created a daunting backlog that the center couldn't process fast enough. Although customers understood that this was pandemic-related, there was a chance that they'd become too frustrated to return in future, posing yet another serious risk to the business.

Matalan's distribution centers also faced yet another unknown --- the U.K. government could shut down such centers at any time due to increasingly strict social distancing rules. The company's current safety efforts meant that fewer workers could be on the job each day. This only further increased the enormous backlog and threatened the viability of the online business.

All of this meant potentially thousands and thousands of jobs could be lost. Although Matalan is a large enterprise, the pandemic brought unprecedented business challenges, and while companies of this scale have "rainy day funds," cash flow is managed very carefully and there's only so far that they can stretch their resources.

We've always had a great partnership with Matalan, so when they shared their concerns with us, we wanted to find a way to help them out. We understood their goals to be:

  • Continue selling online as much as possible to serve their customer base.
  • Offset the revenue lost by physical stores that were temporarily closed. 
  • Relieve the burden on distribution centers.
  • Raise funds that could be used as a safety net to protect jobs.

Reimagining stores as distribution centers 

A few years ago, our CEO sat on the board at Matalan, and he had initiated a project to install RFID tags on all of the company's products. Unlike traditional barcodes, these tags would enable someone to walk around the store with an RFID reader and record each product currently sitting on the shelves. They could then generate a stock report easily and with far greater accuracy.

This existing "infrastructure" gave us an idea. If we knew the current inventory at each store, could we determine whether an online order could be fulfilled by one of those stores? As there were no customers coming in, the stores were in effect small warehouses. We just needed to connect the dots.

From good idea to working proof of concept — in one week

We kicked off the project by building a proof-of-concept algorithm that would run the logic needed based on things like the customer's order, their chosen payment/shipping methods, or the inventory at RFID-enabled stores. If the items could be packaged and shipped by a local store, great. If not, then the order would go to a distribution center.

Part of our process was to work with the stores to analyze how fulfillment could be done efficiently. We went around with a trolley, picking the items to be shipped, and looking for ways to optimize the flow. Would it be better for someone to collect items for one order at a time, or for multiple orders? We were able to factor this into the algorithm, so that stores wouldn't become as overwhelmed as the distribution centers.

All in all, it took our team a week to take the concept from an idea to a production-ready proof-of-concept app on Heroku. Most of this time, we were tracking down data in various systems. But once we got access to the data, it was relatively straightforward to build and deploy our app. As time was of the essence for Matalan, the speed and ease of deploying to Heroku was a great advantage. If we'd had to do all our own DevOps work, spin up servers and such, it would have taken us much longer to get the solution out the door.

Furloughed employees return as stores get ready to ship

To test our concept, we double-routed every online order for a period of time through both the traditional fulfillment path and our new algorithm that pointed to a selection of about a hundred stores. We were able to simulate what would happen with real production data without disrupting the real order flow. Fairly quickly, we could see that it was possible to offload the majority of e-commerce orders to the stores. That's when things really ramped up.

Soon, the remaining pieces of the fulfillment puzzle started falling into place. Matalan brought back furloughed employees to ten stores at first, and more as time went on. They set up stores with label printers, couriers, and other equipment and services needed to ship products. And in four to six weeks, their fleet of new mini-distribution centers was up and running.

Ready to ship a million orders per day

Since our new solution rolled out, we've seen an increasing volume of online orders that are routed in complex ways. But our app has held steady throughout, as Heroku enables us to scale seamlessly with demand. In addition, everything is lightning fast --- our API responds in ~20ms, and our routing jobs take ~100ms. This gives us the capacity to route almost a million orders per day and still provide a great experience for Matalan customers. All with minimal performance optimization.

Our ecosystem was a critical success factor

We believe that one of the keys to our project's success is that we leveraged our existing ecosystem, which was flexible and ready to adapt. The SHIFT platform is completely API-driven with webhooks that make it easy to route orders. We use all three Heroku data services: Heroku Postgres for storing stock data, Heroku Redis for queuing and calculation, and Apache Kafka on Heroku for streaming data into our order management system. We also use familiar Heroku Add-ons, like Coralogix and Heroku Scheduler. Heroku's PCI compliance also meant that we didn't have to worry about the security of our infrastructure. Because we'd already invested in our architecture, we could bolt on a new service like the Matalan app with next-to-zero effort.

A quick fix during a crisis becomes a long-term solution

As the months rolled by and pandemic rules changed, Matalan saw more ways to use our algorithm. They've been able to improve their "click and collect" model, which allows customers to place an order online and pick up the items in person at a store. Before, these orders would be shipped from a distribution center to a store (which may already have those items in stock). Now, they can route these orders directly to the collection store, and stores can actually pick and pack those orders directly in the store. This results in significant cost savings for Matalan. It allows them to scale to accept more online orders and also saves time for customers --- a true win-win.

We don't know when the pandemic will end, but we do believe that Matalan is in a better position now than before the crisis began. If a second wave happens, or a new pandemic arises, they have a mechanism in place to keep the business going and keep their people employed. We see it as a long-term risk management solution that they can fine-tune as they go along. It just goes to show how one simple algorithm can make a huge difference to a business' future.

Read the SHIFT Commerce case study to learn more about SHIFT on Heroku.

Listen to a special episode of the Code[ish] podcast featuring Ryan Townsend: Scaling Businesses During a Pandemic.

Originally published: October 20, 2020

Browse the archives for life or all blogs Subscribe to the RSS feed for life or all blogs.