Alibaba Group

How Alibaba Runs Near-Real-Time Flash Sale Analytics on StarRocks and Paimon

Alibaba moved Taobao Flash Sales analytics from next-day (T+1) offline processing to a near-real-time lakehouse on Apache Paimon, queried directly by StarRocks, then added materialized views and RoaringBitmap to keep dashboards and exact UV counts fast as traffic grew.

T+1→min

data freshness

Ele.me's data infrastructure previously relied on T+1 (next-day) offline processing; the Paimon lakehouse is built for minutes-level freshness, and StarRocks queries it directly

10min

MV refresh interval

StarRocks materialized views on Paimon tables serving the Flash Sales BI dashboards are refreshed every ten minutes

CompanyAlibaba Group
Use caseReal-time operational analytics for Taobao Flash Sales
Previous solutionT+1 offline processing (Ele.me data infrastructure)
CloudAlibaba Cloud
Employees3,000+
ReplacedT+1 offline processing

Originally presented at StarRocks Summit 2025: Real-World Case Studies at Alibaba Group: How StarRocks+Apache Paimon Power the Streaming Lakehouse

About Alibaba Group

Alibaba Group operates the e-commerce platform Taobao. Taobao Flash Sales is a promotion program that Taobao runs with the food delivery platform Ele.me as instant retail grows. Brands pool resources to give shoppers deep discounts or exclusive offers in short, limited-quantity sales, and Ele.me delivers the orders.

Keep the DWD-to-ADS processing in Paimon so data stays in the lake, and use StarRocks materialized views only as the last acceleration step at the ADS layer.

Key takeaway · Where materialized views fit

The talk was presented by Zhen Fan, Staff Engineer at Alibaba Cloud, and Kai Kang, StarRocks Tech Lead at Alibaba Group.

During a sale, operators watch payments and orders and adjust the campaign as it runs, which needs data that is minutes old.

The challenge

Ele.me's data infrastructure used T+1 offline processing, so analysis of a sale arrived the next day and business owners could not act on it within minutes. The team needed to ingest, clean, analyze and visualize very large data flows within minutes.

The common setup of the past decade, a Lambda architecture with a Hadoop offline warehouse for T+1 data and a Flink real-time warehouse for second-level data, means two code bases, no transactions (small updates rewrite whole partitions with INSERT OVERWRITE), and a central Hive Metastore that limits scale and holds no file-level statistics for engines like StarRocks to optimize with. Lakehouse formats solve the transaction and metadata issues, but in the speakers' view Apache Iceberg, Delta Lake and Apache Hudi are built for batch work and cannot keep up with minute-interval updates at scale.

Why Apache Paimon

Apache Paimon puts an LSM tree on cloud storage, which gives low-latency ingestion, efficient upserts and changelogs that Flink can read as a stream. It targets minutes-level freshness, integrates natively with Flink, works with Spark, StarRocks and Presto, and keeps ACID transactions, time travel and schema evolution.

The solution

In the reference pipeline, Flink handles streaming and Spark handles batch ETL through the ODS, DWD and DWS layers, all stored as Paimon tables. Final results go into StarRocks at the ADS layer, and StarRocks can also query the Paimon tables at any layer directly.

Pipeline from MySQL through Paimon ODS, DWD and DWS layers to StarRocks ADS, with Flink and Spark between layers and StarRocks Lake Query reading the ODS, DWD and DWS tables
StarRocks and Paimon across data tiers

For Taobao Flash Sales, Flink writes into Paimon, whose LSM-tree storage takes real-time writes and handles deduplication and aggregation automatically. StarRocks queries the Paimon tables in place through an external catalog, which removes an ETL hop and its delay. The team also tuned StarRocks for the lakehouse, for example with native support for Paimon deletion vectors, which improved query response times.

Materialized views on Paimon

StarRocks on Paimon covered the freshness needs at first. As the business grew very fast, peak-hour complex queries went from seconds to minutes and dashboard refreshes fell far behind.

Optimization 1: materialized views for dashboards. As more users came on, stability suffered under concurrent access and queries slowed. The team put StarRocks materialized views, refreshed every ten minutes, on the Paimon tables behind the BI dashboards, which takes the load of large queries off the cluster.

