---
title: "Lambda on hard mode: Inside Modal's web infrastructure"
description: "Modal's modal-http service, written in Rust on hyper and Tokio, serves HTTP and WebSocket traffic for serverless functions by translating each request into a function call instead of reverse-proxying to containers."
url: "https://swe.quest/articles/lambda-on-hard-mode-inside-modal-s-web-infrastructure-9e5302ebea41d109"
canonical: "https://modal.com/blog/serverless-http"
source: "Modal"
published: "2024-03-14"
difficulty: "medium"
kind: "Deep dive"
reading_minutes: 17
tags: ["serverless","networking","rust","system-design","realtime"]
---

# Lambda on hard mode: Inside Modal's web infrastructure

A post on [Modal](https://swe.quest/sources/modal.md), published 2024-03-14, 17 min read, Deep dive. Original: [https://modal.com/blog/serverless-http](https://modal.com/blog/serverless-http)

## Summary

Modal's modal-http service, written in Rust on hyper and Tokio, serves HTTP and WebSocket traffic for serverless functions by translating each request into a function call instead of reverse-proxying to containers. Requests are represented as ASGI events serialized as Protocol Buffers and streamed over low-latency message queues, with batching (1 MiB or 2 ms chunks) and backpressure propagated through TCP or HTTP/2 flow control. This design lets function calls share the same scheduling infrastructure and supports request bodies up to 4 GiB and unlimited streaming responses, far beyond limits such as AWS Lambda's 6 MB. It also suits long-running, compute-heavy containers that can use up to 64 CPUs and 8 H100 GPUs.

Written by swe.quest, not by the author.

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

## Topics

- [Serverless](https://swe.quest/tags/serverless.md) (Backend & APIs)
- [Networking](https://swe.quest/tags/networking.md) (Infrastructure)
- [Rust](https://swe.quest/tags/rust.md) (Languages)
- [System design](https://swe.quest/tags/system-design.md) (Architecture & design)
- [Real-time systems](https://swe.quest/tags/realtime.md) (Backend & APIs)

## Prerequisites

- HTTP request/response model
- async Rust basics ([easy posts on Concurrency](https://swe.quest/tags/concurrency.md?difficulty=easy))
- serverless autoscaling concepts ([easy posts on Serverless](https://swe.quest/tags/serverless.md?difficulty=easy))

## Keywords

Modal, modal-http, ASGI, hyper, Tokio, WebSocket, Protocol Buffers, AWS Lambda

## Related posts

- [Modal's serverless Servers](https://swe.quest/articles/modal-s-serverless-servers-c4c4d9aad435b2d6.md): Modal · 2026-06-25 · Medium · 10 min read · Load balancing, Serverless, Inference & serving, Rust, Performance engineering
  Modal Servers are a low-latency HTTP/WebSocket/gRPC serving primitive that cut p50 request latency from 39ms to 6ms versus Modal Web Functions by dropping platform-managed queueing and keeping network calls off the hot path.
- [Bringing serverless functions closer to the speed of wire](https://swe.quest/articles/bringing-serverless-functions-closer-to-the-speed-of-wire-4593ae513494961f.md): Modal · 2026-08-04 · Medium · 5 min read · Serverless, Performance engineering, System design, Go, Queues & messaging
  Modal rebuilt its serverless I/O plane, which queues Function inputs and outputs, and now runs it in at least four regions.
- [Serverless routing made sticky](https://swe.quest/articles/serverless-routing-made-sticky-bebd537ed004d584.md): Modal · 2026-10-20 · Medium · 5 min read · Serverless, Load balancing, System design, Real-time systems, Capacity planning
  Modal's Sticky Sessions pin every request in a session to the same serverless container, which suits stateful workloads like streaming speech-to-text, voice agents, shared rooms and multiplayer games without resorting to max\_containers=1.
- [Augment Your LiveKit Agent with Modal GPUs](https://swe.quest/articles/augment-your-livekit-agent-with-modal-gpus-7c537d7efe5221b2.md): Modal · 2026-10-15 · Medium · 2 min read · Serverless, Real-time systems, Inference & serving, Speech & audio, Video & media
  LiveKit agents can offload custom or open-weights models to Modal serverless GPUs, demonstrated with a BitHuman Expression video avatar voiced by Qwen3-TTS.
- [Modal is a computer](https://swe.quest/articles/modal-is-a-computer-270db1c7ccdcba70.md): Modal · 2026-07-09 · Easy · 6 min read · Serverless, Cloud platforms, Containers, Operating systems, System design
  Modal is best understood not as a neocloud or inference provider but as a computer: a virtual machine built across dozens of cloud providers, mapped component by component onto a classic computer architecture.

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)
