Big Data 12 min read

From 4 Hours to 1 Hour: Optimizing Coupon Calculations with Storm Stream Processing

Facing a four‑hour coupon‑calculation bottleneck at eLong, I explored Storm’s stream‑processing model, identified the data‑extraction stage as the weak link, refactored the hotel‑pull service, leveraged RocketMQ for threading, and ultimately reduced full‑batch processing time to just over an hour.

Su San Talks Tech
Su San Talks Tech
Su San Talks Tech
From 4 Hours to 1 Hour: Optimizing Coupon Calculations with Storm Stream Processing

In 2014 I worked on the coupon calculation service for eLong’s promotion team, which relied on the Storm stream‑processing framework to compute real‑time discount rules for hotels across cities.

Background

The service used Storm because its core language, Clojure, was uncommon, and many developers were curious about it. As mobile traffic surged, the coupon calculation became a performance bottleneck, taking several hours for a full‑batch run.

Exploring Storm

To understand Storm, I studied its topology: a Spout (data source) feeds streams into Bolts (processing units), similar to water flowing through pipes. I built a simple “Hello World” topology and began investigating its concurrency model.

Storm topology diagram
Storm topology diagram

Identifying the Bottleneck

By breaking the service into three stages—data extraction, Storm computation, and persistence—I examined logs and found that data extraction (pulling hotel information into Redis) consumed over two hours of the four‑hour total.

Coupon stream processing topology
Coupon stream processing topology

Refactoring the Extraction Service

The extraction service’s thread model limited each node to two threads. I rewrote it to allow horizontal scaling and made the worker thread count configurable, using insights from RocketMQ’s threading design.

Hotel pull service logic diagram
Hotel pull service logic diagram

Results

After a week of refactoring and thorough code reviews and testing, the new service ran on three nodes with eight workers each. Full‑batch processing time dropped from four hours to about 1 hour 15 minutes, with the extraction stage now taking only 40 minutes.

Conclusion

The experience taught me the importance of understanding a framework’s architecture, profiling each pipeline stage, and applying systematic refactoring to achieve dramatic performance gains.

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.

JavaPerformance Optimizationstream processingredisRocketMQCoupon SystemStorm
Su San Talks Tech
Written by

Su San Talks Tech

Su San, former staff at several leading tech companies, is a top creator on Juejin and a premium creator on CSDN, and runs the free coding practice site www.susan.net.cn.

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.