Flash Sales pipeline: LOG and DB sources feed Kafka and Hive, Flink real-time computing and Spark offline computing write to Paimon, and a StarRocks materialized view refreshed every ten minutes serves BI dashboards
Optimization 1: materialized view for dashboards

Optimization 2: long-range comparisons. After launch, operators wanted daily and weekly comparisons, which need more history than the real-time tables keep. An offline INSERT task loads the previous day's data into a StarRocks internal table. A view combines it with the real-time materialized view through UNION, so both are aggregated together at the finest grain.

Optimization 3: partitioned materialized views. Using partitioned views with partition alignment across multiple Paimon base tables, the team replaced the first view with one that keeps long history through PARTITION BY on the base table's partition field, which is much easier to run. One limit: if a lake table's lifecycle is shortened, the view drops those partitions at its next refresh, so data that must outlive the base table still needs another approach.

Two panels. Top: Paimon real-time data feeds a materialized view and historical offline data feeds an SR Table, combined by UNION into a virtual view for BI. Bottom: base table partitions 20250501 to 20250503 map to matching partitioned MV partitions for BI
Optimizations 2 and 3: stitched view and partitioned MV

The team's conclusion: materialized views work best as the final accelerator at the ADS layer, with DWD-to-ADS processing kept in Paimon.

RoaringBitmap for exact real-time deduplication

Exact distinct counts are costly when rows must be shuffled between nodes several times. With bitmaps, each dimension value holds one bitmap of user IDs, deduplication is a bitwise OR, and UV is the count of set bits, using far less storage than raw IDs. Plain bitmaps waste space on sparse dimensions, so the team stores RoaringBitmap data in Paimon and queries it with StarRocks bitmap functions.

Scenario 1: real-time UV over many traffic-log dimensions

Later, the business wanted flexible real-time metrics across channels, including non-Flash Sale data. Views directly on the DWD lake table could not keep up, and large views competing for resources refreshed late. The new pipeline:

  1. An auto-incrementing sequence maps each UID to an integer in real time.
  2. A Flink UDAF performs bitmap aggregation and union, storing results serialized.
  3. City, user segmentation and other warehouse tables are brought in.
  4. Message-queue data lands in the lake; Flink SQL stream-reads the Paimon detail data and runs lookup joins against the UID mapping and dimension tables.
  5. Mapped UIDs become bitmaps in downstream lake tables, per minute and then per hour.
  6. StarRocks computes real-time deduplicated counts with its bitmap union count function.
Kafka and Hive feed Flink real-time and Spark offline computing into a Paimon DWD table with a UID map and dimension tables; Flink Bitmap Agg writes minutely bitmaps, Bitmap Union writes hourly bitmaps, and StarRocks runs Bitmap Count and an MV for OLAP queries
Scenario 1: real-time UV with RoaringBitmap

Scenario 2: bitmaps across domains

Segmentation criteria then changed often, and refreshing dimension tables each time caused large fluctuations, so the team processed the crowd dimension separately. They also wanted one real-time bitmap asset for all traffic dimensions and visit-to-purchase rates that use order data. The revised model:

  • A middle DWS layer keeps the finest-grained aggregate state and emits bitmaps for common and single dimensions.
  • Only the UID mapping table stays in the stream; other joins move to the application layer.
  • Batch jobs build crowd-dimension bitmap lake tables, and their intersections serve crowd drill-downs.
  • The UDAF handles retraction streams to support updates, and order-domain lake tables are converted to bitmaps too.
StarRocksApache PaimonApache FlinkApache SparkApache KafkaApache HiveRoaringBitmap

The results

  • Freshness: analytics moved from next-day offline results to a lakehouse built for minutes-level freshness, which StarRocks queries in place.
  • Dashboards at peak: materialized views refreshed every ten minutes serve BI and keep large queries off the cluster.
  • Longer history: daily and weekly comparisons run on a union of real-time and historical data, later simplified with partitioned views.
  • Deduplication: querying RoaringBitmap data in Paimon with StarRocks bitmap functions made UV and cross-domain metrics much fresher and faster, including crowd drill-downs, visit-to-purchase rates and long-period traffic metrics.