Skip to main content

Real architecture · Mid

iFood: recommendation and inference platform

Real production architecture. Key points: pre-indexing predictions + real-time data, hundreds of models, and high availability.

15 min read · Source: iFood · Content reviewed on October 23, 2026

Short answer

Real production architecture. Key points: pre-indexing predictions + real-time data, hundreds of models, and high availability. iFood receives thousands of simultaneous visits and, on each visit, the app loads dozens of pieces of content, among restaurants, dishes, grocery stores, and products, to guide the choice of the person ordering.

01 · CONTEXT AND PROBLEM

Recommending on the home of a delivery app

iFood receives thousands of simultaneous visits and, on each visit, the app loads dozens of pieces of content, among restaurants, dishes, grocery stores, and products, to guide the choice of the person ordering. The recommendation systems that serve this environment in real time must support a high load with high availability and resilience.

Cost is the central problem. According to the team, even a simple model, such as a matrix factorization, can require a large number of machines to serve recommendations in real time. In addition, customers change preferences depending on context, such as location and time of day, and this requires extra effort per model and service, increasing cost. The team's question is how to scale dozens of different models and combine them with the customer's context.

iFood's answer is to pre-index the predictions of multiple models, which allows combining them with other sources of information in real time.

02 · INGESTION

From candidate to stored prediction

The platform is an architecture of microservices separated into two domains, Ingestion and Server. We start with Ingestion, which produces the predictions before any customer visit.

  1. The candidate generation pipeline filters what is relevant and leaves the candidates in files on S3.

    Architecture diagram: iFood: prediction ingestion
    CPCandidate generationfiltra
    DBCandidate filescandidatos
    CPBatch prediction (SageMaker)
    DBPrediction files
    CPFeature Publisher (Lambda)
    QKafka topic
    CPFeature Consumer (Go)
    DBPersonalization Store
  2. The candidates are processed by multiple models on SageMaker, which uses Batch Transform to scale the predictions.

    Architecture diagram: iFood: prediction ingestion
    CPCandidate generation
    DBCandidate files
    CPBatch prediction (SageMaker)one pipeline per model
    DBPrediction files
    CPFeature Publisher (Lambda)
    QKafka topic
    CPFeature Consumer (Go)
    DBPersonalization Store
  3. The prediction output is written to multiple files on S3.

    Architecture diagram: iFood: prediction ingestion
    CPCandidate generation
    DBCandidate files
    CPBatch prediction (SageMaker)
    DBPrediction filespredictions
    CPFeature Publisher (Lambda)
    QKafka topic
    CPFeature Consumer (Go)
    DBPersonalization Store
  4. Creating the files triggers the Lambda function Feature Publisher, which reads the predictions.

    Architecture diagram: iFood: prediction ingestion
    CPCandidate generation
    DBCandidate files
    CPBatch prediction (SageMaker)
    DBPrediction files
    CPFeature Publisher (Lambda)event-triggered
    QKafka topic
    CPFeature Consumer (Go)
    DBPersonalization Store
  5. The Feature Publisher publishes the predictions to a Kafka topic.

    Architecture diagram: iFood: prediction ingestion
    CPCandidate generation
    DBCandidate files
    CPBatch prediction (SageMaker)
    DBPrediction files
    CPFeature Publisher (Lambda)
    QKafka topicmensagens
    CPFeature Consumer (Go)
    DBPersonalization Store
  6. The Feature Consumer consumes the topic and inserts the predictions into the Personalization Store.

    Architecture diagram: iFood: prediction ingestion
    CPCandidate generation
    DBCandidate files
    CPBatch prediction (SageMaker)
    DBPrediction files
    CPFeature Publisher (Lambda)
    QKafka topic
    CPFeature Consumer (Go)consome
    DBPersonalization Storepre-indexed

A prior candidate generation flow filters the relevant entities for each context. The same pipeline selects the customers that must be updated daily and a reduced set of restaurants for each one.

Each model has independently automated training and prediction with SageMaker Pipelines, and Batch Transform scales the predictions. The messages go through a Kafka topic, a message queue that decouples whoever generates the predictions from whoever writes them.

The Go consumer reads tens of millions of messages from the topic and writes to the Personalization Store, a NoSQL database that holds about ten billion predictions.

03 · SERVER

Read what is already ready and reorder on the spot

