---
title: "Scaling recommendations service at OLX"
description: "OLX scaled a Python FastAPI recommendations service to tens of thousands of requests per second with p99 latency under 10ms by systematically removing event-loop stalls."
url: "https://swe.quest/articles/scaling-recommendations-service-at-olx-d55314cae80c839b"
canonical: "https://tech.olx.com/scaling-recommendations-service-at-olx-db4548813e3a"
source: "OLX Tech"
published: "2025-07-08"
difficulty: "medium"
kind: "Case study"
reading_minutes: 10
tags: ["python","performance","concurrency","memory-management","recommendation-systems"]
---

# Scaling recommendations service at OLX

A post on [OLX Tech](https://swe.quest/sources/olx.md), published 2025-07-08, 10 min read, Case study. Original: [https://tech.olx.com/scaling-recommendations-service-at-olx-db4548813e3a](https://tech.olx.com/scaling-recommendations-service-at-olx-db4548813e3a)

## Summary

OLX scaled a Python FastAPI recommendations service to tens of thousands of requests per second with p99 latency under 10ms by systematically removing event-loop stalls. Key steps were making I/O non-blocking (offloading the sync ScyllaDB driver to threads, swapping boto3 for aioboto3), which cut latency over 40% and raised throughput over 50%. Batching fan-out ScyllaDB queries halved p99, and replacing Pydantic with slotted dataclasses everywhere except request inputs cut latency over 30%. Raising GC thresholds (gen0 700→7000, gen1/2 10→20) removed bimodal pauses and dropped homepage p99 from 52ms to 12ms.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Python](https://swe.quest/tags/python.md) (Languages)
- [Performance engineering](https://swe.quest/tags/performance.md) (Reliability & operations)
- [Concurrency](https://swe.quest/tags/concurrency.md) (Compilers & runtimes)
- [Memory management](https://swe.quest/tags/memory-management.md) (Compilers & runtimes)
- [Recommendations & ranking](https://swe.quest/tags/recommendation-systems.md) (AI & ML)

## Prerequisites

- Python asyncio ([easy posts on Python](https://swe.quest/tags/python.md?difficulty=easy))
- FastAPI basics
- Python GIL ([easy posts on Python](https://swe.quest/tags/python.md?difficulty=easy))

## Keywords

FastAPI, ScyllaDB, aioboto3, Pydantic, DynamoDB, New Relic, Starlette, vegeta

## Related posts

- [Rapidly scaling online storage to serve over 1 billion ChatGPT users](https://swe.quest/articles/rapidly-scaling-online-storage-to-serve-over-1-billion-chatgpt-users-05665dfd2bff721d.md): OpenAI · 2026-09-11 · Medium · 14 min read · Scaling, Python, Concurrency, Performance engineering, Resilience
  Habitat, OpenAI's online storage platform, grew from a client-side Python library over Azure Cosmos DB into a centralized Python service handling 70M+ requests per second and 500+ PB across about 40 regions.
- [From Event-Driven Chaos to a Blazingly Fast Serving API](https://swe.quest/articles/from-event-driven-chaos-to-a-blazingly-fast-serving-api-515d5b06058dbe2a.md): Zalando Engineering · 2025-03-06 · Medium · 8 min read · Caching, Load balancing, Event-driven architecture, Performance engineering, E-commerce
  Zalando replaced an event-driven pipeline that merged Product, Price and Stock events with a central Product Read API (PRAPI).
- [The search for speed in Figma](https://swe.quest/articles/the-search-for-speed-in-figma-06e4c11289fe0686.md): Figma · 2024-10-10 · Medium · 11 min read · Search, Performance engineering, Observability, Cost optimization, Cloud platforms
  Figma's search slowness traced mostly to its own stack, not OpenSearch: OpenSearch's headline 8 ms metric was per-shard time, and only the "took" field in responses reveals overall query latency, which accounted for under 30% of API time.
- [Optimization story: Bloom inference](https://swe.quest/articles/optimization-story-bloom-inference-d6344942eb1d22f2.md): Hugging Face · 2022-10-12 · Hard · 22 min read · Inference & serving, LLMs, Performance engineering, Python
  Hugging Face's BLOOM (176B parameters, 352GB in bf16) inference server reached 5x lower latency and 50x higher throughput over several weeks, starting from 0.3 req/s and 350ms/token on 16xA100 40GB with pipeline parallelism via Accelerate's device\_map="auto".
- [Break chatbot speed limits with speculative tool calls](https://swe.quest/articles/break-chatbot-speed-limits-with-speculative-tool-calls-83dbf2c2a180290f.md): incident.io · 2025-03-25 · Medium · 10 min read · AI agents, LLMs, Performance engineering, Go
  incident.io cut its incident chatbot's response latency by about 50% (saving 2-3s per interaction) by speculatively executing LLM tool calls in both directions.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
