Big Data 15 min read

Optimizing Apache Kylin for High‑Performance OLAP in Meituan's Sales System

Meituan’s sales system “Qingtian” boosted OLAP performance by migrating Apache Kylin’s build engine from MapReduce to Spark, consolidating Hive files, refining dictionary creation, applying a By‑layer algorithm, and bulk‑loading cuboid files to HBase, cutting resource consumption and halving build time, ultimately reaching a 100 % SLA.

Meituan Technology Team
Meituan Technology Team
Meituan Technology Team
Optimizing Apache Kylin for High‑Performance OLAP in Meituan's Sales System

Background : Since 2016 Meituan's in‑store dining team used Apache Kylin as an OLAP engine. Rapid business growth caused severe build‑time and query‑time inefficiencies.

Problem & Goal : The sales system “Qingtian” handles massive multi‑dimensional data, requiring precise deduplication and supporting thousands of concurrent queries. The aim is to improve data‑output efficiency and SLA from 90 % to 99.99 %.

Key Issues identified:

Difficulty locating root causes of inefficiency.

Build engine still based on MapReduce, not Spark.

Unreasonable resource usage and small‑file explosion.

Long build time (>2 h per day) for large fact tables.

SLA not meeting targets.

Optimization Approach :

1. Principle Understanding : Reviewed Kylin’s pre‑computation and By‑layer algorithm. The pre‑computation creates Cuboids for every dimension combination (2^N). By‑layer computes higher‑level Cuboids from lower‑level results, reducing redundant work.

2. Process Decomposition : Focused on five stages – engine selection, data reading, dictionary building, layered build, and file conversion – and refined each.

Engine Selection : Migrated the build engine from MapReduce to Spark (supported since Kylin 2.0). Spark improves build speed by 1‑3×.

Data Reading : Kylin reads Hive tables stored in HDFS. Merged small Hive files and tuned Map parameters to reduce task count.

Dictionary Building : Created dimension dictionaries to encode values and reduce HBase storage. Adjusted global dictionary dependencies for precise deduplication.

Layered Build : Adopted By‑layer algorithm exclusively under Spark. Each Cuboid layer becomes a Spark Job; each Job contains two Stages (read cache, write cache). Task parallelism is calculated as: CPU: 1*1000=1000; Memory: (6+1)*1000=7000GB Resource allocation formulas consider MapSize, cut‑mb, MaxPartition, MinPartition, and executor memory.

File Conversion : Converted built Cuboid files to HBase HFile via a MapReduce bulk‑load, aligning file count with the number of output partitions.

Implementation Roadmap : Conducted a pilot on the core sales transaction task, achieving a two‑way reduction in both resource consumption and execution time.

Results :

Overall resource usage dropped significantly across >20 Kylin jobs.

SLA reached 100 % in June 2020.

Outlook : Kylin upgraded to version 3.1 in July 2020, introducing Flink as the build engine, further improving efficiency.

Author : Yue Qing, Meituan in‑store dining R&D engineer since 2019.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

Performance OptimizationBig DataOLAPSparkApache KylinMeituan
Meituan Technology Team
Written by

Meituan Technology Team

Over 10,000 engineers powering China’s leading lifestyle services e‑commerce platform. Supporting hundreds of millions of consumers, millions of merchants across 2,000+ industries. This is the public channel for the tech teams behind Meituan, Dianping, Meituan Waimai, Meituan Select, and related services.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.