The Personalization Store uses a well-partitioned schema to ensure read scalability. This is the read that the server performs on each app session.

  1. The server receives all the app's calls.

    Architecture diagram: iFood: prediction server
    CLApplication
    CPPrediction serverentry point
    DBPersonalization Store
    CPRe-ranking models
    CPOther real-time sources
  2. For each user, the server retrieves the predictions of the various models stored in the Personalization Store.

    Architecture diagram: iFood: prediction server
    CLApplication
    CPPrediction server
    DBPersonalization Storestored predictions
    CPRe-ranking models
    CPOther real-time sources
  3. The response is enriched with the precomputed predictions and goes through ranking models applied on the spot.

    Architecture diagram: iFood: prediction server
    CLApplication
    CPPrediction server
    DBPersonalization Store
    CPRe-ranking modelsre-ranking
    CPOther real-time sources
  4. The architecture allows combining the predictions with other sources of information in real time.

    Architecture diagram: iFood: prediction server
    CLApplication
    CPPrediction server
    DBPersonalization Store
    CPRe-ranking models
    CPOther real-time sourcescontexto

04 · ML PLATFORM

How models reach production

Another AWS post, whose title mentions hundreds of models, describes the other side of the problem. Previously, data scientists created models in notebooks and published them to services, and engineering teams struggled to integrate them into production systems. To overcome this, iFood built an internal ML platform.

In this platform, ML Go! is responsible for deploying SageMaker pipelines and endpoints. See the path from code to prediction.

  1. The flow starts with the ML Go! CI/CD pipeline sending the training and deployment code artifacts.

    Architecture diagram: iFood: ML platform
    CPML Go! CI/CDmodel code
    CPSageMaker Pipelines
    DBModel Registry
    CPReal-time endpoints
    CPBatch transform jobs
    NWML Go! Gateway
  2. Each model available for deployment is automatically registered in the Model Registry, with versioning and tracking.

    Architecture diagram: iFood: ML platform
    CPML Go! CI/CD
    CPSageMaker Pipelines
    DBModel Registryversions
    CPReal-time endpoints
    CPBatch transform jobs
    NWML Go! Gateway
  3. In batch prediction cases, the pipeline creates a batch transform job.

    Architecture diagram: iFood: ML platform
    CPML Go! CI/CD
    CPSageMaker Pipelines
    DBModel Registry
    CPReal-time endpoints
    CPBatch transform jobslote
    NWML Go! Gateway
  4. In real-time inference, the pipeline deploys the model to an endpoint.

    Architecture diagram: iFood: ML platform
    CPML Go! CI/CD
    CPSageMaker Pipelines
    DBModel Registry
    CPReal-time endpointsreal time
    CPBatch transform jobs
    NWML Go! Gateway
  5. The Gateway is a single abstraction for connecting to SageMaker endpoints and jobs.

    Architecture diagram: iFood: ML platform
    CPML Go! CI/CD
    CPSageMaker Pipelines
    DBModel Registry
    CPReal-time endpoints
    CPBatch transform jobs
    NWML Go! Gatewaysingle abstraction
CriterionBatch predictionReal-time inference
What the pipeline createsA SageMaker batch transform job for large-scale predictionsA SageMaker endpoint where the model is deployed
Use described in the postGenerate recommendations or insights for partner restaurantsCustomer-facing applications, with immediate predictions

In the most recent architecture, the separation of responsibilities inside the endpoints, with the Inference Components feature, makes serving faster and more efficient.

05 · RESULTS AND TRADE-OFFS

What iFood reports and what to ask

iFood reports 6x more scalability, from 500 to more than 3000 requests per second. It also reports savings of about 50% in the cost of serving content on the home, since most of the information is pre-indexed, and an improvement of about 10% in list conversion.

Frequently asked questions

What is iFood: recommendation and inference platform?

Real production architecture. Key points: pre-indexing predictions + real-time data, hundreds of models, and high availability.

What does the iFood: recommendation and inference platform design cover?

It is organized in these sections: Recommending on the home of a delivery app, From candidate to stored prediction, Read what is already ready and reorder on the spot, How models reach production, and What iFood reports and what to ask.

How long is iFood: recommendation and inference platform and what level is it?

It takes about 15 minutes to read and is rated Mid level.

Now design it yourself

Run this case as an interview in the System Design school: you make the decisions, the tutor challenges them and you see how your design scores.