Switchquery: A High‑Performance Mobile Configuration Platform with Second‑Level Real‑Time Delivery
This article introduces Switchquery, a high‑performance mobile configuration platform that achieves second‑level real‑time delivery through a novel architecture involving a CMS, unified gateway, header‑based version signaling, and SDKs for Android and iOS, and demonstrates its optimization, multi‑app support, and successful large‑scale deployment in major promotional events.
Switchquery is a high‑performance mobile configuration delivery platform designed for scenarios that require sub‑second configuration updates. It provides a second‑level real‑time reachability capability, enabling rapid configuration changes without relying on push notifications or long‑lived connections.
Background : With the rapid growth of mobile internet, developers need fast, low‑cost ways to toggle features, perform gray releases, and roll back problematic functions. Switchquery addresses this need by offering a unified platform that pushes configuration changes to apps within seconds.
Technical Principle : The platform uses MCube to cache templates, loads them into a view‑tree, parses expressions and custom events, and finally renders the UI. This pipeline ensures that configuration changes are reflected instantly on the client side.
Implementation Details :
Configuration is created in a CMS where Boolean, integer, and string types can be defined, along with version ranges, device‑level gray percentages, and white‑list controls.
When a configuration is saved, the CMS writes a new version number to a unified gateway. All client HTTP responses include an x-switch-config header containing the version.
The client SDK compares the received version with its local cache; if newer, it pulls the latest configuration from the Switchquery API and caches it locally.
Static JSON snapshots are stored in a CDN to provide fallback when the primary service is degraded.
Real‑Time Reachability Scheme : Instead of push, TCP/WebSocket, or polling, Switchquery embeds the configuration version in the response header of every request. Clients detect version changes and request updated configs, achieving sub‑second latency without extra connections.
Optimization Measures :
Aggregate changes within a configurable interval (default 5 seconds) to reduce gateway load.
Introduce a random delay (randomtime) before clients request new configs, smoothing traffic spikes.
Cache configuration data in server memory and CDN for high availability during large promotions.
Provide SDK adapters for various network stacks (INetWorkAdapter) and reporting interfaces (IExpMtaReporter, ICustomExceptionReporter).
Multi‑App Support : The SDK can be integrated into multiple JD apps (Android, iOS, iPad) by implementing the appropriate network and reporting adapters. The CMS allows per‑app configuration isolation via AppId.
Integration Example (Android) :
SwitchQueryFetcher.getSwitchBooleanValue(String switchName, boolean defValue)Integration Example (iOS) : BOOL JDSwitchBoolValue(NSString *key); Case Studies :
X Project (Spring Festival 2022) : Implemented startup‑interface degradation using Switchquery, reducing requests from 110 to 8 and achieving 100 % degradation success.
618 Promotion (2023) : Served 72 business modules and 671 switches with a 98.3 % reachability rate; peak QPS dropped 15.99 % compared to the previous year, ensuring stable operation during the shopping festival.
Conclusion : Switchquery provides a low‑cost, high‑performance solution for real‑time mobile configuration delivery, supporting multi‑app scenarios, robust fallback mechanisms, and extensive operational optimizations, making it suitable for large‑scale promotional events and everyday feature flag management.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
JD Tech
Official JD technology sharing platform. All the cutting‑edge JD tech, innovative insights, and open‑source solutions you’re looking for, all in one place.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
