Problem
Trendyol's homepage ordering was rebuilt by SQL jobs once an hour, so a user's clicks did not change the page until the next run. The SQL-only system was also hard to change. The team wanted the first banner on the homepage, the one holding the products a user is most interested in, to follow behavior within minutes. The challenge is cost: millions of users, many raw events per user, and a 14-day window that must be re-scored on every update.
Illustrative example: a shopper favorites a jacket at noon; at the next 15-minute cycle the first banner changes to the one where that jacket is cheapest.
Solution in brief
Keep raw events with a TTL, pre-aggregate every past day once into per-user, per-product scores, and recompute only today's events on top of them. Recalculate only users who were active in the last 15 minutes. Each product counts only for the banner where it is cheapest, and the banner with the highest summed score wins.
Questions this case answers
- How to keep per-user ranking scores close to real time when a batch job recomputes everything for all users only once an hour
- How to aggregate a long window of user events into per-user scores incrementally so that each update touches only today's raw events
- How to refresh a user's personalized homepage banner within minutes of their clicks instead of once an hour?
- How to compute per-user interest scores from clicks, favorites and basket events without rescanning raw events on every update?
Tools and methods
- Cassandra — stores raw events, daily aggregates, winner banners, active users and results
- Apache Kafka — links all the jobs and consumers
- Apache Spark — nightly job that folds previous days into one record per user and product
- Time-decay weighting — day weights and event coefficients from the data science team
- TimescaleDB — tested first, rejected for write speed
Google or a one-time email code. No password.