Configuration Normalization and Cache Optimization for Yanhuobao Service

By consolidating all Yanhuobao category settings into a single Mach‑managed configuration defined by a JSON schema and introducing a generic Guava LoadingCache with a ConfigValueParser, the service now adds new categories with just three fields, reduces parsing overhead, lowers maintenance costs, and improves consistency and QPS performance.

Xianyu Technology
Xianyu Technology
Xianyu Technology
Configuration Normalization and Cache Optimization for Yanhuobao Service

Rapid iteration of business systems inevitably introduces configuration "code smells". The Yanhuobao service, which provides inspection reports for high‑value items on Xianyu, faced scattered configuration across multiple systems and hard‑coded values, leading to high maintenance cost and long release cycles when adding new categories.

The optimization consolidates all category‑specific settings into a single atomic configuration using the Mach configuration platform. Each new category now requires only three configuration items: an introduction page URL (string), the inspection fee amount (number), and a list of upgradeable sub‑categories (array of strings).

Developers define a JSON Schema for the "Yanhuobao Config Set" in Mach, create an instance with effective time, priority, and fill the three fields. Mach generates appropriate UI controls (text box, number input, array list) for each type.

To avoid repeated parsing and redundant caching, a generic configuration cache pool based on Guava's LoadingCache is introduced. A ConfigValueParser interface allows each configuration to implement its own parsing logic, returning a typed YhbConfigDO object.

Usage example:

YhbConfigDO yhbConfigDO = configMachReader.get(CONFIG_MACH_ID);

The cache stores the parsed YhbConfigDO locally, reducing QPS pressure while the configuration does not require real‑time updates.

In summary, the configuration normalization and shared cache pool simplify adding new categories, lower maintenance overhead, and improve consistency across the Yanhuobao product chain.

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.

microservicessoftware engineeringConfigurationcaching
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.