How McDonald's takes your UberEats orders

By on
How McDonald's takes your UberEats orders

Using microservices, Docker and Amazon.

McDonald’s is using a microservices-based architecture in AWS to underpin a home delivery platform used to fulfil fast food orders placed with third-party services like UberEats.

The fast food provider, which has 37,000 restaurants in 120 countries, has its own delivery service but increasingly takes orders from more popular online services like UberEats.

In Australia, McDonald's struck a partnership with UberEats back in June, mostly because it’s how customers wanted to have food home delivered.

Senior director of solution architecture, integration and DevOps, Thilina Gunasinghe, told AWS’ re:Invent conference late last month that McDonald’s had stood up its home delivery platform on AWS in just four months.

The platform is used by its worldwide operations to accept orders from food delivery services.

“We think of this as a customer going to something like UberEats and ordering McDonald’s food for delivery. That's kind of the business problem and use case,” Gunasinghe said.

“We work with multiple delivery partners in the world: here in the States we use UberEats and in European and Asian countries we have other partners.”

Regardless of which delivery partner operated in which region, the process was mostly the same.

“It starts by you basically picking a restaurant to order from, then you browse the menu, and then you build your order basket and complete your order,” Gunasinghe said.

“At this point the order is complete and then when the delivery rider or driver is close to one of our restaurants, the order gets released to the restaurant because we believe in making our food fresh as possible as well as giving it to the driver to deliver it to you.”

Gunasinghe said there were several “critical business requirements” that drove the team to develop the home delivery platform.

One key requirement was to deliver a platform fast: McDonald’s went from idea to execution on a “massive scale” within four months.

The architecture behind the platform had to be scalable, reliable and secure: Gunasinghe said McDonald’s takes between 250,000 and 500,000 orders an hour - or as many as 20,000 orders a second.

“The notion of peak hour for us happens three times a day every day because you’ve got to eat breakfast, lunch and dinner,” he said.

Whatever the team built needed to work across multiple countries, supporting “different business requirements, business rules and then different delivery partners.”

Cost was also a key consideration - whatever was built simply could not add to the expense of taking and fulfilling a third party order.

“We’re not talking about selling big screen TVs here,” Gunasinghe said.

“We’re talking about an average cheque size as low as US$3-5 so cost sensitivity is a pretty big thing for us as well.”

The home delivery architecture

Gunasinghe provided an “under-the-covers look” at the platform architecture and key principles used in its design.

When a customer places an order through UberEats or a similar service, it is fed via an API gateway into an EC2 cluster, which hosts “multiple microservices” that are deployed using Docker containers.

McDonald’s didn’t specify how many microservices are used to handle and appropriately route the order.

“For illustration purposes we’ve used two - but it’s important to understand these microservices have different scale and runtime profiles,” Gunasinghe said.

“So, for example, some services that are customer-facing will have tremendous scale, reliability, and performance requirements because it’s front-facing and you’re hitting that 20,000 transactions per second all day long, whereas some services could be more about complex event processing type scenarios where workload optimisation is what’s important.”

The cluster is managed using the EC2 container service (ECS). It is able to call on other AWS PaaS resources including Amazon ElastiCache to enable the system to handle high transaction volumes with low latency.

Once it passes through the cluster, the order is then sent on to the appropriate restaurant to be fulfilled.

Gunasinghe said McDonald’s “made a conscious decision to use most of our platform services from AWS”, noting that it came with the tools and power to “massively scale … out-of-the-box”, which the fast good giant saw as preferable to running its own systems.

He said ECS helped the tech team show business users how the build was progressing.

“We had to show our progress back to the business,” Gunasinghe said.

“We had two-week dev iterations for this project. Where ECS and containers really help is you could really have your dev containers, then go to staging and show progress to your business users very rapidly.”

Containerisation - and ECS - also enabled Gunasinghe’s team to incorporate elements of McDonald’s’ existing “polyglot tech stack” into the home delivery platform.

“You’re bound to have code that’s written in different languages so in our case we have some code in .NET and Java,” he said.

“Some of this might be legacy code that you need to port over, some of this might be because one language is better than another for certain things.

“In the good old days you’d have to do native integration from .NET to Java but the beauty of something like containerisation as well as ECS is now you could host it in two different containers and make the two containers talk to each other through an API. So that was also a pretty big benefit to achieve speed [on the project].”

To ensure the platform was able to scale up to meet order volumes and response times, McDonald’s used autoscaling tools that “ECS provides out of the box,” solutions architect Manjeeva Silva said.

“You just have to configure the policies for the autoscaling and it will work,” Silva said.

“ECS provides two levels of autoscale: one is for the EC2 layer to scale our EC2 [instances], and the second layer is to scale your tasks.

“How we approached this was we initially did some performance tests to run some load to mimic our production to identify what our production loads [were] going to look like.

“With that we were able to derive the attributes for those [EC2 and container] autoscaling policies.

“It’s critical to get these values correct because otherwise you will have some issues when you are scaling out.”

Copyright © . All rights reserved.

Most Read Articles

Most popular tech stories

Log In

Username / Email:
  |  Forgot your password?