Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Medium Engineering 17 min read Case study mediumAdept

Engineering stories behind the Medium Daily Digest Algorithm: Part 2

Medium replaced the Bloom filters behind its recommendation filters (muted writers, already-read, presented 3+ times) with per-user DynamoDB queries against the source-of-truth tables, cutting filtering cost roughly 10x and simplifying maintenance. The Bloom filters had grown huge because entries can't be deleted, so unmutes couldn't be reflected, contents couldn't be inspected for debugging, and derived data drifted from the database. Fetching all muted writers per user is cheap because most users mute no one. For the presentation counter, which had been hacked together from three layered Bloom filters, a best-effort query of the most recent 5k presentations (~100ms) is acceptable because the 3-presentation limit is a soft rule.

Assumes: Bloom filtersDynamoDB queriesrecommendation pipelines

Related posts

  • Space efficient machine learning feature stores using probabilistic data structures - a benchmark

    Zalando Engineering mediumAdept

    A Bloom-filter-backed in-process feature store matched a conventional key-value feature store's click-prediction accuracy (AUC ≈0.7997 vs ≈0.80) using about 3% of the memory (470MB vs 15GB). It kept 90% of the history uplift at roughly 40MB, with no measurable throughput cost. Features are stored as composite user^value keys and reconstructed by probing every possible value, so false positives inject tunable noise in exchange for space. The approach suits cases where an extra network call or many lookups per request are too expensive. It is not a drop-in replacement, though: you must know the full feature domain, high-volume real-time updates must hit every node, and deletions or expiry require rebuilding the filter from scratch.

  • Engineering stories behind the Medium Daily Digest Algorithm: Part 4

    Medium Engineering mediumAdept

    Medium fixed repetitive Daily Digest recommendations for power users by tracking which digest emails had at least one clicked story ("definitely opened", since Apple Mail Privacy Protection makes open tracking unreliable) and filtering out posts already sent in such digests. Offline simulation of thresholds showed a threshold of 1 removed about 4.6 of 15 stories for complaining users but under 0.2 for free users and about 1.4 for members. An A/B test showed a statistically significant increase in reading time, larger for members. Possible next steps are converting the hard filter to a soft filter and accounting for story position in the email.

  • DuckDB User Group Workshop on AI-Powered Review Analysis with Hugging Face

    DuckDB mediumAdept

    A one-afternoon workshop pipeline uses DuckDB to find Amazon appliance products whose ratings fell most in the last six months across 2.1 million reviews, then sends only the 40 most helpful recent complaints to an LLM that groups them into themes with safety issues first. Attendees developed against a 22 MB sample, then ran the same ingest script as a $0.01/hour Hugging Face Job writing Parquet to a Storage Bucket and deployed a Gradio workflow to a Space where each node is an API endpoint. The ranking query compares recent and earlier averages with minimum review thresholds because skewed 5-star-heavy distributions make plain averages misleading. Doing the selection in SQL keeps LLM calls few, and the six-column schema lets other feedback data reuse the pipeline unchanged.

  • Timeseries indexing at scale

    Datadog Engineering mediumAdept

    Datadog replaced its timeseries index, which auto-generated materialized indexes from a log of slow queries, with an inverted index that unconditionally indexes every metric;tag pair, much like search engines map words to documents. The original Go service used SQLite for index definitions and the query log and RocksDB for Tagsets, Metrics and Indexes. It worked for predictable programmatic queries, but unpredictable user queries fell back to full scans, causing timeouts and manual index toil. The next-gen design drops SQLite, keeps RocksDB, and answers tag filters by intersecting posting lists of timeseries IDs. The two generations are compared on performance and reliability.

  • Bloom filters: the niche trick behind a 16× faster API

    incident.io mediumAdept

    incident.io cut P95 latency of its alert-filtering API for large organisations from 5s to 0.3s by pushing JSONB attribute filters into Postgres using bloom filters. Attribute key-value pairs are string-encoded, hashed with seven hash functions into a 512-bit bitmap stored as a bit(512) column, and queried with bitwise AND against bitmasks. With a 1% false-positive rate, only about 1% of the previous in-memory deserialization work remains. The bottleneck had been fetching and deserializing 500-row batches into Go structs. The team spiked a GIN index with jsonb_path_ops as the alternative and benchmarked both options before choosing.

The quest for software engineering knowledge.

Look:
Layout: