Backend Development 10 min read

Design and High‑Concurrency Optimization of QR Code Generation Service for a Real Estate Platform

This article analyzes the challenges of generating massive QR codes for a real‑estate mini‑program, including URL length, concurrency limits, and path management, and presents a backend‑focused solution that uses short‑URL services, request‑id binding, pre‑generation, caching, and Kafka to achieve scalable, low‑latency QR code delivery.

Beike Product & Technology
Beike Product & Technology
Beike Product & Technology
Design and High‑Concurrency Optimization of QR Code Generation Service for a Real Estate Platform

Since the introduction of QR codes to mobile platforms, the real‑estate market has leveraged them for customer acquisition, leading to massive generation demands that strain existing WeChat APIs.

The main technical challenges identified are overly long URLs that produce dense QR codes, strict per‑minute generation limits (5,000 requests) imposed by WeChat, and the difficulty of pre‑generating QR codes for diverse property listings.

Initial mitigation using short‑URL services reduces URL length but introduces domain‑risk and compliance issues, prompting the exploration of a request‑id based approach where only the request identifier is stored and the full parameters are fetched at scan time.

However, this method adds extra front‑end request latency and reduces cache hit rates, leading to a more comprehensive design that includes:

Dynamic pre‑generation of QR codes during off‑peak hours (night, weekdays) to build a pool for peak usage.

Binding QR codes to a fixed middle‑page path while passing business‑specific parameters via request_id.

Storing binding information in a distributed cache (e.g., Redis) with fallback persistence to a database.

Leveraging high‑throughput message queues (Kafka) to hold pre‑generated QR codes ready for immediate consumption.

Performance analysis shows that this architecture shifts the bottleneck from WeChat’s API limits to internal server capacity and Kafka queue size, enabling orders of magnitude higher concurrency.

Path management is simplified by using a single middle‑page path for all QR codes, avoiding the need to maintain numerous business‑specific paths and allowing seamless scaling via Kafka partitions.

Overall, the redesigned service achieves low‑cost maintenance, high concurrency, and fast QR code delivery for the real‑estate platform.

cachingKafkahigh concurrencyQR codeReal Estate
Beike Product & Technology
Written by

Beike Product & Technology

As Beike's official product and technology account, we are committed to building a platform for sharing Beike's product and technology insights, targeting internet/O2O developers and product professionals. We share high-quality original articles, tech salon events, and recruitment information weekly. Welcome to follow us.

0 followers
Reader feedback

How this landed with the community

login 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.