Big Data 9 min read

Event-Driven Rule Engine for User Growth at Xianyu

To accelerate growth on Xianyu’s 20 million‑DAU platform, the team built an event‑driven rule engine with a SQL‑like DSL that translates user‑behavior streams into real‑time Flink/Blink queries, cutting rule development from four days to half a day and achieving sub‑5‑second processing latency.

Xianyu Technology
Xianyu Technology
Xianyu Technology
Event-Driven Rule Engine for User Growth at Xianyu

In early 2023, the Xianyu growth team faced two major challenges: a large daily active user base (20 million DAU) and a need to launch dozens of growth strategies quickly. Traditional case‑by‑case development resulted in long development cycles (up to three weeks) and delayed operational feedback.

To address these issues, the team introduced an engineering solution based on an event‑flow rule engine. User behaviors are treated as a sequential event stream, and a simple domain‑specific language (DSL) describes rules that can be evaluated in real time.

The DSL follows a SQL‑like syntax, allowing operators to write rules without deep programming knowledge. Examples include time‑window expressions (WITHIN) and aggregation functions (HAVING DISTINCT) to capture complex patterns such as “two blacklist actions from different users within one minute”.

The overall architecture consists of five layers: Business Application, Task Deployment (DSL submission), User Reach (action routing), EPL Engine (implemented on Blink/Flink), and Event Collection. Event collection normalizes logs from client requests and behavior tracking, feeding them into the EPL engine for processing.

Implementation leverages Apache Calcite for SQL parsing; single‑event DSLs are translated to Flink SQL, while multi‑event DSLs invoke Blink APIs directly. After rule evaluation, actions are routed to the User Reach module, which delivers personalized prompts to the client via long‑lived connections.

Since deployment, development time for a new rule dropped from 4 working days to about 0.5 day, and the end‑to‑end latency of the processing pipeline averages 5 seconds. The solution has been applied to multiple scenarios, including content recommendation in “fish ponds” and rental listings, demonstrating high performance and reliability under peak traffic.

Future work focuses on reducing latency for ultra‑real‑time use cases, scaling the system for exponential user growth, and integrating algorithmic recommendation models with the rule engine.

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.

rule engineBig DataFlinkDSLEvent StreamSQLuser growth
Xianyu Technology
Written by

Xianyu Technology

Official account of the Xianyu technology team

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.