---
title: "How Modal uses ClickHouse to power real-time observability for AI workloads"
description: "Modal powers three customer-facing observability dashboards (function scaling, per-call timeline, latency percentiles) from a single ClickHouse Cloud table ingesting 1–2 million events per minute and holding ~500 billion logs."
url: "https://swe.quest/articles/how-modal-uses-clickhouse-to-power-real-time-observability-for-ai-workloads-a1efae326a0a9591"
canonical: "https://clickhouse.com/blog/modal-real-time-observability-ai-workloads"
source: "ClickHouse"
published: "2025-11-05"
difficulty: "medium"
kind: "Case study"
reading_minutes: 6
tags: ["analytics","observability","stream-processing","scalability"]
---

# How Modal uses ClickHouse to power real-time observability for AI workloads

A post on [ClickHouse](https://swe.quest/sources/clickhouse.md), published 2025-11-05, 6 min read, Case study. Original: [https://clickhouse.com/blog/modal-real-time-observability-ai-workloads](https://clickhouse.com/blog/modal-real-time-observability-ai-workloads)

## Summary

Modal powers three customer-facing observability dashboards (function scaling, per-call timeline, latency percentiles) from a single ClickHouse Cloud table ingesting 1–2 million events per minute and holding ~500 billion logs. Function-call lifecycle events (queued, executing, finished) stream through Kafka and ClickPipes into a ReplacingMergeTree table keyed on function\_id, function\_call\_id and event\_at, with ULIDs enabling primary-key range queries. Queries reconstruct call state with GROUP BY function\_call\_id and argMaxIf for the latest status, and compute P50/P90/P99 queue and execution latency directly with quantile functions. The team reached this scale without indexes, projections or materialized views, and is only now starting latency optimizations.

Written by swe.quest, not by the author.

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

## Topics

- [Analytics & OLAP](https://swe.quest/tags/analytics.md) (Data & databases)
- [Observability](https://swe.quest/tags/observability.md) (Reliability & operations)
- [Stream processing](https://swe.quest/tags/stream-processing.md) (Data & databases)
- [Scaling](https://swe.quest/tags/scalability.md) (Distributed systems)

## Prerequisites

- SQL aggregation ([easy posts on SQL](https://swe.quest/tags/sql.md?difficulty=easy))
- Kafka basics ([easy posts on Queues & messaging](https://swe.quest/tags/messaging.md?difficulty=easy))
- columnar databases ([easy posts on Databases](https://swe.quest/tags/databases.md?difficulty=easy))

## Keywords

ClickHouse, ClickHouse Cloud, Modal, ReplacingMergeTree, ClickPipes, Kafka, ULID, argMaxIf

## Related posts

- [Why Astronomer chose ClickHouse to power its new data observability platform, Astro Observe](https://swe.quest/articles/why-astronomer-chose-clickhouse-to-power-its-new-data-observability-platform-f5c7916b8461008d.md): ClickHouse · 2025-03-10 · Easy · 7 min read · Analytics & OLAP, Observability, Data pipelines, Queues & messaging
  Astronomer built Astro Observe, an observability platform for Apache Airflow, on ClickHouse Cloud after a per-customer Amazon RDS Postgres setup degraded on large time-range aggregations and forced limits on retained data.
- [Goodbye limitations, hello data: How Qonto is rethinking observability with ClickHouse Cloud](https://swe.quest/articles/goodbye-limitations-hello-data-how-qonto-is-rethinking-observability-with-756d9cefa803d826.md): ClickHouse · 2026-05-01 · Easy · 8 min read · Observability, Analytics & OLAP, AI agents, Cost optimization
  Qonto, a European digital bank, moved trace storage from Grafana Tempo to ClickHouse Cloud, extending query windows from 2-3 hours to two weeks without sampling and adopting a wide-events model instead of the logs/metrics/traces pillars.
- [How the D. E. Shaw group powers high-cardinality observability at scale with ClickHouse](https://swe.quest/articles/how-the-d-e-shaw-group-powers-high-cardinality-observability-at-scale-with-b74a9887c2072ab0.md): ClickHouse · 2026-05-15 · Medium · 7 min read · Observability, Analytics & OLAP, Scaling, Capacity planning
  The D. E. Shaw group moved per-task resource metrics from its HPC grid, millions of high-cardinality time series keyed by unique task IDs, from an InfluxDB-protocol time-series platform to ClickHouse.
- [Front-end observability at scale: How OpenReplay captures billions of daily events in real time with ClickHouse](https://swe.quest/articles/front-end-observability-at-scale-how-openreplay-captures-billions-of-daily-b210d948927bb0e9.md): ClickHouse · 2026-10-21 · Easy · 8 min read · Analytics & OLAP, Observability, Data pipelines, PostgreSQL, Scaling
  OpenReplay, a self-hosted session replay and product analytics platform, moved behavioral event storage from Postgres to ClickHouse.
- [How ClickHouse Cloud enabled LaunchDarkly to build and ship features faster](https://swe.quest/articles/how-clickhouse-cloud-enabled-launchdarkly-to-build-and-ship-features-faster-0e4ac03aed14f7e6.md): ClickHouse · 2026-01-22 · Medium · 10 min read · Analytics & OLAP, Data pipelines, Observability, Multi-tenancy, Cloud platforms
  LaunchDarkly replaced Kinesis/Flink/Lambda streaming pipelines and an S3/Parquet/Athena batch warehouse with ClickHouse Cloud.

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)
